Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_egtest.mm

Issue 2784943002: Remove matcher to wait for static HTML view. (Closed)
Patch Set: typo Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 18a3241c19e9a10a746c9b42e8750b7fb421fa67..78e5100e83176dea706d27e412b97763e9a69df2 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm
@@ -293,24 +293,26 @@ std::map<GURL, std::string> ResponsesForDistillationServer() {
// Tests that the correct version of kDistillableURL is displayed.
void AssertIsShowingDistillablePage(bool online) {
- // There will be multiple reload. Wait.
- id<GREYMatcher> web_view_match = nil;
+ 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.");
} else {
- web_view_match = chrome_test_util::StaticHtmlViewContainingText(
- base::SysUTF8ToNSString(kContentToKeep));
+ [ChromeEarlGrey waitForStaticHTMLViewContainingText:contentToKeep];
}
- 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.");
// Test Omnibox URL
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
@@ -322,11 +324,12 @@ void AssertIsShowingDistillablePage(bool online) {
kContentToKeep)]
assertWithMatcher:online ? grey_notNil() : grey_nil()];
- // Test presence of offline page
- [[EarlGrey
- selectElementWithMatcher:chrome_test_util::StaticHtmlViewContainingText(
- base::SysUTF8ToNSString(kContentToKeep))]
- assertWithMatcher:online ? grey_nil() : grey_notNil()];
+ // Test presence of offline page.
+ if (online) {
+ [ChromeEarlGrey waitForStaticHTMLViewNotContainingText:contentToKeep];
+ } else {
+ [ChromeEarlGrey waitForStaticHTMLViewContainingText:contentToKeep];
+ }
// Test the presence of the omnibox offline chip.
[[EarlGrey

Powered by Google App Engine
This is Rietveld 408576698