Chromium Code Reviews| 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..ec3c55a4f50221e5e05eefd5c8cefdd479c6bbbe 100644 |
| --- a/ios/chrome/browser/ui/fullscreen_egtest.mm |
| +++ b/ios/chrome/browser/ui/fullscreen_egtest.mm |
| @@ -17,9 +17,9 @@ |
| #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" |
| #import "ios/testing/wait_util.h" |
| #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| #import "ios/web/public/test/http_server.h" |
| @@ -104,7 +104,8 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| "http://ios/testing/data/http_server_files/two_pages.pdf"); |
| [ChromeEarlGrey loadURL:URL]; |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| // Initial y scroll position is -56 on iPhone and -95 on iPad, to make room |
| // for the toolbar. |
| // TODO(crbug.com/618887) Replace use of specific values when API which |
| @@ -129,11 +130,14 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| selectElementWithMatcher:WebViewScrollView( |
| chrome_test_util::GetCurrentWebState())] |
| performAction:grey_swipeFastInDirection(kGREYDirectionDown)]; |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| // Test that the toolbar is no longer visible after a user swipes up. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
|
Eugene But (OOO till 7-30)
2017/03/14 22:37:47
Extra semicolon. Same comment for many other place
baxley
2017/03/14 23:16:33
Done.
|
| } |
| // Verifies that the toolbar properly appears/disappears when scrolling up/down |
| @@ -146,18 +150,23 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Test that the toolbar is hidden after a user swipes up. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Test that the toolbar is visible after a user swipes down. |
| [[EarlGrey |
| selectElementWithMatcher:WebViewScrollView( |
| chrome_test_util::GetCurrentWebState())] |
| performAction:grey_swipeFastInDirection(kGREYDirectionDown)]; |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| // Test that the toolbar is hidden after a user swipes up. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| } |
| // Tests that link clicks from a chrome:// to chrome:// link result in the |
| @@ -202,12 +211,15 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Scroll to hide the UI. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Test that the toolbar is visible when moving from one chrome:// link to |
| // another chrome:// link. |
| chrome_test_util::TapWebViewElementWithId("version"); |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Tests hiding and showing of the header with a user scroll on a long page. |
| @@ -220,16 +232,20 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| web::test::SetUpSimpleHttpServer(responses); |
| [ChromeEarlGrey loadURL:URL]; |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| // Simulate a user scroll down. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Simulate a user scroll up. |
| [[EarlGrey |
| selectElementWithMatcher:WebViewScrollView( |
| chrome_test_util::GetCurrentWebState())] |
| performAction:grey_swipeFastInDirection(kGREYDirectionDown)]; |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Tests that reloading of a page shows the header even if it was not shown |
| @@ -249,12 +265,15 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Hide the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| chrome_test_util::TapWebViewElementWithId("link"); |
| // Main test is here: Make sure the header is still visible! |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Test to make sure the header is shown when a Tab opened by the current Tab is |
| @@ -290,7 +309,9 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Hide the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Open new window. |
| chrome_test_util::TapWebViewElementWithId("link1"); |
| @@ -303,7 +324,9 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Hide the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Close the tab. |
| chrome_test_util::TapWebViewElementWithId("link2"); |
| @@ -311,7 +334,8 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Make sure the toolbar is on the screen. |
| chrome_test_util::AssertMainTabCount(1); |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Tests that the header is shown when a regular page (non-native page) is |
| @@ -341,24 +365,30 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| AssertStringIsPresentOnPage("link1"); |
| // Dismiss the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Navigate to the other page. |
| chrome_test_util::TapWebViewElementWithId("link1"); |
| AssertStringIsPresentOnPage("link2"); |
| // Make sure toolbar is shown since a new load has started. |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| // Dismiss the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Go back. |
| chrome_test_util::TapWebViewElementWithId("link2"); |
| // Make sure the toolbar has loaded now that a new page has loaded. |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Tests that the header is shown when a native page is loaded from a page where |
| @@ -379,13 +409,16 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| // Dismiss the toolbar. |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| // Go back to NTP, which is a native view. |
| chrome_test_util::TapWebViewElementWithId("link"); |
| // Make sure the toolbar is visible now that a new page has loaded. |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| // Tests that the header is shown when loading an error page in a native view |
| @@ -405,11 +438,14 @@ void AssertStringIsPresentOnPage(const std::string& text) { |
| [ChromeEarlGrey loadURL:URL]; |
| HideToolbarUsingUI(); |
| - chrome_test_util::AssertToolbarNotVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:NO], |
| + @"Toolbar was visible"); |
| + ; |
| chrome_test_util::TapWebViewElementWithId("link"); |
| AssertURLIs(ErrorPageResponseProvider::GetDnsFailureUrl()); |
| - chrome_test_util::AssertToolbarVisible(); |
| + GREYAssertTrue([ChromeEarlGreyUI waitForToolbarVisible:YES], |
| + @"Toolbar was not visible"); |
| } |
| @end |