Commit f43c44de authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Enable Unified Consent feature by default.

This CL enables Unified Consent feature by default. It removes a few
earl grey tests that were only used for pre-Unity flows. It also removes
the unified consent test suite as it is no longer relevant and this
significantly reduces the bots build time.

Bug: 960260
Change-Id: Iff7972e3b6533dc8f547562e2aae854b6f6b1833
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617444Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666201}
parent a8b43102
...@@ -11,7 +11,7 @@ namespace unified_consent { ...@@ -11,7 +11,7 @@ namespace unified_consent {
// base::Feature definition. // base::Feature definition.
const base::Feature kUnifiedConsent { const base::Feature kUnifiedConsent {
"UnifiedConsent", "UnifiedConsent",
#if defined(OS_CHROMEOS) || defined(OS_IOS) #if defined(OS_CHROMEOS)
base::FEATURE_DISABLED_BY_DEFAULT base::FEATURE_DISABLED_BY_DEFAULT
#else #else
base::FEATURE_ENABLED_BY_DEFAULT base::FEATURE_ENABLED_BY_DEFAULT
......
...@@ -30,8 +30,8 @@ TEST(UnifiedConsentFeatureTest, FeatureState) { ...@@ -30,8 +30,8 @@ TEST(UnifiedConsentFeatureTest, FeatureState) {
// Apple platforms // Apple platforms
#if defined(OS_IOS) #if defined(OS_IOS)
// Unified consent is disabled by default. // Unified consent is enabled by default.
EXPECT_FALSE(IsUnifiedConsentFeatureEnabled()); EXPECT_TRUE(IsUnifiedConsentFeatureEnabled());
#endif #endif
#if defined(OS_MACOSX) && !defined(OS_IOS) #if defined(OS_MACOSX) && !defined(OS_IOS)
......
...@@ -34,10 +34,6 @@ ...@@ -34,10 +34,6 @@
"app": "ios_showcase_egtests", "app": "ios_showcase_egtests",
"xctest": true, "xctest": true,
"xcode parallelization": true "xcode parallelization": true
},
{
"app": "ios_chrome_unified_consent_egtests",
"xctest": true
} }
] ]
} }
......
...@@ -51,37 +51,6 @@ source_set("eg_test_support") { ...@@ -51,37 +51,6 @@ source_set("eg_test_support") {
} }
source_set("eg_tests") { source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"signin_interaction_controller_egtest.mm",
"signin_interaction_controller_unity_disabled_egtest.mm",
]
deps = [
":eg_test_support",
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
"//ios/chrome/browser/ui/settings",
"//ios/chrome/browser/ui/util",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
]
libs = [ "XCTest.framework" ]
}
source_set("unity_eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
...@@ -94,7 +63,6 @@ source_set("unity_eg_tests") { ...@@ -94,7 +63,6 @@ source_set("unity_eg_tests") {
"//base/test:test_support", "//base/test:test_support",
"//components/unified_consent", "//components/unified_consent",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser/signin", "//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication", "//ios/chrome/browser/ui/authentication",
...@@ -114,16 +82,3 @@ source_set("unity_eg_tests") { ...@@ -114,16 +82,3 @@ source_set("unity_eg_tests") {
] ]
libs = [ "XCTest.framework" ] libs = [ "XCTest.framework" ]
} }
source_set("unified_consent_enabled_hooks") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"unified_consent_enabled_egtests_hook.mm",
]
deps = [
"//components/unified_consent",
"//components/unified_consent:test_support",
"//ios/chrome/app:tests_hook",
]
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h>
#include "base/auto_reset.h"
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest_util.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
using chrome_test_util::SecondarySignInButton;
using chrome_test_util::SettingsDoneButton;
// Sign-in interaction tests that requires Unified Consent to be disabled.
@interface SigninInteractionControllerUnityDisabledTestCase : ChromeTestCase
@end
@implementation SigninInteractionControllerUnityDisabledTestCase
- (void)setUp {
[super setUp];
CHECK(!unified_consent::IsUnifiedConsentFeatureEnabled())
<< "This test suite must be run with Unified Consent feature disabled.";
}
// Tests that switching from a managed account to a non-managed account works
// correctly and displays the expected warnings.
- (void)testSignInSwitchManagedAccount {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* managed_identity = [SigninEarlGreyUtils fakeManagedIdentity];
ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
identity_service->AddIdentity(managed_identity);
identity_service->AddIdentity(identity);
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
[SigninEarlGreyUI selectIdentityWithEmail:managed_identity.userEmail];
// Accept warning for signing into a managed identity, with synchronization
// off due to an infinite spinner.
SetEarlGreySynchronizationEnabled(NO);
WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON));
TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON);
SetEarlGreySynchronizationEnabled(YES);
[SigninEarlGreyUI confirmSigninConfirmationDialog];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:managed_identity]);
// Switch Sync account to |identity|.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
TapButtonWithAccessibilityLabel(identity.userEmail);
SetEarlGreySynchronizationEnabled(NO);
WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON));
TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON);
SetEarlGreySynchronizationEnabled(YES);
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Tests signing in with one account, switching sync account to a second and
// choosing to keep the browsing data separate during the switch.
- (void)testSignInSwitchAccountsAndKeepDataSeparate {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* identity1 = [SigninEarlGreyUtils fakeIdentity1];
ChromeIdentity* identity2 = [SigninEarlGreyUtils fakeIdentity2];
identity_service->AddIdentity(identity1);
identity_service->AddIdentity(identity2);
[SigninEarlGreyUI signinWithIdentity:identity1];
[ChromeEarlGreyUI openSettingsMenu];
// Open accounts settings, then sync settings.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
// Switch Sync account to |identity2|.
TapButtonWithAccessibilityLabel(identity2.userEmail);
[[EarlGrey selectElementWithMatcher:
chrome_test_util::SettingsImportDataKeepSeparateButton()]
performAction:grey_tap()];
id<GREYMatcher> matcher = grey_allOf(
chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON),
grey_not(grey_accessibilityTrait(UIAccessibilityTraitNotEnabled)), nil);
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Tests signing in with one account, switching sync account to a second and
// choosing to import the browsing data during the switch.
- (void)testSignInSwitchAccountsAndImportData {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* identity1 = [SigninEarlGreyUtils fakeIdentity1];
ChromeIdentity* identity2 = [SigninEarlGreyUtils fakeIdentity2];
identity_service->AddIdentity(identity1);
identity_service->AddIdentity(identity2);
// Sign in to |identity1|.
[SigninEarlGreyUI signinWithIdentity:identity1];
[ChromeEarlGreyUI openSettingsMenu];
// Open accounts settings, then sync settings.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
// Switch Sync account to |identity2|.
TapButtonWithAccessibilityLabel(identity2.userEmail);
[[EarlGrey selectElementWithMatcher:chrome_test_util::
SettingsImportDataImportButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:
grey_allOf(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON),
grey_userInteractionEnabled(), nil)]
performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Opens the add account screen and then cancels it by opening a new tab.
// Ensures that the add account screen is correctly dismissed. crbug.com/462200
- (void)testSignInCancelAddAccount {
// Add an identity to avoid arriving on the Add Account screen when opening
// sign-in.
ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
identity);
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
// Open Add Account screen.
id<GREYMatcher> add_account_matcher =
chrome_test_util::StaticTextWithAccessibilityLabelId(
unified_consent::IsUnifiedConsentFeatureEnabled()
? IDS_IOS_ACCOUNT_IDENTITY_CHOOSER_ADD_ACCOUNT
: IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_ADD_ACCOUNT_BUTTON);
[[EarlGrey selectElementWithMatcher:add_account_matcher]
performAction:grey_tap()];
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
// Open new tab to cancel sign-in.
OpenNewTabCommand* command =
[OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")];
[chrome_test_util::DispatcherForActiveBrowserViewController()
openURLInNewTab:command];
// Re-open the sign-in screen. If it wasn't correctly dismissed previously,
// this will fail.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
// Close sign-in screen and Settings.
TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
@end
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/unified_consent/scoped_unified_consent.h"
#include "ios/chrome/app/tests_hook.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
unified_consent::ScopedUnifiedConsent* gScopedUnifiedConsent = nullptr;
}
namespace tests_hook {
bool DisableAppGroupAccess() {
return true;
}
bool DisableContentSuggestions() {
return true;
}
bool DisableContextualSearch() {
return true;
}
bool DisableFirstRun() {
return true;
}
bool DisableGeolocation() {
return true;
}
bool DisableSigninRecallPromo() {
return true;
}
bool DisableUpdateService() {
return true;
}
void SetUpTestsIfPresent() {
// Enables unified consent feature.
CHECK(!gScopedUnifiedConsent);
gScopedUnifiedConsent = new unified_consent::ScopedUnifiedConsent(
unified_consent::UnifiedConsentFeatureState::kEnabled);
}
void RunTestsIfPresent() {
// No-op for Earl Grey.
}
} // namespace tests_hook
...@@ -21,7 +21,6 @@ group("all_tests") { ...@@ -21,7 +21,6 @@ group("all_tests") {
":ios_chrome_tab_grid_egtests", ":ios_chrome_tab_grid_egtests",
":ios_chrome_translate_egtests", ":ios_chrome_translate_egtests",
":ios_chrome_ui_egtests", ":ios_chrome_ui_egtests",
":ios_chrome_unified_consent_egtests",
":ios_chrome_web_egtests", ":ios_chrome_web_egtests",
] ]
} }
...@@ -201,19 +200,6 @@ chrome_ios_eg_test("ios_chrome_external_url_egtests") { ...@@ -201,19 +200,6 @@ chrome_ios_eg_test("ios_chrome_external_url_egtests") {
] ]
} }
chrome_ios_eg_test("ios_chrome_unified_consent_egtests") {
deps = [
"//ios/chrome/browser/ui/bookmarks:eg_tests",
"//ios/chrome/browser/ui/first_run:eg_tests",
"//ios/chrome/browser/ui/settings:eg_tests",
"//ios/chrome/browser/ui/settings/google_services:eg_tests",
"//ios/chrome/browser/ui/settings/google_services:unified_consent_eg_tests",
"//ios/chrome/browser/ui/signin_interaction:unity_eg_tests",
]
hooks_target =
"//ios/chrome/browser/ui/signin_interaction:unified_consent_enabled_hooks"
}
source_set("test_support") { source_set("test_support") {
defines = [ "CHROME_EARL_GREY_1" ] defines = [ "CHROME_EARL_GREY_1" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
......
...@@ -1325,11 +1325,6 @@ ...@@ -1325,11 +1325,6 @@
"label": "//ios/showcase:ios_showcase_egtests", "label": "//ios/showcase:ios_showcase_egtests",
"type": "raw", "type": "raw",
}, },
"ios_chrome_unified_consent_egtests": {
"args": [],
"label": "//ios/chrome/test/earl_grey:ios_chrome_unified_consent_egtests",
"type": "raw",
},
"ios_web_inttests": { "ios_web_inttests": {
"args": [], "args": [],
"label": "//ios/web:ios_web_inttests", "label": "//ios/web:ios_web_inttests",
......
...@@ -97,7 +97,6 @@ SKIP_GN_ISOLATE_MAP_TARGETS = { ...@@ -97,7 +97,6 @@ SKIP_GN_ISOLATE_MAP_TARGETS = {
'ios_chrome_smoke_egtests', 'ios_chrome_smoke_egtests',
'ios_chrome_translate_egtests', 'ios_chrome_translate_egtests',
'ios_chrome_ui_egtests', 'ios_chrome_ui_egtests',
'ios_chrome_unified_consent_egtests',
'ios_chrome_unittests', 'ios_chrome_unittests',
'ios_chrome_web_egtests', 'ios_chrome_web_egtests',
'ios_chrome_smoke_eg2tests_module', 'ios_chrome_smoke_eg2tests_module',
......
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