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

Unified Diff: ios/chrome/browser/web/browsing_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/browsing_egtest.mm
diff --git a/ios/chrome/browser/web/browsing_egtest.mm b/ios/chrome/browser/web/browsing_egtest.mm
index 7e4817ae7cae33af8f2478d3a2e2150a435735ab..0b535f9d69ddf9ac9cdc5acdcff4337c4908c3c4 100644
--- a/ios/chrome/browser/web/browsing_egtest.mm
+++ b/ios/chrome/browser/web/browsing_egtest.mm
@@ -36,7 +36,6 @@
#include "url/gurl.h"
using chrome_test_util::OmniboxText;
-using chrome_test_util::WebViewContainingText;
namespace {
@@ -142,18 +141,15 @@ id<GREYMatcher> GoButtonMatcher() {
GURL URL = ReloadResponseProvider::GetReloadTestUrl();
[ChromeEarlGrey loadURL:URL];
- std::string expectedBodyBeforeReload(
+
+ NSString* expectedBodyBeforeReload = base::SysUTF8ToNSString(
ReloadResponseProvider::GetResponseBody(0 /* request number */));
- [[EarlGrey
- selectElementWithMatcher:WebViewContainingText(expectedBodyBeforeReload)]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:expectedBodyBeforeReload];
[ChromeEarlGreyUI reload];
- std::string expectedBodyAfterReload(
+ NSString* expectedBodyAfterReload = base::SysUTF8ToNSString(
ReloadResponseProvider::GetResponseBody(1 /* request_number */));
- [[EarlGrey
- selectElementWithMatcher:WebViewContainingText(expectedBodyAfterReload)]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:expectedBodyAfterReload];
}
// Tests that a tab's title is based on the URL when no other information is
@@ -430,8 +426,7 @@ id<GREYMatcher> GoButtonMatcher() {
// onclick event.
[[EarlGrey selectElementWithMatcher:OmniboxText("chrome://version")]
assertWithMatcher:grey_nil()];
- [[EarlGrey selectElementWithMatcher:WebViewContainingText("Hello world!")]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"Hello world!"];
// Verify that no new tabs were open which could load chrome://version.
chrome_test_util::AssertMainTabCount(1U);
@@ -537,8 +532,7 @@ id<GREYMatcher> GoButtonMatcher() {
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")]
performAction:grey_tap()];
- id<GREYMatcher> webView = chrome_test_util::WebViewContainingText("foo");
- [[EarlGrey selectElementWithMatcher:webView] assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"foo"];
// Verify that the JavaScript did not affect history by going back and then
// forward again.
@@ -625,21 +619,18 @@ id<GREYMatcher> GoButtonMatcher() {
// Open the URL, focus the textfield,and submit via keyboard.
[ChromeEarlGrey loadURL:URL];
- [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"hello!"];
[self submitFormUsingKeyboardGoButtonWithInputID:"textfield"];
// Verify that the browser navigates to the expected URL.
- [[EarlGrey selectElementWithMatcher:WebViewContainingText("baz!")]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"baz!"];
[[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())]
assertWithMatcher:grey_notNil()];
// Go back and verify that the browser navigates to the original URL.
[self goBack];
- [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"hello!"];
[[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
assertWithMatcher:grey_notNil()];
}

Powered by Google App Engine
This is Rietveld 408576698