| 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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "base/ios/ios_util.h" | 8 #include "base/ios/ios_util.h" |
| 9 #include "components/strings/grit/components_strings.h" | 9 #include "components/strings/grit/components_strings.h" |
| 10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #import "ios/web/public/test/http_server/http_server.h" | 25 #import "ios/web/public/test/http_server/http_server.h" |
| 26 #include "ios/web/public/test/http_server/http_server_util.h" | 26 #include "ios/web/public/test/http_server/http_server_util.h" |
| 27 #include "ui/base/l10n/l10n_util_mac.h" | 27 #include "ui/base/l10n/l10n_util_mac.h" |
| 28 | 28 |
| 29 #if !defined(__has_feature) || !__has_feature(objc_arc) | 29 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 30 #error "This file requires ARC support." | 30 #error "This file requires ARC support." |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 using chrome_test_util::ButtonWithAccessibilityLabelId; | 33 using chrome_test_util::ButtonWithAccessibilityLabelId; |
| 34 using chrome_test_util::OmniboxText; | 34 using chrome_test_util::OmniboxText; |
| 35 using chrome_test_util::WebViewContainingText; | |
| 36 | 35 |
| 37 // Toolbar integration tests for Chrome. | 36 // Toolbar integration tests for Chrome. |
| 38 @interface ToolbarTestCase : ChromeTestCase | 37 @interface ToolbarTestCase : ChromeTestCase |
| 39 @end | 38 @end |
| 40 | 39 |
| 41 namespace { | 40 namespace { |
| 42 | 41 |
| 43 // Displays the |panel_type| new tab page. On a phone this will send a command | 42 // Displays the |panel_type| new tab page. On a phone this will send a command |
| 44 // to display a dialog, on tablet this calls -selectPanel to slide the NTP. | 43 // to display a dialog, on tablet this calls -selectPanel to slide the NTP. |
| 45 void SelectNewTabPagePanel(NewTabPage::PanelIdentifier panel_type) { | 44 void SelectNewTabPagePanel(NewTabPage::PanelIdentifier panel_type) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 | 70 |
| 72 // Verifies that entering a URL in the omnibox navigates to the correct URL and | 71 // Verifies that entering a URL in the omnibox navigates to the correct URL and |
| 73 // displays content. | 72 // displays content. |
| 74 - (void)testEnterURL { | 73 - (void)testEnterURL { |
| 75 web::test::SetUpFileBasedHttpServer(); | 74 web::test::SetUpFileBasedHttpServer(); |
| 76 const GURL URL = web::test::HttpServer::MakeUrl( | 75 const GURL URL = web::test::HttpServer::MakeUrl( |
| 77 "http://ios/testing/data/http_server_files/destination.html"); | 76 "http://ios/testing/data/http_server_files/destination.html"); |
| 78 [ChromeEarlGrey loadURL:URL]; | 77 [ChromeEarlGrey loadURL:URL]; |
| 79 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] | 78 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 80 assertWithMatcher:grey_notNil()]; | 79 assertWithMatcher:grey_notNil()]; |
| 81 [[EarlGrey selectElementWithMatcher:WebViewContainingText("You've arrived")] | 80 [ChromeEarlGrey waitForWebViewContainingText:"You've arrived"]; |
| 82 assertWithMatcher:grey_notNil()]; | |
| 83 } | 81 } |
| 84 | 82 |
| 85 // Verifies opening a new tab from the tools menu. | 83 // Verifies opening a new tab from the tools menu. |
| 86 - (void)testNewTabFromMenu { | 84 - (void)testNewTabFromMenu { |
| 87 chrome_test_util::AssertMainTabCount(1); | 85 chrome_test_util::AssertMainTabCount(1); |
| 88 | 86 |
| 89 // Open tab via the UI. | 87 // Open tab via the UI. |
| 90 [ChromeEarlGreyUI openToolsMenu]; | 88 [ChromeEarlGreyUI openToolsMenu]; |
| 91 id<GREYMatcher> newTabButtonMatcher = | 89 id<GREYMatcher> newTabButtonMatcher = |
| 92 grey_accessibilityID(kToolsMenuNewTabId); | 90 grey_accessibilityID(kToolsMenuNewTabId); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButtonText; | 465 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButtonText; |
| 468 | 466 |
| 469 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] | 467 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] |
| 470 performAction:grey_tap()]; | 468 performAction:grey_tap()]; |
| 471 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] | 469 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 472 assertWithMatcher:chrome_test_util::OmniboxText("")]; | 470 assertWithMatcher:chrome_test_util::OmniboxText("")]; |
| 473 | 471 |
| 474 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); | 472 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); |
| 475 } | 473 } |
| 476 @end | 474 @end |
| OLD | NEW |