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

Unified Diff: ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 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
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/translate/translate_egtest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
index 62129219c14f32f97bd95213654c59385b05ba2f..5dd2c71dcadd207a0e1cc258c6119a7cebe59e48 100644
--- a/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
+++ b/ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm
@@ -32,6 +32,7 @@
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/wait_util.h"
+#import "ios/web/public/test/earl_grey/web_view_matchers.h"
#import "ios/web/public/test/http_server.h"
#import "ios/web/public/test/http_server_util.h"
#include "ios/web/public/test/response_providers/delayed_response_provider.h"
@@ -86,7 +87,7 @@ void NewMainTabWithURL(const GURL& url, const std::string& word) {
chrome_test_util::OpenNewTab();
[ChromeEarlGrey loadURL:url];
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::webViewContainingText(word)]
+ selectElementWithMatcher:chrome_test_util::WebViewContainingText(word)]
assertWithMatcher:grey_notNil()];
chrome_test_util::AssertMainTabCount(number_of_tabs + 1);
}
@@ -147,7 +148,7 @@ void CloseTabAtIndexAndSync(NSUInteger i) {
// Closes the tabs switcher.
void CloseTabSwitcher() {
- id<GREYMatcher> matcher = chrome_test_util::buttonWithAccessibilityLabelId(
+ id<GREYMatcher> matcher = chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_TAB_STRIP_LEAVE_TAB_SWITCHER);
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
}
@@ -177,20 +178,20 @@ void SwitchToNormalMode() {
CloseTabSwitcher();
} else {
[[EarlGrey selectElementWithMatcher:
- chrome_test_util::buttonWithAccessibilityLabelId(
+ chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_SWITCH_BROWSER_MODE_LEAVE_INCOGNITO)]
performAction:grey_tap()];
}
} else {
[[EarlGrey selectElementWithMatcher:
- chrome_test_util::buttonWithAccessibilityLabelId(
+ chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_TOOLBAR_SHOW_TABS)] performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:
- chrome_test_util::buttonWithAccessibilityLabelId(
+ chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB)]
performAction:grey_swipeSlowInDirection(kGREYDirectionRight)];
[[EarlGrey selectElementWithMatcher:
- chrome_test_util::buttonWithAccessibilityLabelId(
+ chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_TOOLBAR_SHOW_TABS)] performAction:grey_tap()];
}
ConditionBlock condition = ^bool {
@@ -205,13 +206,14 @@ void SwitchToNormalMode() {
void CheckErrorPageIsVisible() {
// The DNS error page is static HTML content, so it isn't part of the webview
// owned by the webstate.
- [[EarlGrey selectElementWithMatcher:chrome_test_util::
- webViewBelongingToWebController()]
+ id<GREYMatcher> webViewMatcher =
+ web::WebViewInWebState(chrome_test_util::GetCurrentWebState());
+ [[EarlGrey selectElementWithMatcher:webViewMatcher]
assertWithMatcher:grey_nil()];
NSString* const kError =
l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE);
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::staticHtmlViewContainingText(
+ selectElementWithMatcher:chrome_test_util::StaticHtmlViewContainingText(
kError)] assertWithMatcher:grey_notNil()];
}
@@ -242,7 +244,7 @@ void OpenSettingsMenuUnsynced() {
// iPhone).
void SelectTabUsingUI(NSString* title) {
if (IsCompact()) {
- WaitAndTap(chrome_test_util::buttonWithAccessibilityLabelId(
+ WaitAndTap(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_TOOLBAR_SHOW_TABS),
@"Tab switcher");
}
@@ -292,7 +294,7 @@ void SelectTabUsingUI(NSString* title) {
// Switch back to the normal tabs. Should be on tab one.
SwitchToNormalMode();
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
@@ -319,7 +321,7 @@ void SelectTabUsingUI(NSString* title) {
for (NSUInteger i = 0; i < numberOfTabs; i++) {
chrome_test_util::OpenNewTab();
[ChromeEarlGrey loadURL:url1];
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
}
@@ -349,7 +351,7 @@ void SelectTabUsingUI(NSString* title) {
}),
@"JavaScript to reload each tab did not finish");
[ChromeEarlGreyUI reload];
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
}
@@ -363,7 +365,7 @@ void SelectTabUsingUI(NSString* title) {
// Switch back to the normal tabs. Should be on tab one.
SwitchToNormalMode();
chrome_test_util::SelectTabAtIndexInCurrentMode(0);
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
@@ -403,13 +405,13 @@ void SelectTabUsingUI(NSString* title) {
// Switch back to the normal tabs.
SwitchToNormalMode();
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL2FirstWord)]
assertWithMatcher:grey_notNil()];
// Select the other one so it also reloads.
chrome_test_util::SelectTabAtIndexInCurrentMode(0);
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
@@ -428,7 +430,7 @@ void SelectTabUsingUI(NSString* title) {
chrome_test_util::SelectTabAtIndexInCurrentMode(1);
chrome_test_util::SelectTabAtIndexInCurrentMode(0);
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
histogramTester.ExpectBucketCount(kSelectedTabHistogramName,
@@ -464,23 +466,23 @@ void SelectTabUsingUI(NSString* title) {
// Switch back to the normal tabs.
SwitchToNormalMode();
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL2FirstWord)]
assertWithMatcher:grey_notNil()];
const GURL url1 = web::test::HttpServer::MakeUrl(kTestUrl1);
const GURL url2 = web::test::HttpServer::MakeUrl(kTestUrl2);
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::omniboxText(url2.GetContent())]
+ selectElementWithMatcher:chrome_test_util::OmniboxText(url2.GetContent())]
assertWithMatcher:grey_notNil()];
histogramTester.ExpectTotalCount(kEvictedTabReloadTime, 1, failureBlock);
chrome_test_util::SelectTabAtIndexInCurrentMode(0);
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::omniboxText(url1.GetContent())]
+ selectElementWithMatcher:chrome_test_util::OmniboxText(url1.GetContent())]
assertWithMatcher:grey_notNil()];
histogramTester.ExpectTotalCount(kEvictedTabReloadTime, 2, failureBlock);
}
@@ -498,7 +500,7 @@ void SelectTabUsingUI(NSString* title) {
NewMainTabWithURL(URL, kURL1FirstWord);
OpenNewIncognitoTabUsingUIAndEvictMainTabs();
SwitchToNormalMode();
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
kURL1FirstWord)]
assertWithMatcher:grey_notNil()];
@@ -653,7 +655,7 @@ void SelectTabUsingUI(NSString* title) {
l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)),
@"Close settings");
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
responses[slowURL])]
assertWithMatcher:grey_notNil()];
@@ -757,7 +759,7 @@ void SelectTabUsingUI(NSString* title) {
NewMainTabWithURL(redirectURL, "arrived");
- [[EarlGrey selectElementWithMatcher:chrome_test_util::omniboxText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(
destinationURL.GetContent())]
assertWithMatcher:grey_notNil()];
@@ -766,7 +768,7 @@ void SelectTabUsingUI(NSString* title) {
OpenNewIncognitoTabUsingUIAndEvictMainTabs();
SwitchToNormalMode();
chrome_test_util::SelectTabAtIndexInCurrentMode(tabIndex);
- [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText(
+ [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText(
"arrived")]
assertWithMatcher:grey_notNil()];
@@ -811,7 +813,7 @@ void SelectTabUsingUI(NSString* title) {
chrome_test_util::TapWebViewElementWithId("link");
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::webViewContainingText("Whee")]
+ selectElementWithMatcher:chrome_test_util::WebViewContainingText("Whee")]
assertWithMatcher:grey_notNil()];
NSUInteger tabIndex = chrome_test_util::GetMainTabCount() - 1;
@@ -820,7 +822,7 @@ void SelectTabUsingUI(NSString* title) {
SwitchToNormalMode();
chrome_test_util::SelectTabAtIndexInCurrentMode(tabIndex);
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::webViewContainingText("Whee")]
+ selectElementWithMatcher:chrome_test_util::WebViewContainingText("Whee")]
assertWithMatcher:grey_notNil()];
// Verify that the page-load count has been recorded. It should contain a
@@ -868,7 +870,7 @@ void SelectTabUsingUI(NSString* title) {
int numberOfTabs = chrome_test_util::GetMainTabCount();
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::webViewContainingText("link")]
+ selectElementWithMatcher:chrome_test_util::WebViewContainingText("link")]
performAction:grey_longPress()];
[[EarlGrey
@@ -881,7 +883,7 @@ void SelectTabUsingUI(NSString* title) {
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
[[EarlGrey
- selectElementWithMatcher:chrome_test_util::webViewContainingText("Whee")]
+ selectElementWithMatcher:chrome_test_util::WebViewContainingText("Whee")]
assertWithMatcher:grey_notNil()];
FailureBlock failureBlock = ^(NSString* error) {
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/translate/translate_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698