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..d149a721e4e73a1ddd1d70c5c7ea2bbc77092e8c 100644 |
--- a/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm |
+++ b/ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm |
@@ -555,11 +555,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 +568,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]; |
baxley
2017/04/18 23:15:31
Should we also add the call to enable synchronizat
kkhorimoto
2017/04/19 18:40:38
Done.
|
+ } |
+ |
// Wait for the alert to be shown. |
NSString* alertLabel = [DialogPresenter |
localizedTitleForJavaScriptAlertFromPage:HttpServer::MakeUrl( |
@@ -587,6 +596,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 |