| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 const GURL URL = web::test::HttpServer::MakeUrl("http://origin"); | 119 const GURL URL = web::test::HttpServer::MakeUrl("http://origin"); |
| 120 | 120 |
| 121 [ChromeEarlGrey loadURL:URL]; | 121 [ChromeEarlGrey loadURL:URL]; |
| 122 | 122 |
| 123 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 123 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] |
| 124 assertWithMatcher:chrome_test_util::omniboxText(URL.GetContent())]; | 124 assertWithMatcher:chrome_test_util::omniboxText(URL.GetContent())]; |
| 125 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 125 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] |
| 126 performAction:grey_typeText(@"foo")]; | 126 performAction:grey_typeText(@"foo")]; |
| 127 | 127 |
| 128 id<GREYMatcher> CancelButton = | 128 id<GREYMatcher> cancelButton = |
| 129 grey_allOf(chrome_test_util::buttonWithAccessibilityLabelId(IDS_CANCEL), | 129 grey_allOf(chrome_test_util::cancelButton(), |
| 130 grey_not(grey_accessibilityID(@"Typing Shield")), nil); | 130 grey_not(grey_accessibilityID(@"Typing Shield")), nil); |
| 131 [[EarlGrey selectElementWithMatcher:CancelButton] performAction:grey_tap()]; | 131 [[EarlGrey selectElementWithMatcher:cancelButton] performAction:grey_tap()]; |
| 132 | 132 |
| 133 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 133 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] |
| 134 assertWithMatcher:chrome_test_util::omniboxText(URL.GetContent())]; | 134 assertWithMatcher:chrome_test_util::omniboxText(URL.GetContent())]; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Tests whether input mode in an omnibox can be canceled via "hide keyboard" | 137 // Tests whether input mode in an omnibox can be canceled via "hide keyboard" |
| 138 // button and asserts it doesn't commit the omnibox contents if the input is | 138 // button and asserts it doesn't commit the omnibox contents if the input is |
| 139 // canceled. | 139 // canceled. |
| 140 - (void)testToolbarOmniboxHideKeyboard { | 140 - (void)testToolbarOmniboxHideKeyboard { |
| 141 // TODO(crbug.com/642559): Enable the test for iPad when typing bug is fixed. | 141 // TODO(crbug.com/642559): Enable the test for iPad when typing bug is fixed. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] | 437 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] |
| 438 performAction:grey_tap()]; | 438 performAction:grey_tap()]; |
| 439 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 439 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] |
| 440 assertWithMatcher:chrome_test_util::omniboxText("")]; | 440 assertWithMatcher:chrome_test_util::omniboxText("")]; |
| 441 | 441 |
| 442 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); | 442 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 @end | 445 @end |
| OLD | NEW |