Commit a89e9753 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Re-enable QRScanner EG2Test after fixing iOS 12 bug

The root cause here was that the UIImage returned from the
qr_scanner_app_interface was nil on iOS 12, even though it was non-nil
in iOS 13. I'm not sure why this happened.

In the end, just passing the icon's accessibility label worked and is
probably better for the test, so I switched to that.

I could reproduce the failure, and the tests now pass locally, so
it should be fixed.

TBR=eugenebut@chromium.org

Bug: 1019211
Change-Id: I70e63d5143b8fd7f02ca4b0f62f845196590f282
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893253
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711233}
parent e85e8fe0
......@@ -18,8 +18,8 @@
@property(nonatomic, class, readonly)
UIViewController* currentBrowserViewController;
// Returns the image used for the close icon.
@property(nonatomic, class, readonly) UIImage* closeIcon;
// Returns the accessibility used for the close button icon.
@property(nonatomic, class, readonly) NSString* closeIconAccessibilityLabel;
#pragma mark Swizzling
......
......@@ -41,8 +41,8 @@ using scanner::CameraState;
return mainController.interfaceProvider.mainInterface.viewController;
}
+ (UIImage*)closeIcon {
return [ChromeIcon closeIcon];
+ (NSString*)closeIconAccessibilityLabel {
return [ChromeIcon closeIcon].accessibilityLabel;
}
#pragma mark Swizzling
......
......@@ -91,7 +91,7 @@ id<GREYMatcher> VisibleInteractableEnabled() {
// Returns the GREYMatcher for the button that closes the QR Scanner.
id<GREYMatcher> QrScannerCloseButton() {
return chrome_test_util::ButtonWithAccessibilityLabel(
[QRScannerAppInterface.closeIcon accessibilityLabel]);
QRScannerAppInterface.closeIconAccessibilityLabel);
}
// Returns the GREYMatcher for the button which indicates that torch is off and
......@@ -571,11 +571,6 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
// the camera state changes after the QRScannerViewController is presented.
// TODO(crbug.com/1019211): Re-enable test on iOS12.
- (void)testDialogIsDisplayedIfCameraStateChanges {
#if defined(CHROME_EARL_GREY_2)
if (!base::ios::IsRunningOnIOS13OrLater()) {
EARL_GREY_TEST_SKIPPED(@"Test fails on iOS 12 under EG2.");
}
#endif
id cameraControllerMock =
[QRScannerAppInterface cameraControllerMockWithAuthorizationStatus:
AVAuthorizationStatusAuthorized];
......@@ -610,11 +605,6 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
// Tests that a new dialog replaces an old dialog if the camera state changes.
// TODO(crbug.com/1019211): Re-enable test on iOS12.
- (void)testDialogIsReplacedIfCameraStateChanges {
#if defined(CHROME_EARL_GREY_2)
if (!base::ios::IsRunningOnIOS13OrLater()) {
EARL_GREY_TEST_SKIPPED(@"Test fails on iOS 12 under EG2.");
}
#endif
id cameraControllerMock =
[QRScannerAppInterface cameraControllerMockWithAuthorizationStatus:
AVAuthorizationStatusAuthorized];
......@@ -655,11 +645,6 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
// Tests that an error dialog is dismissed if the camera becomes available.
// TODO(crbug.com/1019211): Re-enable test on iOS12.
- (void)testDialogDismissedIfCameraBecomesAvailable {
#if defined(CHROME_EARL_GREY_2)
if (!base::ios::IsRunningOnIOS13OrLater()) {
EARL_GREY_TEST_SKIPPED(@"Test fails iOS 12.2");
}
#endif // defined(CHROME_EARL_GREY_2)
id cameraControllerMock =
[QRScannerAppInterface cameraControllerMockWithAuthorizationStatus:
AVAuthorizationStatusAuthorized];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment