| Index: ios/chrome/browser/web/child_window_open_by_dom_egtest.mm
 | 
| diff --git a/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm b/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm
 | 
| index c6e330beb43242f5bbbd67bf77d8686605e6dc8b..dbe61de178309d342b5579cc8da69012a303d3a0 100644
 | 
| --- a/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm
 | 
| +++ b/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm
 | 
| @@ -22,7 +22,6 @@
 | 
|  
 | 
|  using chrome_test_util::AssertMainTabCount;
 | 
|  using chrome_test_util::TapWebViewElementWithId;
 | 
| -using chrome_test_util::WebViewContainingText;
 | 
|  using web::test::HttpServer;
 | 
|  
 | 
|  namespace {
 | 
| @@ -62,8 +61,7 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|    const char kChildWindowTestURL[] =
 | 
|        "http://ios/testing/data/http_server_files/window_proxy.html";
 | 
|    [ChromeEarlGrey loadURL:HttpServer::MakeUrl(kChildWindowTestURL)];
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kNamedWindowLink)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kNamedWindowLink];
 | 
|    AssertMainTabCount(1);
 | 
|  }
 | 
|  
 | 
| @@ -82,8 +80,7 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|    // Check that they're the same window.
 | 
|    TapWebViewElementWithId("compareNamedWindows");
 | 
|    const char kWindowsEqualText[] = "named windows equal: true";
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindowsEqualText)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindowsEqualText];
 | 
|  }
 | 
|  
 | 
|  // Tests that multiple calls to window.open() with no window name passed in
 | 
| @@ -101,8 +98,7 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|    // Check that they aren't the same window object.
 | 
|    TapWebViewElementWithId("compareUnnamedWindows");
 | 
|    const char kWindowsEqualText[] = "unnamed windows equal: false";
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindowsEqualText)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindowsEqualText];
 | 
|  }
 | 
|  
 | 
|  // Tests that calling window.open() with a name returns a different window
 | 
| @@ -121,8 +117,7 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|    // Check that they aren't the same window object.
 | 
|    TapWebViewElementWithId("compareNamedAndUnnamedWindows");
 | 
|    const char kWindowsEqualText[] = "named and unnamed equal: false";
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindowsEqualText)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindowsEqualText];
 | 
|  }
 | 
|  
 | 
|  // Tests that window.closed is correctly set to true when the corresponding tab
 | 
| @@ -137,15 +132,12 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|  
 | 
|    // Check that named window 1 is opened and named window 2 isn't.
 | 
|    const char kCheckWindow1Link[] = "checkNamedWindow1Closed";
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kCheckWindow1Link)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kCheckWindow1Link];
 | 
|    TapWebViewElementWithId(kCheckWindow1Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow1Open)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow1Open];
 | 
|    const char kCheckWindow2Link[] = "checkNamedWindow2Closed";
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2NeverOpen)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2NeverOpen];
 | 
|  
 | 
|    // Open another window with the same name. Check that named window 2 is now
 | 
|    // opened.
 | 
| @@ -153,18 +145,15 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|    AssertMainTabCount(2);
 | 
|    chrome_test_util::SelectTabAtIndexInCurrentMode(0);
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2Open)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2Open];
 | 
|  
 | 
|    // Close the opened window. Check that named window 1 and 2 are both closed.
 | 
|    chrome_test_util::CloseTabAtIndex(1);
 | 
|    AssertMainTabCount(1);
 | 
|    TapWebViewElementWithId(kCheckWindow1Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow1Closed)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow1Closed];
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2Closed)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2Closed];
 | 
|  }
 | 
|  
 | 
|  // Tests that closing a tab will set window.closed to true for only
 | 
| @@ -176,39 +165,32 @@ const char kWindow2Closed[] = "window2.closed: true";
 | 
|  
 | 
|    // Check that unnamed window 1 is opened and unnamed window 2 isn't.
 | 
|    const char kCheckWindow1Link[] = "checkUnnamedWindow1Closed";
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kCheckWindow1Link)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kCheckWindow1Link];
 | 
|    TapWebViewElementWithId(kCheckWindow1Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow1Open)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow1Open];
 | 
|    const char kCheckWindow2Link[] = "checkUnnamedWindow2Closed";
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2NeverOpen)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2NeverOpen];
 | 
|  
 | 
|    // Open another unnamed window. Check that unnamed window 2 is now opened.
 | 
|    TapWebViewElementWithId("openWindowNoName");
 | 
|    AssertMainTabCount(3);
 | 
|    chrome_test_util::SelectTabAtIndexInCurrentMode(0);
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2Open)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2Open];
 | 
|  
 | 
|    // Close the first opened window. Check that unnamed window 1 is closed and
 | 
|    // unnamed window 2 is still open.
 | 
|    chrome_test_util::CloseTabAtIndex(1);
 | 
|    TapWebViewElementWithId(kCheckWindow1Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow1Closed)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow1Closed];
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2Open)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2Open];
 | 
|  
 | 
|    // Close the second opened window. Check that unnamed window 2 is closed.
 | 
|    chrome_test_util::CloseTabAtIndex(1);
 | 
|    TapWebViewElementWithId(kCheckWindow2Link);
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText(kWindow2Closed)]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:kWindow2Closed];
 | 
|  }
 | 
|  
 | 
|  @end
 | 
| 
 |