| Index: ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
|
| diff --git a/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm b/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
|
| index 2c7e0f421ca727a8ee935042249deaf85a96733b..3e58bb7d9b84094b92d448203f1679e82c076d67 100644
|
| --- a/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
|
| +++ b/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm
|
| @@ -313,6 +313,11 @@ - (void)tearDown {
|
| chrome_test_util::ButtonWithAccessibilityLabelId(IDS_OK);
|
| [[EarlGrey selectElementWithMatcher:OKButton] performAction:grey_tap()
|
| error:&errorOK];
|
| + // Reenable synchronization in case it was disabled by a test. See comments
|
| + // in testShowJavaScriptAfterNewTabAnimation for details.
|
| + [[GREYConfiguration sharedInstance]
|
| + setValue:@(YES)
|
| + forConfigKey:kGREYConfigKeySynchronizationEnabled];
|
|
|
| if (!errorOK || !errorCancel) {
|
| GREYFail(@"There are still alerts");
|
| @@ -555,11 +560,6 @@ - (void)testShowJavaScriptAfterNewTabAnimation {
|
| @"correctly.");
|
| #endif
|
|
|
| - // TODO(crbug.com/711291): reenable this on tablets.
|
| - if (IsIPadIdiom()) {
|
| - EARL_GREY_TEST_DISABLED(@"Disabled for iPad.");
|
| - }
|
| -
|
| // Load the test page with a link to kOnLoadAlertURL and long tap on the link.
|
| [self loadPageWithLink];
|
| id<GREYMatcher> webViewMatcher =
|
| @@ -573,6 +573,20 @@ - (void)testShowJavaScriptAfterNewTabAnimation {
|
| l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB));
|
| [[EarlGrey selectElementWithMatcher:newTabMatcher] performAction:grey_tap()];
|
|
|
| + // This test case requires that a dialog is presented in the onload event so
|
| + // that the DialogPresenter attempts to display during a new tab animation.
|
| + // Because presenting a dialog halts the JavaScript execution on the page,
|
| + // this prevents the page loaded event from being received until the alert is
|
| + // closed. On iPad, this means that there is a loading indicator that
|
| + // continues to animate until the dialog is closed. Disabling EarlGrey
|
| + // synchronization code for iPad allows the test to detect and dismiss the
|
| + // dialog while this animation is occurring.
|
| + if (IsIPadIdiom()) {
|
| + [[GREYConfiguration sharedInstance]
|
| + setValue:@(NO)
|
| + forConfigKey:kGREYConfigKeySynchronizationEnabled];
|
| + }
|
| +
|
| // Wait for the alert to be shown.
|
| NSString* alertLabel = [DialogPresenter
|
| localizedTitleForJavaScriptAlertFromPage:HttpServer::MakeUrl(
|
| @@ -587,6 +601,13 @@ - (void)testShowJavaScriptAfterNewTabAnimation {
|
|
|
| // Close the alert.
|
| TapOK();
|
| +
|
| + // Reenable synchronization on iPads now that the dialog has been dismissed.
|
| + if (IsIPadIdiom()) {
|
| + [[GREYConfiguration sharedInstance]
|
| + setValue:@(YES)
|
| + forConfigKey:kGREYConfigKeySynchronizationEnabled];
|
| + }
|
| }
|
|
|
| @end
|
|
|