Commit 72d1b642 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][EG2] Unify EG1 and EG2 checks for keyboard

Add a comon method to our testing class that can be used in EG1 and EG2.

|EarlGrey| has 2 methods to check for the device keyboard, once for
each version. And this check is common in the EG2 migration.

Adding it to the base test class instead of to |EarlGrey| to avoid
creating a 3rd method signature for it. Once EG1 support is removed a
simple search and replace can be used to clean this.

Bug: 1016368
Change-Id: I0922dcbcff4cc349a429e734aa9586d0751a3034
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1873757
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708931}
parent bb98dc9c
......@@ -45,6 +45,11 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
- (void)rotateDeviceToOrientation:(UIDeviceOrientation)deviceOrientation
error:(NSError**)error;
// Returns |YES| if the keyboard is on screen. |error| is only supported if the
// test is running in EG2.
// TODO(crbug.com/1017281): Remove along EG1 support.
- (BOOL)isKeyboardShownWithError:(NSError**)error;
// Returns YES if running on an iPad.
- (BOOL)isIPadIdiom;
......
......@@ -81,6 +81,17 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
#endif
}
- (BOOL)isKeyboardShownWithError:(NSError**)error {
return
#if defined(CHROME_EARL_GREY_1)
[GREYKeyboard isKeyboardShown];
#elif defined(CHROME_EARL_GREY_2)
[EarlGrey isKeyboardShownWithError:error];
#else
#error Neither CHROME_EARL_GREY_1 nor CHROME_EARL_GREY_2 are defined
#endif
}
- (BOOL)isIPadIdiom {
#if defined(CHROME_EARL_GREY_1)
UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
......
......@@ -11,6 +11,7 @@
#if defined(CHROME_EARL_GREY_1)
#import <EarlGrey/EarlGrey.h>
#import <EarlGrey/GREYKeyboard.h>
typedef DescribeToBlock GREYDescribeToBlock;
typedef MatchesBlock GREYMatchesBlock;
......
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