Chromium Code Reviews| Index: ios/chrome/browser/ui/reading_list/reading_list_egtest.mm | 
| diff --git a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm | 
| index 135d8c445aeec3d7a9d0dc7200d6ad4efcc96676..7def2c1696661f7ec0569c991fd251b25e380a15 100644 | 
| --- a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm | 
| +++ b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm | 
| @@ -35,6 +35,7 @@ | 
| #import "ios/web/public/test/http_server/html_response_provider.h" | 
| #import "ios/web/public/test/http_server/http_server.h" | 
| #include "ios/web/public/test/http_server/http_server_util.h" | 
| +#import "ios/web/public/test/web_view_content_test_util.h" | 
| #include "net/base/network_change_notifier.h" | 
| #if !defined(__has_feature) || !__has_feature(objc_arc) | 
| @@ -317,20 +318,14 @@ void AssertIsShowingDistillablePage(bool online) { | 
| NSString* contentToKeep = base::SysUTF8ToNSString(kContentToKeep); | 
| // There will be multiple reloads, wait for the page to be displayed. | 
| if (online) { | 
| - // TODO(crbug.com/707009): Remove use of WebViewContainingText, with a | 
| - // method that is not an EarlGrey matcher. | 
| - id<GREYMatcher> web_view_match = nil; | 
| - web_view_match = chrome_test_util::WebViewContainingText(kContentToKeep); | 
| - ConditionBlock wait_for_loading = ^{ | 
| - NSError* error = nil; | 
| - [[EarlGrey selectElementWithMatcher:web_view_match] | 
| - assertWithMatcher:grey_notNil() | 
| - error:&error]; | 
| - return error == nil; | 
| - }; | 
| - GREYAssert(testing::WaitUntilConditionOrTimeout(kLoadOfflineTimeout, | 
| - wait_for_loading), | 
| - @"Page did not load."); | 
| + GREYAssert(testing::WaitUntilConditionOrTimeout( | 
| 
 
Eugene But (OOO till 7-30)
2017/06/12 03:47:11
Do you want to explain in the comments why waitFor
 
baxley
2017/06/12 16:41:17
Done.
 
 | 
| + kLoadOfflineTimeout, | 
| + ^bool { | 
| + return web::test::WebViewContainingText( | 
| + chrome_test_util::GetCurrentWebState(), | 
| + kContentToKeep); | 
| + }), | 
| + @"Waiting for online page."); | 
| } else { | 
| [ChromeEarlGrey waitForStaticHTMLViewContainingText:contentToKeep]; | 
| } | 
| @@ -341,15 +336,16 @@ void AssertIsShowingDistillablePage(bool online) { | 
| distillableURL.GetContent())] | 
| assertWithMatcher:grey_notNil()]; | 
| - // Test presence of online page | 
| - [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( | 
| - kContentToKeep)] | 
| - assertWithMatcher:online ? grey_notNil() : grey_nil()]; | 
| - | 
| - // Test presence of offline page. | 
| + // Test that the offline and online pages are properly displayed. | 
| if (online) { | 
| + [ChromeEarlGrey | 
| + waitForWebViewContainingText:base::SysNSStringToUTF8(contentToKeep)]; | 
| [ChromeEarlGrey waitForStaticHTMLViewNotContainingText:contentToKeep]; | 
| } else { | 
| + // TODO(crbug.com/714157): Remove matcher that asserts grey_nil(). | 
| + [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( | 
| + kContentToKeep)] | 
| + assertWithMatcher:grey_nil()]; | 
| [ChromeEarlGrey waitForStaticHTMLViewContainingText:contentToKeep]; | 
| } |