OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #import <EarlGrey/EarlGrey.h> | 7 #import <EarlGrey/EarlGrey.h> |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 #import <XCTest/XCTest.h> | 9 #import <XCTest/XCTest.h> |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 assertWithMatcher:grey_notNil()]; | 207 assertWithMatcher:grey_notNil()]; |
208 | 208 |
209 // TODO(crbug.com/617652): This code should be removed when a common helper | 209 // TODO(crbug.com/617652): This code should be removed when a common helper |
210 // is added to close any menus, which should be run as test setup. | 210 // is added to close any menus, which should be run as test setup. |
211 if (IsCompact()) { | 211 if (IsCompact()) { |
212 [[EarlGrey selectElementWithMatcher:CloseToolsMenuButton()] | 212 [[EarlGrey selectElementWithMatcher:CloseToolsMenuButton()] |
213 performAction:grey_tap()]; | 213 performAction:grey_tap()]; |
214 } | 214 } |
215 | 215 |
216 // Close the opened tab. | 216 // Close the opened tab. |
217 GenericChromeCommand* command = | 217 [chrome_test_util::BrowserCommandDispatcherForMainBVC() closeCurrentTab]; |
218 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_TAB]; | |
219 chrome_test_util::RunCommandWithActiveViewController(command); | |
220 } | 218 } |
221 | 219 |
222 // Tests that tapping a bookmark on the NTP navigates to the proper URL. | 220 // Tests that tapping a bookmark on the NTP navigates to the proper URL. |
223 - (void)testTapBookmark { | 221 - (void)testTapBookmark { |
224 const GURL bookmarkURL = web::test::HttpServer::MakeUrl( | 222 const GURL bookmarkURL = web::test::HttpServer::MakeUrl( |
225 "http://ios/testing/data/http_server_files/destination.html"); | 223 "http://ios/testing/data/http_server_files/destination.html"); |
226 NSString* bookmarkTitle = @"smokeTapBookmark"; | 224 NSString* bookmarkTitle = @"smokeTapBookmark"; |
227 | 225 |
228 // Load a bookmark into the bookmark model. | 226 // Load a bookmark into the bookmark model. |
229 [BookmarksTestCase addBookmark:bookmarkURL withTitle:bookmarkTitle]; | 227 [BookmarksTestCase addBookmark:bookmarkURL withTitle:bookmarkTitle]; |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 if (!IsCompact()) { | 1687 if (!IsCompact()) { |
1690 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()]; | 1688 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()]; |
1691 } else { | 1689 } else { |
1692 [ChromeEarlGreyUI openToolsMenu]; | 1690 [ChromeEarlGreyUI openToolsMenu]; |
1693 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()] | 1691 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()] |
1694 performAction:grey_tap()]; | 1692 performAction:grey_tap()]; |
1695 } | 1693 } |
1696 } | 1694 } |
1697 | 1695 |
1698 @end | 1696 @end |
OLD | NEW |