Commit 9cc0fffd authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Review tests in ukm_egtests to ensure they are still relevant.

This CL adds comments to make it cleared why ukm_egtests still use the
flow to sign in and turn sync on in order to enable UKM.

Bug: 1015805
Change-Id: I846bbd853cfc9c53fc03e2649055b1765f036bb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890031Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710807}
parent f9c2d707
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
using chrome_test_util::AccountsSyncButton; using chrome_test_util::AccountsSyncButton;
using chrome_test_util::ButtonWithAccessibilityLabel; using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::ButtonWithAccessibilityLabelId; using chrome_test_util::ButtonWithAccessibilityLabelId;
using chrome_test_util::ClearBrowsingDataButton;
using chrome_test_util::ClearBrowsingDataCell;
using chrome_test_util::ConfirmClearBrowsingDataButton;
using chrome_test_util::GoogleServicesSettingsButton; using chrome_test_util::GoogleServicesSettingsButton;
using chrome_test_util::SettingsAccountButton; using chrome_test_util::SettingsAccountButton;
using chrome_test_util::SettingsDoneButton; using chrome_test_util::SettingsDoneButton;
...@@ -100,23 +103,18 @@ void AssertUKMEnabled(bool is_enabled) { ...@@ -100,23 +103,18 @@ void AssertUKMEnabled(bool is_enabled) {
@"Failed to assert whether UKM was enabled or not."); @"Failed to assert whether UKM was enabled or not.");
} }
// Matcher for the Clear Browsing Data cell on the Privacy screen.
id<GREYMatcher> ClearBrowsingDataCell() {
return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE);
}
// Matcher for the clear browsing data button on the clear browsing data panel.
id<GREYMatcher> ClearBrowsingDataButton() {
return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BUTTON);
}
void ClearBrowsingData() { void ClearBrowsingData() {
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsMenuPrivacyButton()]; [ChromeEarlGreyUI tapSettingsMenuButton:SettingsMenuPrivacyButton()];
[ChromeEarlGreyUI tapPrivacyMenuButton:ClearBrowsingDataCell()]; [ChromeEarlGreyUI tapPrivacyMenuButton:ClearBrowsingDataCell()];
[ChromeEarlGreyUI tapClearBrowsingDataMenuButton:ClearBrowsingDataButton()]; [ChromeEarlGreyUI tapClearBrowsingDataMenuButton:ClearBrowsingDataButton()];
[[EarlGrey selectElementWithMatcher:chrome_test_util:: [[EarlGrey selectElementWithMatcher:ConfirmClearBrowsingDataButton()]
ConfirmClearBrowsingDataButton()]
performAction:grey_tap()]; performAction:grey_tap()];
// Wait until activity indicator modal is cleared, meaning clearing browsing
// data has been finished.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
} }
...@@ -208,7 +206,11 @@ void SignOut() { ...@@ -208,7 +206,11 @@ void SignOut() {
syncTimeout:kSyncUKMOperationsTimeout]; syncTimeout:kSyncUKMOperationsTimeout];
AssertUKMEnabled(false); AssertUKMEnabled(false);
// Enable sync. // Sign in to Chrome and turn sync on.
//
// Note: URL-keyed anonymized data collection is turned on as part of the
// flow to Sign in to Chrome and Turn sync on. This matches the main user
// flow that enables UKM.
[SigninEarlGreyUI signinWithIdentity:[SigninEarlGreyUtils fakeIdentity1]]; [SigninEarlGreyUI signinWithIdentity:[SigninEarlGreyUtils fakeIdentity1]];
[ChromeEarlGrey waitForSyncInitialized:YES [ChromeEarlGrey waitForSyncInitialized:YES
syncTimeout:kSyncUKMOperationsTimeout]; syncTimeout:kSyncUKMOperationsTimeout];
...@@ -237,7 +239,11 @@ void SignOut() { ...@@ -237,7 +239,11 @@ void SignOut() {
nullptr); nullptr);
AssertUKMEnabled(false); AssertUKMEnabled(false);
// Disable sync. // Sign out of Chrome and Turn sync off.
//
// Note: URL-keyed anonymized data collection is turned off as part of the
// flow to Sign out of Chrome and Turn sync off. This matchers the main user
// flow that disables UKM.
SignOut(); SignOut();
[ChromeEarlGrey waitForSyncInitialized:NO [ChromeEarlGrey waitForSyncInitialized:NO
syncTimeout:kSyncUKMOperationsTimeout]; syncTimeout:kSyncUKMOperationsTimeout];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment