Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm

Issue 2959233002: [iOS] Add EG tests for the Keyboard accessory view. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/toolbar/toolbar_egtest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
index a1b47878f81b83b957a344ca2482dc5c14343be6..079740e3058f353c09cfee671a97a2ec41a53bcf 100644
--- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
+++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -12,6 +12,7 @@
#include "components/version_info/version_info.h"
#import "ios/chrome/app/main_controller.h"
#include "ios/chrome/browser/chrome_switches.h"
+#include "ios/chrome/browser/experimental_flags.h"
#import "ios/chrome/browser/ui/browser_view_controller.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
@@ -111,12 +112,29 @@ id<GREYMatcher> DialogCancelButton() {
grey_accessibilityTrait(UIAccessibilityTraitStaticText), nil);
}
-// Opens the QR Scanner view using a command.
-// TODO(crbug.com/629776): Replace the command call with a UI action.
-void ShowQRScannerWithCommand() {
- GenericChromeCommand* command =
- [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_QR_SCANNER];
- chrome_test_util::RunCommandWithActiveViewController(command);
+// Opens the QR Scanner view.
+void ShowQRScanner() {
+ if (experimental_flags::IsKeyboardAccessoryViewWithCameraSearchEnabled()) {
justincohen 2017/06/28 21:20:53 Is this enabled by default?
jif 2017/06/29 15:57:04 It is. I was thinking of removing the "else" once
justincohen 2017/06/29 15:58:24 If you think it's reasonable, maybe add a comment
jif 2017/06/29 18:29:26 Done.
+ // Tap the omnibox to get the keyboard accessory view to show up.
+ id<GREYMatcher> locationbarButton = grey_allOf(
+ grey_accessibilityLabel(l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT)),
+ grey_minimumVisiblePercent(0.2), nil);
+ [[EarlGrey selectElementWithMatcher:locationbarButton]
+ assertWithMatcher:grey_text(@"Search or type URL")];
+ [[EarlGrey selectElementWithMatcher:locationbarButton]
+ performAction:grey_tap()];
+
+ // Tap the QR Code scanner button in the keyboard accessory view.
+ id<GREYMatcher> matcher =
+ grey_allOf(grey_accessibilityLabel(@"QR code Search"),
+ grey_kindOfClass([UIButton class]), nil);
+
+ [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
+ } else {
+ GenericChromeCommand* command =
+ [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_QR_SCANNER];
+ chrome_test_util::RunCommandWithActiveViewController(command);
+ }
}
// Taps the |button|.
@@ -251,7 +269,7 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
[self assertModalOfClass:[UIAlertController class] isNotPresentedBy:bvc];
[self addCameraControllerInitializationExpectations:mock];
- ShowQRScannerWithCommand();
+ ShowQRScanner();
[self waitForModalOfClass:[QRScannerViewController class] toAppearAbove:bvc];
[self assertQRScannerUIIsVisibleWithTorch:NO];
[self assertModalOfClass:[UIAlertController class]
@@ -632,7 +650,7 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
AVAuthorizationStatusDenied];
[self swizzleCameraController:cameraControllerMock];
- ShowQRScannerWithCommand();
+ ShowQRScanner();
[self assertModalOfClass:[QRScannerViewController class]
isNotPresentedBy:bvc];
[self waitForModalOfClass:[UIAlertController class] toAppearAbove:bvc];
« no previous file with comments | « no previous file | ios/chrome/browser/ui/toolbar/toolbar_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698