Commit dd6717ff authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Re-enable flaky navigation restore egtests.

Both testRestoreHistory tests were emulating a background/kill/restore
by simply disabling/enabling web usage.  Doing a tabgrid close all /
undo is more similar.

Upon EG2 migration, this method can be removed, and the test can do
a proper background/kill/restore.

Bug: 1011791
Change-Id: I1f3074917747551833ef090e2da598674476de77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1846072
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703475}
parent 48705d75
...@@ -559,15 +559,14 @@ std::unique_ptr<net::test_server::HttpResponse> WindowLocationHashHandlers( ...@@ -559,15 +559,14 @@ std::unique_ptr<net::test_server::HttpResponse> WindowLocationHashHandlers(
// Tests that navigating forward from a WebUI URL works when resuming from // Tests that navigating forward from a WebUI URL works when resuming from
// session restore. This is a regression test for https://crbug.com/814790. // session restore. This is a regression test for https://crbug.com/814790.
// TODO(crbug.com/1011791): Test disabled. - (void)testRestoreHistoryToWebUIAndNavigateForward {
- (void)DISABLED_testRestoreHistoryToWebUIAndNavigateForward {
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start."); GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL destinationURL = self.testServer->GetURL(kSimpleFileBasedTestURL); const GURL destinationURL = self.testServer->GetURL(kSimpleFileBasedTestURL);
[ChromeEarlGrey loadURL:GURL("chrome://version")]; [ChromeEarlGrey loadURL:GURL("chrome://version")];
[ChromeEarlGrey loadURL:destinationURL]; [ChromeEarlGrey loadURL:destinationURL];
[ChromeEarlGrey goBack]; [ChromeEarlGrey goBack];
[ChromeEarlGrey purgeCachedWebViewPages]; [ChromeEarlGrey triggerRestoreViaTabGridRemoveAllUndo];
[ChromeEarlGrey waitForWebStateContainingText:"Revision"]; [ChromeEarlGrey waitForWebStateContainingText:"Revision"];
[[EarlGrey selectElementWithMatcher:OmniboxText("chrome://version")] [[EarlGrey selectElementWithMatcher:OmniboxText("chrome://version")]
...@@ -580,14 +579,13 @@ std::unique_ptr<net::test_server::HttpResponse> WindowLocationHashHandlers( ...@@ -580,14 +579,13 @@ std::unique_ptr<net::test_server::HttpResponse> WindowLocationHashHandlers(
// Tests that navigating forward from NTP works when resuming from session // Tests that navigating forward from NTP works when resuming from session
// restore. This is a regression test for https://crbug.com/814790. // restore. This is a regression test for https://crbug.com/814790.
// TODO(crbug.com/1011791): Test disabled. - (void)testRestoreHistoryToNTPAndNavigateForward {
- (void)DISABLED_testRestoreHistoryToNTPAndNavigateForward {
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start."); GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL destinationURL = self.testServer->GetURL(kSimpleFileBasedTestURL); const GURL destinationURL = self.testServer->GetURL(kSimpleFileBasedTestURL);
[ChromeEarlGrey loadURL:destinationURL]; [ChromeEarlGrey loadURL:destinationURL];
[ChromeEarlGrey goBack]; [ChromeEarlGrey goBack];
[ChromeEarlGrey purgeCachedWebViewPages]; [ChromeEarlGrey triggerRestoreViaTabGridRemoveAllUndo];
[ChromeEarlGrey goForward]; [ChromeEarlGrey goForward];
[ChromeEarlGrey waitForWebStateContainingText:"pony"]; [ChromeEarlGrey waitForWebStateContainingText:"pony"];
......
...@@ -312,6 +312,10 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error); ...@@ -312,6 +312,10 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// Cache-Control response header says otherwise. // Cache-Control response header says otherwise.
- (void)purgeCachedWebViewPages; - (void)purgeCachedWebViewPages;
// Simulators background, killing, and restoring the app within the limitations
// of EG1, by simply doing a tab grid close all / undo / done.
- (void)triggerRestoreViaTabGridRemoveAllUndo;
#pragma mark - Bookmarks Utilities (EG2) #pragma mark - Bookmarks Utilities (EG2)
// Waits for the bookmark internal state to be done loading. // Waits for the bookmark internal state to be done loading.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/testing/earl_grey/earl_grey_test.h" #import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/testing/nserror_util.h" #import "ios/testing/nserror_util.h"
#include "ios/web/public/test/element_selector.h" #include "ios/web/public/test/element_selector.h"
...@@ -409,6 +410,20 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface) ...@@ -409,6 +410,20 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
[self waitForPageToFinishLoading]; [self waitForPageToFinishLoading];
} }
- (void)triggerRestoreViaTabGridRemoveAllUndo {
[[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCloseAllButton()]
performAction:grey_tap()];
[[EarlGrey
selectElementWithMatcher:chrome_test_util::TabGridUndoCloseAllButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridDoneButton()]
performAction:grey_tap()];
[self waitForRestoreSessionToFinish];
[self waitForPageToFinishLoading];
}
#pragma mark - Settings Utilities (EG2) #pragma mark - Settings Utilities (EG2)
- (void)setContentSettings:(ContentSetting)setting { - (void)setContentSettings:(ContentSetting)setting {
......
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