Commit 965143d8 authored by Maksym Onufriienko's avatar Maksym Onufriienko Committed by Commit Bot

Convert closeCurrentTab navigator helper to compile under EG2.

Added closeCurrentTab in smoke_egtest.

Bug: 922813
Change-Id: I79f5066d068f38b97af4527b6c2b1562bd2a3a7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625849
Commit-Queue: Maksym Onufriienko <monufriienko@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662825}
parent 93b01331
...@@ -107,6 +107,9 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error); ...@@ -107,6 +107,9 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// CHROME_EG_ASSERT_NO_ERROR is removed. // CHROME_EG_ASSERT_NO_ERROR is removed.
- (NSError*)waitForPageToFinishLoading; - (NSError*)waitForPageToFinishLoading;
// Closes the current tab and waits for the UI to complete.
- (void)closeCurrentTab;
@end @end
// Helpers that only compile under EarlGrey 1 are included in this "EG1" // Helpers that only compile under EarlGrey 1 are included in this "EG1"
...@@ -127,9 +130,6 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error); ...@@ -127,9 +130,6 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// Checks whether current WebState is loading. // Checks whether current WebState is loading.
- (BOOL)isLoading WARN_UNUSED_RESULT; - (BOOL)isLoading WARN_UNUSED_RESULT;
// Closes the current tab and waits for the UI to complete.
- (void)closeCurrentTab;
// Waits for a static html view containing |text|. If the condition is not met // Waits for a static html view containing |text|. If the condition is not met
// within a timeout, a GREYAssert is induced. // within a timeout, a GREYAssert is induced.
// TODO(crbug.com/963613): Change return type to void when // TODO(crbug.com/963613): Change return type to void when
......
...@@ -77,14 +77,14 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface) ...@@ -77,14 +77,14 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
return nil; return nil;
} }
- (NSError*)reload { - (NSError*)goForward {
[ChromeEarlGreyAppInterface startReloading]; [ChromeEarlGreyAppInterface startGoingForward];
[self waitForPageToFinishLoading]; [self waitForPageToFinishLoading];
return nil; return nil;
} }
- (NSError*)goForward { - (NSError*)reload {
[ChromeEarlGreyAppInterface startGoingForward]; [ChromeEarlGreyAppInterface startReloading];
[self waitForPageToFinishLoading]; [self waitForPageToFinishLoading];
return nil; return nil;
} }
...@@ -149,6 +149,11 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface) ...@@ -149,6 +149,11 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
return [self loadURL:URL waitForCompletion:YES]; return [self loadURL:URL waitForCompletion:YES];
} }
- (void)closeCurrentTab {
[ChromeEarlGreyAppInterface closeCurrentTab];
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
}
@end @end
// The helpers below only compile under EarlGrey1. // The helpers below only compile under EarlGrey1.
...@@ -220,11 +225,6 @@ id ExecuteJavaScript(NSString* javascript, ...@@ -220,11 +225,6 @@ id ExecuteJavaScript(NSString* javascript,
return chrome_test_util::IsLoading(); return chrome_test_util::IsLoading();
} }
- (void)closeCurrentTab {
chrome_test_util::CloseCurrentTab();
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
}
- (NSError*)waitForErrorPage { - (NSError*)waitForErrorPage {
NSString* const kErrorPageText = NSString* const kErrorPageText =
l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE);
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
// Navigates forward to the next page without waiting for the page to load. // Navigates forward to the next page without waiting for the page to load.
+ (void)startGoingForward; + (void)startGoingForward;
// Closes current tab.
+ (void)closeCurrentTab;
@end @end
#endif // IOS_CHROME_TEST_EARL_GREY_CHROME_EARL_GREY_APP_INTERFACE_H_ #endif // IOS_CHROME_TEST_EARL_GREY_CHROME_EARL_GREY_APP_INTERFACE_H_
...@@ -75,4 +75,8 @@ using chrome_test_util::BrowserCommandDispatcherForMainBVC; ...@@ -75,4 +75,8 @@ using chrome_test_util::BrowserCommandDispatcherForMainBVC;
[BrowserCommandDispatcherForMainBVC() goForward]; [BrowserCommandDispatcherForMainBVC() goForward];
} }
+ (void)closeCurrentTab {
chrome_test_util::CloseCurrentTab();
}
@end @end
...@@ -125,6 +125,8 @@ ...@@ -125,6 +125,8 @@
[ChromeEarlGrey closeAllTabsInCurrentMode]; [ChromeEarlGrey closeAllTabsInCurrentMode];
[ChromeEarlGrey closeAllIncognitoTabs]; [ChromeEarlGrey closeAllIncognitoTabs];
[ChromeEarlGrey openNewTab]; [ChromeEarlGrey openNewTab];
[ChromeEarlGrey closeCurrentTab];
[ChromeEarlGrey openNewTab];
} }
@end @end
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