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

Unified Diff: ios/web/shell/test/navigation_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/web/shell/test/navigation_egtest.mm
diff --git a/ios/web/shell/test/navigation_egtest.mm b/ios/web/shell/test/navigation_egtest.mm
index 1698e4121de59a29ed54fe12eb1d45666e9b6492..ab5d705b9e6ee12620dee842e9423adc14605ad6 100644
--- a/ios/web/shell/test/navigation_egtest.mm
+++ b/ios/web/shell/test/navigation_egtest.mm
@@ -49,40 +49,36 @@
// Create map of canned responses and set up the test HTML server.
std::map<GURL, std::string> responses;
const GURL URL1 = web::test::HttpServer::MakeUrl("http://firstURL");
- std::string response1 = "Test Page 1";
- responses[URL1] = response1;
+ NSString* response1 = @"Test Page 1";
+ responses[URL1] = base::SysNSStringToUTF8(response1);
const GURL URL2 = web::test::HttpServer::MakeUrl("http://secondURL");
- std::string response2 = "Test Page 2";
- responses[URL2] = response2;
+ NSString* response2 = @"Test Page 2";
+ responses[URL2] = base::SysNSStringToUTF8(response2);
web::test::SetUpSimpleHttpServer(responses);
[ShellEarlGrey loadURL:URL1];
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL1.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::WebViewContainingText(response1)]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:response1];
[ShellEarlGrey loadURL:URL2];
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL2.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::WebViewContainingText(response2)]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:response2];
[[EarlGrey selectElementWithMatcher:web::BackButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL1.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::WebViewContainingText(response1)]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:response1];
[[EarlGrey selectElementWithMatcher:web::ForwardButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL2.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey selectElementWithMatcher:web::WebViewContainingText(response2)]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:response2];
}
// Tests back and forward navigation where a fragment link is tapped.
@@ -143,9 +139,7 @@
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey
- selectElementWithMatcher:web::WebViewContainingText("Default prevented!")]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:@"Default prevented!"];
}
// Tests tapping on a link with unsupported URL scheme.
@@ -175,9 +169,7 @@
[[EarlGrey selectElementWithMatcher:web::AddressFieldText(URL.spec())]
assertWithMatcher:grey_notNil()];
- [[EarlGrey
- selectElementWithMatcher:web::WebViewContainingText("No navigation!")]
- assertWithMatcher:grey_notNil()];
+ [ShellEarlGrey waitForWebViewContainingText:@"No navigation!"];
}
@end

Powered by Google App Engine
This is Rietveld 408576698