Commit d5aab4b5 authored by Zhaoyang Li's avatar Zhaoyang Li Committed by Commit Bot

[iOS] Fix creating window AX ID and using it at EG matcher.

Set the accessibility identifier at SceneDelegate when initializing
|_window|, instead of going through |self.sceneState|. Also used
|grey_accessibilityID| for matcher of this ID.

Bug: 1060786
Change-Id: I2b857d68e535087d6daa38c0656c0eff9f0abc01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538138Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828896}
parent e473e2b9
...@@ -44,7 +44,7 @@ NSString* const kOriginDetectedKey = @"OriginDetectedKey"; ...@@ -44,7 +44,7 @@ NSString* const kOriginDetectedKey = @"OriginDetectedKey";
// Assign an a11y identifier for using in EGTest. // Assign an a11y identifier for using in EGTest.
// See comment for [ChromeMatchersAppInterface windowWithNumber:] matcher // See comment for [ChromeMatchersAppInterface windowWithNumber:] matcher
// for context. // for context.
self.sceneState.window.accessibilityIdentifier = _window.accessibilityIdentifier =
[NSString stringWithFormat:@"%ld", UIApplication.sharedApplication [NSString stringWithFormat:@"%ld", UIApplication.sharedApplication
.connectedScenes.count - .connectedScenes.count -
1]; 1];
......
...@@ -130,7 +130,7 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id, ...@@ -130,7 +130,7 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
+ (id<GREYMatcher>)windowWithNumber:(int)windowNumber { + (id<GREYMatcher>)windowWithNumber:(int)windowNumber {
return grey_allOf( return grey_allOf(
grey_accessibilityLabel([NSString stringWithFormat:@"%d", windowNumber]), grey_accessibilityID([NSString stringWithFormat:@"%d", windowNumber]),
grey_kindOfClass([UIWindow class]), nil); grey_kindOfClass([UIWindow class]), nil);
} }
......
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