| Index: ios/chrome/browser/ui/fullscreen_egtest.mm
|
| diff --git a/ios/chrome/browser/ui/fullscreen_egtest.mm b/ios/chrome/browser/ui/fullscreen_egtest.mm
|
| index a1ecf399a2e61a28ccbd850f1c6d80cf0dc17631..cb35ad8f5cd6eb60b8da43de33fa88265340a718 100644
|
| --- a/ios/chrome/browser/ui/fullscreen_egtest.mm
|
| +++ b/ios/chrome/browser/ui/fullscreen_egtest.mm
|
| @@ -17,6 +17,7 @@
|
| #import "ios/chrome/test/app/web_view_interaction_test_util.h"
|
| #include "ios/chrome/test/earl_grey/chrome_assertions.h"
|
| #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
|
| +#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
|
| #import "ios/chrome/test/earl_grey/chrome_matchers.h"
|
| #import "ios/chrome/test/earl_grey/chrome_test_case.h"
|
| #import "ios/chrome/test/earl_grey/chrome_util.h"
|
| @@ -52,14 +53,6 @@ id<GREYMatcher> ContentOffset(CGPoint offset) {
|
| nil);
|
| }
|
|
|
| -// Hides the toolbar by scrolling down.
|
| -void HideToolbarUsingUI() {
|
| - [[EarlGrey
|
| - selectElementWithMatcher:WebViewScrollView(
|
| - chrome_test_util::GetCurrentWebState())]
|
| - performAction:grey_swipeFastInDirection(kGREYDirectionUp)];
|
| -}
|
| -
|
| // Asserts that the current URL is the |expectedURL| one.
|
| void AssertURLIs(const GURL& expectedURL) {
|
| NSString* description = [NSString
|
| @@ -125,14 +118,11 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| [ChromeEarlGrey loadURL:URL];
|
|
|
| // Test that the toolbar is still visible after a user swipes down.
|
| - [[EarlGrey
|
| - selectElementWithMatcher:WebViewScrollView(
|
| - chrome_test_util::GetCurrentWebState())]
|
| - performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
|
| + [ChromeEarlGreyUI swipeDownOnWebView];
|
| chrome_test_util::AssertToolbarVisible();
|
|
|
| // Test that the toolbar is no longer visible after a user swipes up.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
| }
|
|
|
| @@ -145,18 +135,15 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| [ChromeEarlGrey loadURL:URL];
|
|
|
| // Test that the toolbar is hidden after a user swipes up.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Test that the toolbar is visible after a user swipes down.
|
| - [[EarlGrey
|
| - selectElementWithMatcher:WebViewScrollView(
|
| - chrome_test_util::GetCurrentWebState())]
|
| - performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
|
| + [ChromeEarlGreyUI swipeDownOnWebView];
|
| chrome_test_util::AssertToolbarVisible();
|
|
|
| // Test that the toolbar is hidden after a user swipes up.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
| }
|
|
|
| @@ -195,13 +182,10 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| @"JavaScript to hide the toolbar did not complete");
|
|
|
| // Scroll up to be sure the toolbar can be dismissed by scrolling down.
|
| - [[EarlGrey
|
| - selectElementWithMatcher:WebViewScrollView(
|
| - chrome_test_util::GetCurrentWebState())]
|
| - performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
|
| + [ChromeEarlGreyUI swipeDownOnWebView];
|
|
|
| // Scroll to hide the UI.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Test that the toolbar is visible when moving from one chrome:// link to
|
| @@ -222,13 +206,10 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| [ChromeEarlGrey loadURL:URL];
|
| chrome_test_util::AssertToolbarVisible();
|
| // Simulate a user scroll down.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
| // Simulate a user scroll up.
|
| - [[EarlGrey
|
| - selectElementWithMatcher:WebViewScrollView(
|
| - chrome_test_util::GetCurrentWebState())]
|
| - performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
|
| + [ChromeEarlGreyUI swipeDownOnWebView];
|
| chrome_test_util::AssertToolbarVisible();
|
| }
|
|
|
| @@ -248,7 +229,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| AssertStringIsPresentOnPage("Tall page");
|
|
|
| // Hide the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| chrome_test_util::TapWebViewElementWithId("link");
|
| @@ -289,7 +270,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| chrome_test_util::AssertMainTabCount(1);
|
|
|
| // Hide the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Open new window.
|
| @@ -302,7 +283,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| AssertURLIs(destinationURL);
|
|
|
| // Hide the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Close the tab.
|
| @@ -340,7 +321,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
|
|
| AssertStringIsPresentOnPage("link1");
|
| // Dismiss the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Navigate to the other page.
|
| @@ -351,7 +332,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| chrome_test_util::AssertToolbarVisible();
|
|
|
| // Dismiss the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Go back.
|
| @@ -378,7 +359,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| AssertStringIsPresentOnPage("link");
|
|
|
| // Dismiss the toolbar.
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| // Go back to NTP, which is a native view.
|
| @@ -404,7 +385,7 @@ void AssertStringIsPresentOnPage(const std::string& text) {
|
| web::test::SetUpHttpServer(std::move(provider));
|
|
|
| [ChromeEarlGrey loadURL:URL];
|
| - HideToolbarUsingUI();
|
| + [ChromeEarlGreyUI swipeUpOnWebView];
|
| chrome_test_util::AssertToolbarNotVisible();
|
|
|
| chrome_test_util::TapWebViewElementWithId("link");
|
|
|