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

Unified Diff: ios/chrome/browser/web/cache_egtest.mm

Issue 2798773002: Create ChromeEarlGrey waitForWebViewContainingText. (Closed)
Patch Set: better formatting Created 3 years, 8 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/web/cache_egtest.mm
diff --git a/ios/chrome/browser/web/cache_egtest.mm b/ios/chrome/browser/web/cache_egtest.mm
index 9704f1575058de099733f1476c31ee2132b8d091..dddce3b81fb9f269d6551f14d421edf217e9dbda 100644
--- a/ios/chrome/browser/web/cache_egtest.mm
+++ b/ios/chrome/browser/web/cache_egtest.mm
@@ -26,7 +26,6 @@
#include "ios/web/public/test/response_providers/html_response_provider.h"
#include "url/gurl.h"
-using chrome_test_util::WebViewContainingText;
using web::test::HttpServer;
namespace {
@@ -185,34 +184,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
@@ -227,17 +216,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.
@@ -245,11 +229,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
@@ -265,11 +246,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()]
@@ -279,11 +257,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

Powered by Google App Engine
This is Rietveld 408576698