| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 NSString* typingShield = @"Hide keyboard"; | 464 NSString* typingShield = @"Hide keyboard"; |
| 465 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButtonText; | 465 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButtonText; |
| 466 | 466 |
| 467 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] | 467 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] |
| 468 performAction:grey_tap()]; | 468 performAction:grey_tap()]; |
| 469 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] | 469 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 470 assertWithMatcher:chrome_test_util::OmniboxText("")]; | 470 assertWithMatcher:chrome_test_util::OmniboxText("")]; |
| 471 | 471 |
| 472 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); | 472 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); |
| 473 } | 473 } |
| 474 |
| 475 // Tests typing in the omnibox using the keyboard accessory view. |
| 476 - (void)testToolbarOmniboxKeyboardAccessoryView { |
| 477 // Select the omnibox to get the keyboard up. |
| 478 id<GREYMatcher> locationbarButton = grey_allOf( |
| 479 grey_accessibilityLabel(l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT)), |
| 480 grey_minimumVisiblePercent(0.2), nil); |
| 481 [[EarlGrey selectElementWithMatcher:locationbarButton] |
| 482 assertWithMatcher:grey_text(@"Search or type URL")]; |
| 483 [[EarlGrey selectElementWithMatcher:locationbarButton] |
| 484 performAction:grey_tap()]; |
| 485 |
| 486 // Tap the "/" keyboard accessory button. |
| 487 id<GREYMatcher> slashButtonMatcher = grey_allOf( |
| 488 grey_accessibilityLabel(@"/"), grey_kindOfClass([UIButton class]), nil); |
| 489 |
| 490 [[EarlGrey selectElementWithMatcher:slashButtonMatcher] |
| 491 performAction:grey_tap()]; |
| 492 |
| 493 // Tap the ".com" keyboard accessory button. |
| 494 id<GREYMatcher> dotComButtonMatcher = |
| 495 grey_allOf(grey_accessibilityLabel(@".com"), |
| 496 grey_kindOfClass([UIButton class]), nil); |
| 497 |
| 498 [[EarlGrey selectElementWithMatcher:dotComButtonMatcher] |
| 499 performAction:grey_tap()]; |
| 500 |
| 501 // Verify that the omnibox contains "/.com" |
| 502 [[EarlGrey |
| 503 selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"/.com"), |
| 504 grey_kindOfClass( |
| 505 [OmniboxPopupMaterialRow class]), |
| 506 nil)] |
| 507 assertWithMatcher:grey_sufficientlyVisible()]; |
| 508 } |
| 509 |
| 474 @end | 510 @end |
| OLD | NEW |