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

Unified Diff: ios/chrome/browser/ui/webui/web_ui_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/ui/webui/web_ui_egtest.mm
diff --git a/ios/chrome/browser/ui/webui/web_ui_egtest.mm b/ios/chrome/browser/ui/webui/web_ui_egtest.mm
index 972666dd5e614b9910f88030d4e3713e388f754d..27a148b52bbdf9daec76b9388b710f0e3d38db1b 100644
--- a/ios/chrome/browser/ui/webui/web_ui_egtest.mm
+++ b/ios/chrome/browser/ui/webui/web_ui_egtest.mm
@@ -30,7 +30,6 @@
using chrome_test_util::BackButton;
using chrome_test_util::ForwardButton;
using chrome_test_util::TapWebViewElementWithId;
-using chrome_test_util::WebViewContainingText;
namespace {
@@ -85,15 +84,13 @@ id<GREYMatcher> WaitForOmniboxText(std::string text) {
LoadWebUIUrl(kChromeUIVersionHost);
// Verify that app version is present on the page.
- const std::string version = version_info::GetVersionNumber();
- [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)]
- assertWithMatcher:grey_notNil()];
+ NSString* version = base::SysUTF8ToNSString(version_info::GetVersionNumber());
+ [ChromeEarlGrey waitForWebViewContainingText:version];
// Verify that mobile User Agent string is present on the page.
- const std::string userAgent =
- web::GetWebClient()->GetUserAgent(web::UserAgentType::MOBILE);
- [[EarlGrey selectElementWithMatcher:WebViewContainingText(userAgent)]
- assertWithMatcher:grey_notNil()];
+ NSString* userAgent = base::SysUTF8ToNSString(
+ web::GetWebClient()->GetUserAgent(web::UserAgentType::MOBILE));
+ [ChromeEarlGrey waitForWebViewContainingText:userAgent];
}
// Tests that chrome://physical-web renders and the page title is present.
@@ -104,9 +101,8 @@ id<GREYMatcher> WaitForOmniboxText(std::string text) {
LoadWebUIUrl(kChromeUIPhysicalWebHost);
// Verify that the title string is present on the page.
- std::string pageTitle = l10n_util::GetStringUTF8(IDS_PHYSICAL_WEB_UI_TITLE);
- [[EarlGrey selectElementWithMatcher:WebViewContainingText(pageTitle)]
- assertWithMatcher:grey_notNil()];
+ NSString* pageTitle = l10n_util::GetNSString(IDS_PHYSICAL_WEB_UI_TITLE);
+ [ChromeEarlGrey waitForWebViewContainingText:pageTitle];
}
// Tests that clicking on a link for a native page from chrome://chrome-urls
@@ -135,9 +131,7 @@ id<GREYMatcher> WaitForOmniboxText(std::string text) {
// Verify that the resulting page is chrome://version.
[[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://version")]
assertWithMatcher:grey_sufficientlyVisible()];
- const std::string kAuthorsText = "The Chromium Authors";
- [[EarlGrey selectElementWithMatcher:WebViewContainingText(kAuthorsText)]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"The Chromium Authors"];
// Tap the back button in the toolbar and verify that the resulting page is
// the previously visited page chrome://chrome-urls.
@@ -145,9 +139,7 @@ id<GREYMatcher> WaitForOmniboxText(std::string text) {
[[EarlGrey
selectElementWithMatcher:WaitForOmniboxText("chrome://chrome-urls")]
assertWithMatcher:grey_sufficientlyVisible()];
- const std::string kChromeURLsText = "List of Chrome URLs";
- [[EarlGrey selectElementWithMatcher:WebViewContainingText(kChromeURLsText)]
- assertWithMatcher:grey_notNil()];
+ [ChromeEarlGrey waitForWebViewContainingText:@"List of Chrome URLs"];
}
// Tests that back and forward navigation between chrome URLs functions

Powered by Google App Engine
This is Rietveld 408576698