| Index: ios/chrome/browser/web/cache_egtest.mm
 | 
| diff --git a/ios/chrome/browser/web/cache_egtest.mm b/ios/chrome/browser/web/cache_egtest.mm
 | 
| index e168797c2fdc76d8f1ceaa181908fe05a1ab04a3..69e1eaa93e96c9cdc20cd84756024b53ce2940ef 100644
 | 
| --- a/ios/chrome/browser/web/cache_egtest.mm
 | 
| +++ b/ios/chrome/browser/web/cache_egtest.mm
 | 
| @@ -188,34 +188,24 @@ class ScopedBlockPopupsPref {
 | 
|  
 | 
|    // 1st hit to server. Verify that the server has the correct hit count.
 | 
|    [ChromeEarlGrey loadURL:cacheTestFirstPageURL];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 1")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 1"];
 | 
|  
 | 
|    // Navigate to another page. 2nd hit to server.
 | 
|    chrome_test_util::TapWebViewElementWithId(kCacheTestLinkID);
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 2")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"];
 | 
|  
 | 
|    // Navigate back. This should not hit the server. Verify the page has been
 | 
|    // loaded from cache. The serverHitCounter will remain the same.
 | 
|    [self goBack];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 1")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 1"];
 | 
|  
 | 
|    // Reload page. 3rd hit to server. Verify that page reload causes the
 | 
|    // hitCounter to show updated value.
 | 
|    [self reloadPage];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 3")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 3"];
 | 
|  
 | 
|    // Verify that page reload causes Cache-Control value to be sent with request.
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("cacheControl: max-age=0")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"cacheControl: max-age=0"];
 | 
|  }
 | 
|  
 | 
|  // Tests caching behavior when opening new tab. New tab should not use the
 | 
| @@ -230,17 +220,12 @@ class ScopedBlockPopupsPref {
 | 
|  
 | 
|    // 1st hit to server. Verify title and hitCount.
 | 
|    [ChromeEarlGrey loadURL:cacheTestFirstPageURL];
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText("First Page")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 1")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"First Page"];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 1"];
 | 
|  
 | 
|    // 2nd hit to server. Verify hitCount.
 | 
|    [ChromeEarlGrey loadURL:cacheTestThirdPageURL];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 2")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"];
 | 
|  
 | 
|    // Open the first page in a new tab. Verify that cache was not used. Must
 | 
|    // first allow popups.
 | 
| @@ -248,11 +233,8 @@ class ScopedBlockPopupsPref {
 | 
|    chrome_test_util::TapWebViewElementWithId(kCacheTestLinkID);
 | 
|    chrome_test_util::AssertMainTabCount(2);
 | 
|    [ChromeEarlGrey waitForPageToFinishLoading];
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText("First Page")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 3")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"First Page"];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 3"];
 | 
|  }
 | 
|  
 | 
|  // Tests that cache is not used when selecting omnibox suggested website, even
 | 
| @@ -268,11 +250,8 @@ class ScopedBlockPopupsPref {
 | 
|  
 | 
|    // 1st hit to server. Verify title and hitCount.
 | 
|    [ChromeEarlGrey loadURL:cacheTestFirstPageURL];
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText("First Page")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 1")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"First Page"];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 1"];
 | 
|  
 | 
|    // Type a search into omnnibox and select the first suggestion (second row)
 | 
|    [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
 | 
| @@ -282,11 +261,8 @@ class ScopedBlockPopupsPref {
 | 
|        performAction:grey_tap()];
 | 
|  
 | 
|    // Verify title and hitCount. Cache should not be used.
 | 
| -  [[EarlGrey selectElementWithMatcher:WebViewContainingText("First Page")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| -  [[EarlGrey
 | 
| -      selectElementWithMatcher:WebViewContainingText("serverHitCounter: 2")]
 | 
| -      assertWithMatcher:grey_notNil()];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"First Page"];
 | 
| +  [ChromeEarlGrey waitForWebViewContainingText:"serverHitCounter: 2"];
 | 
|  }
 | 
|  
 | 
|  @end
 | 
| 
 |