Commit 1683f26e authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Chromium LUCI CQ

[iOS Enterprise] BrowserSignin: Enable policy handler by default

Installs the BrowserSignin policy handler by default. It was previously
hidden behind the --install-browser-signin-handler command-line flag
while the different parts of the implementation were being finished. The
policy now fully works, so the command-line flag is no longer needed.

Bug: 1155745
Change-Id: I58dda5bdc143cbfbd21cecbea13d184bc60100ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2633352Reviewed-by: default avatarNohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#844766}
parent ee51fc4c
...@@ -39,9 +39,6 @@ const char kEnableSpotlightActions[] = "enable-spotlight-actions"; ...@@ -39,9 +39,6 @@ const char kEnableSpotlightActions[] = "enable-spotlight-actions";
const char kEnableThirdPartyKeyboardWorkaround[] = const char kEnableThirdPartyKeyboardWorkaround[] =
"enable-third-party-keyboard-workaround"; "enable-third-party-keyboard-workaround";
// Installs the BrowserSignin policy handler.
const char kInstallBrowserSigninHandler[] = "install-browser-signin-handler";
// Installs the URLBlocklist and URLAllowlist handlers. // Installs the URLBlocklist and URLAllowlist handlers.
const char kInstallURLBlocklistHandlers[] = "install-url-blocklist-handlers"; const char kInstallURLBlocklistHandlers[] = "install-url-blocklist-handlers";
......
...@@ -17,7 +17,6 @@ extern const char kEnableEnterprisePolicy[]; ...@@ -17,7 +17,6 @@ extern const char kEnableEnterprisePolicy[];
extern const char kEnableIOSHandoffToOtherDevices[]; extern const char kEnableIOSHandoffToOtherDevices[];
extern const char kEnableSpotlightActions[]; extern const char kEnableSpotlightActions[];
extern const char kEnableThirdPartyKeyboardWorkaround[]; extern const char kEnableThirdPartyKeyboardWorkaround[];
extern const char kInstallBrowserSigninHandler[];
extern const char kInstallURLBlocklistHandlers[]; extern const char kInstallURLBlocklistHandlers[];
extern const char kUserAgent[]; extern const char kUserAgent[];
......
...@@ -124,6 +124,8 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildPolicyHandlerList( ...@@ -124,6 +124,8 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildPolicyHandlerList(
std::make_unique<autofill::AutofillAddressPolicyHandler>()); std::make_unique<autofill::AutofillAddressPolicyHandler>());
handlers->AddHandler( handlers->AddHandler(
std::make_unique<autofill::AutofillCreditCardPolicyHandler>()); std::make_unique<autofill::AutofillCreditCardPolicyHandler>());
handlers->AddHandler(
std::make_unique<policy::BrowserSigninPolicyHandler>(chrome_schema));
handlers->AddHandler(std::make_unique<policy::DefaultSearchPolicyHandler>()); handlers->AddHandler(std::make_unique<policy::DefaultSearchPolicyHandler>());
handlers->AddHandler( handlers->AddHandler(
std::make_unique<safe_browsing::SafeBrowsingPolicyHandler>()); std::make_unique<safe_browsing::SafeBrowsingPolicyHandler>());
...@@ -131,11 +133,6 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildPolicyHandlerList( ...@@ -131,11 +133,6 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildPolicyHandlerList(
std::make_unique<bookmarks::ManagedBookmarksPolicyHandler>( std::make_unique<bookmarks::ManagedBookmarksPolicyHandler>(
chrome_schema)); chrome_schema));
if (ShouldInstallBrowserSigninPolicyHandler()) {
handlers->AddHandler(
std::make_unique<policy::BrowserSigninPolicyHandler>(chrome_schema));
}
if (ShouldInstallURLBlocklistPolicyHandlers()) { if (ShouldInstallURLBlocklistPolicyHandlers()) {
handlers->AddHandler(std::make_unique<policy::URLBlocklistPolicyHandler>( handlers->AddHandler(std::make_unique<policy::URLBlocklistPolicyHandler>(
policy::key::kURLBlocklist)); policy::key::kURLBlocklist));
......
...@@ -63,10 +63,6 @@ bool IsManagedBookmarksEnabled() { ...@@ -63,10 +63,6 @@ bool IsManagedBookmarksEnabled() {
return base::FeatureList::IsEnabled(kManagedBookmarksIOS); return base::FeatureList::IsEnabled(kManagedBookmarksIOS);
} }
bool ShouldInstallBrowserSigninPolicyHandler() {
return HasSwitch(switches::kInstallBrowserSigninHandler);
}
bool ShouldInstallURLBlocklistPolicyHandlers() { bool ShouldInstallURLBlocklistPolicyHandlers() {
return HasSwitch(switches::kInstallURLBlocklistHandlers); return HasSwitch(switches::kInstallURLBlocklistHandlers);
} }
......
...@@ -39,10 +39,6 @@ bool IsIncognitoModeAvailable(); ...@@ -39,10 +39,6 @@ bool IsIncognitoModeAvailable();
// policy data and make it user visible. // policy data and make it user visible.
bool ShouldInstallEnterprisePolicyHandlers(); bool ShouldInstallEnterprisePolicyHandlers();
// Returns true if the BrowserSignin policy handler should be installed to
// parse policy data and make it user visible.
bool ShouldInstallBrowserSigninPolicyHandler();
// Returns true if the ManagedBookmarks policy handler should be installed to // Returns true if the ManagedBookmarks policy handler should be installed to
// parse policy data and make it user visible. // parse policy data and make it user visible.
bool ShouldInstallManagedBookmarksPolicyHandler(); bool ShouldInstallManagedBookmarksPolicyHandler();
......
...@@ -37,8 +37,6 @@ class PolicyTest : public PlatformTest { ...@@ -37,8 +37,6 @@ class PolicyTest : public PlatformTest {
PolicyTest() { PolicyTest() {
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableEnterprisePolicy); switches::kEnableEnterprisePolicy);
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kInstallURLBlocklistHandlers); switches::kInstallURLBlocklistHandlers);
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_pref_names.h" #include "components/signin/public/base/signin_pref_names.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/policy/policy_features.h"
#import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -34,8 +33,7 @@ void PolicyWatcherBrowserAgent::SetApplicationCommandsHandler( ...@@ -34,8 +33,7 @@ void PolicyWatcherBrowserAgent::SetApplicationCommandsHandler(
// BrowserSignin policy: start observing the kSigninAllowed pref for non-OTR // BrowserSignin policy: start observing the kSigninAllowed pref for non-OTR
// browsers. When the pref becomes false, send a UI command to sign the user // browsers. When the pref becomes false, send a UI command to sign the user
// out. This requires the given command dispatcher to be fully configured. // out. This requires the given command dispatcher to be fully configured.
if (!ShouldInstallBrowserSigninPolicyHandler() || if (browser_->GetBrowserState()->IsOffTheRecord()) {
browser_->GetBrowserState()->IsOffTheRecord()) {
return; return;
} }
prefs_change_observer_->Add( prefs_change_observer_->Add(
......
...@@ -4,14 +4,12 @@ ...@@ -4,14 +4,12 @@
#include "ios/chrome/browser/policy/policy_watcher_browser_agent.h" #include "ios/chrome/browser/policy/policy_watcher_browser_agent.h"
#import "base/test/scoped_command_line.h"
#import "components/pref_registry/pref_registry_syncable.h" #import "components/pref_registry/pref_registry_syncable.h"
#import "components/prefs/pref_service.h" #import "components/prefs/pref_service.h"
#import "components/signin/public/base/signin_pref_names.h" #import "components/signin/public/base/signin_pref_names.h"
#import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_mock_factory.h"
#import "components/sync_preferences/pref_service_syncable.h" #import "components/sync_preferences/pref_service_syncable.h"
#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/main/test_browser.h" #import "ios/chrome/browser/main/test_browser.h"
#import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/chrome/browser/prefs/browser_prefs.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
...@@ -57,10 +55,7 @@ class PolicyWatcherBrowserAgentTest : public PlatformTest { ...@@ -57,10 +55,7 @@ class PolicyWatcherBrowserAgentTest : public PlatformTest {
// Tests that the browser agent monitors the kSigninAllowed pref and dispatches // Tests that the browser agent monitors the kSigninAllowed pref and dispatches
// the appropriate command when the pref becomes false. // the appropriate command when the pref becomes false.
TEST_F(PolicyWatcherBrowserAgentTest, observesSigninAllowed) { TEST_F(PolicyWatcherBrowserAgentTest, observesSigninAllowed) {
// Set up the policy handler and the initial pref value. // Set the initial pref value.
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, true); chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, true);
// Set up the test browser and attach the browser agent under test. // Set up the test browser and attach the browser agent under test.
......
...@@ -48,7 +48,6 @@ source_set("signin_impl") { ...@@ -48,7 +48,6 @@ source_set("signin_impl") {
"//components/version_info", "//components/version_info",
"//ios/chrome/app:tests_hook", "//ios/chrome/app:tests_hook",
"//ios/chrome/browser/main:public", "//ios/chrome/browser/main:public",
"//ios/chrome/browser/policy:feature_flags",
"//ios/chrome/browser/signin", "//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication/signin/add_account_signin", "//ios/chrome/browser/ui/authentication/signin/add_account_signin",
"//ios/chrome/browser/ui/authentication/signin/advanced_settings_signin", "//ios/chrome/browser/ui/authentication/signin/advanced_settings_signin",
...@@ -68,11 +67,9 @@ source_set("unit_tests") { ...@@ -68,11 +67,9 @@ source_set("unit_tests") {
deps = [ deps = [
":signin_impl", ":signin_impl",
"//base", "//base",
"//base/test:test_support",
"//components/pref_registry", "//components/pref_registry",
"//components/sync_preferences", "//components/sync_preferences",
"//components/sync_preferences:test_support", "//components/sync_preferences:test_support",
"//ios/chrome/browser:utils",
"//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/main:test_support", "//ios/chrome/browser/main:test_support",
"//ios/chrome/browser/prefs:browser_prefs", "//ios/chrome/browser/prefs:browser_prefs",
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#import "ios/chrome/app/tests_hook.h" #import "ios/chrome/app/tests_hook.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/policy/policy_features.h"
#import "ios/chrome/browser/signin/authentication_service.h" #import "ios/chrome/browser/signin/authentication_service.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/authentication_service_factory.h"
#import "ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_constants.h" #import "ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_constants.h"
...@@ -134,9 +133,7 @@ void SetCurrentVersionForTesting(Version* version) { ...@@ -134,9 +133,7 @@ void SetCurrentVersionForTesting(Version* version) {
} }
bool IsSigninAllowed(const PrefService* prefs) { bool IsSigninAllowed(const PrefService* prefs) {
// Sign-in is always allowed if the policy handler isn't installed. return prefs->GetBoolean(prefs::kSigninAllowed);
return !ShouldInstallBrowserSigninPolicyHandler() ||
prefs->GetBoolean(prefs::kSigninAllowed);
} }
} // namespace signin } // namespace signin
...@@ -9,15 +9,12 @@ ...@@ -9,15 +9,12 @@
#include <memory> #include <memory>
#import "base/bind.h" #import "base/bind.h"
#import "base/command_line.h"
#import "base/test/scoped_command_line.h"
#import "base/version.h" #import "base/version.h"
#import "components/pref_registry/pref_registry_syncable.h" #import "components/pref_registry/pref_registry_syncable.h"
#import "components/signin/public/base/signin_pref_names.h" #import "components/signin/public/base/signin_pref_names.h"
#import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_mock_factory.h"
#import "components/sync_preferences/pref_service_syncable.h" #import "components/sync_preferences/pref_service_syncable.h"
#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/main/test_browser.h" #import "ios/chrome/browser/main/test_browser.h"
#import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/chrome/browser/prefs/browser_prefs.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/authentication_service_factory.h"
...@@ -243,10 +240,6 @@ TEST_F(SigninUtilsTest, TestWillNotShowNewAccountUntilTwoVersionBis) { ...@@ -243,10 +240,6 @@ TEST_F(SigninUtilsTest, TestWillNotShowNewAccountUntilTwoVersionBis) {
// Should not show the sign-in upgrade if sign-in is disabled by policy. // Should not show the sign-in upgrade if sign-in is disabled by policy.
TEST_F(SigninUtilsTest, TestWillNotShowIfDisabledByPolicy) { TEST_F(SigninUtilsTest, TestWillNotShowIfDisabledByPolicy) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider() ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()
->AddIdentities(@[ @"foo1" ]); ->AddIdentities(@[ @"foo1" ]);
chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
...@@ -257,10 +250,6 @@ TEST_F(SigninUtilsTest, TestWillNotShowIfDisabledByPolicy) { ...@@ -257,10 +250,6 @@ TEST_F(SigninUtilsTest, TestWillNotShowIfDisabledByPolicy) {
// signin::IsSigninAllowed should respect the kSigninAllowed pref. // signin::IsSigninAllowed should respect the kSigninAllowed pref.
TEST_F(SigninUtilsTest, TestSigninAllowedPref) { TEST_F(SigninUtilsTest, TestSigninAllowedPref) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
// Sign-in is allowed by default. // Sign-in is allowed by default.
EXPECT_TRUE(signin::IsSigninAllowed(chrome_browser_state_.get()->GetPrefs())); EXPECT_TRUE(signin::IsSigninAllowed(chrome_browser_state_.get()->GetPrefs()));
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#import "base/test/scoped_command_line.h"
#import "components/pref_registry/pref_registry_syncable.h" #import "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/base/signin_metrics.h"
...@@ -16,7 +15,6 @@ ...@@ -16,7 +15,6 @@
#import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_mock_factory.h"
#import "components/sync_preferences/pref_service_syncable.h" #import "components/sync_preferences/pref_service_syncable.h"
#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/chrome/browser/prefs/browser_prefs.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/authentication_service_factory.h"
#import "ios/chrome/browser/signin/authentication_service_fake.h" #import "ios/chrome/browser/signin/authentication_service_fake.h"
...@@ -420,9 +418,6 @@ TEST_F(SigninPromoViewMediatorTest, ...@@ -420,9 +418,6 @@ TEST_F(SigninPromoViewMediatorTest,
// Tests that promos aren't shown if browser sign-in is disabled by policy // Tests that promos aren't shown if browser sign-in is disabled by policy
TEST_F(SigninPromoViewMediatorTest, TEST_F(SigninPromoViewMediatorTest,
ShouldNotDisplaySigninPromoViewIfDisabledByPolicy) { ShouldNotDisplaySigninPromoViewIfDisabledByPolicy) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
CreateMediator(signin_metrics::AccessPoint::ACCESS_POINT_RECENT_TABS); CreateMediator(signin_metrics::AccessPoint::ACCESS_POINT_RECENT_TABS);
TestChromeBrowserState::Builder builder; TestChromeBrowserState::Builder builder;
builder.SetPrefService(CreatePrefService()); builder.SetPrefService(CreatePrefService());
......
...@@ -76,7 +76,6 @@ source_set("recent_tabs_ui") { ...@@ -76,7 +76,6 @@ source_set("recent_tabs_ui") {
"//base", "//base",
"//components/prefs", "//components/prefs",
"//components/sessions", "//components/sessions",
"//components/signin/public/base",
"//components/strings", "//components/strings",
"//components/sync", "//components/sync",
"//ios/chrome/app:tests_hook", "//ios/chrome/app:tests_hook",
...@@ -85,7 +84,6 @@ source_set("recent_tabs_ui") { ...@@ -85,7 +84,6 @@ source_set("recent_tabs_ui") {
"//ios/chrome/browser/drag_and_drop", "//ios/chrome/browser/drag_and_drop",
"//ios/chrome/browser/main:public", "//ios/chrome/browser/main:public",
"//ios/chrome/browser/metrics:metrics_internal", "//ios/chrome/browser/metrics:metrics_internal",
"//ios/chrome/browser/policy:feature_flags",
"//ios/chrome/browser/sessions", "//ios/chrome/browser/sessions",
"//ios/chrome/browser/sessions:serialisation", "//ios/chrome/browser/sessions:serialisation",
"//ios/chrome/browser/sync", "//ios/chrome/browser/sync",
...@@ -93,6 +91,7 @@ source_set("recent_tabs_ui") { ...@@ -93,6 +91,7 @@ source_set("recent_tabs_ui") {
"//ios/chrome/browser/ui/alert_coordinator", "//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/authentication", "//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication/cells", "//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/authentication/signin:signin_headers",
"//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/settings/sync/utils", "//ios/chrome/browser/ui/settings/sync/utils",
"//ios/chrome/browser/ui/table_view", "//ios/chrome/browser/ui/table_view",
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/sessions/core/tab_restore_service.h" #include "components/sessions/core/tab_restore_service.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/sync_sessions/open_tabs_ui_delegate.h" #include "components/sync_sessions/open_tabs_ui_delegate.h"
#include "components/sync_sessions/session_sync_service.h" #include "components/sync_sessions/session_sync_service.h"
...@@ -24,7 +23,6 @@ ...@@ -24,7 +23,6 @@
#import "ios/chrome/browser/drag_and_drop/table_view_url_drag_drop_handler.h" #import "ios/chrome/browser/drag_and_drop/table_view_url_drag_drop_handler.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/metrics/new_tab_page_uma.h" #import "ios/chrome/browser/metrics/new_tab_page_uma.h"
#include "ios/chrome/browser/policy/policy_features.h"
#include "ios/chrome/browser/sessions/live_tab_context_browser_agent.h" #include "ios/chrome/browser/sessions/live_tab_context_browser_agent.h"
#include "ios/chrome/browser/sessions/session_util.h" #include "ios/chrome/browser/sessions/session_util.h"
#include "ios/chrome/browser/sync/session_sync_service_factory.h" #include "ios/chrome/browser/sync/session_sync_service_factory.h"
...@@ -32,6 +30,7 @@ ...@@ -32,6 +30,7 @@
#import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_configurator.h" #import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_configurator.h"
#import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_consumer.h" #import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_consumer.h"
#import "ios/chrome/browser/ui/authentication/cells/table_view_signin_promo_item.h" #import "ios/chrome/browser/ui/authentication/cells/table_view_signin_promo_item.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_utils.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h"
#include "ios/chrome/browser/ui/commands/application_commands.h" #include "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
...@@ -498,8 +497,7 @@ API_AVAILABLE(ios(13.0)) ...@@ -498,8 +497,7 @@ API_AVAILABLE(ios(13.0))
[self.tableViewModel sectionIsCollapsed:SectionIdentifierOtherDevices]; [self.tableViewModel sectionIsCollapsed:SectionIdentifierOtherDevices];
} }
if (ShouldInstallBrowserSigninPolicyHandler() && if (!signin::IsSigninAllowed(self.browserState->GetPrefs())) {
!self.browserState->GetPrefs()->GetBoolean(prefs::kSigninAllowed)) {
// If sign-in is disabled, don't show an illustration or a sign-in promo. // If sign-in is disabled, don't show an illustration or a sign-in promo.
TableViewTextItem* disabledByOrganizationText = TableViewTextItem* disabledByOrganizationText =
[[TableViewTextItem alloc] initWithType:ItemTypeSigninDisabled]; [[TableViewTextItem alloc] initWithType:ItemTypeSigninDisabled];
......
...@@ -147,7 +147,6 @@ source_set("eg2_tests") { ...@@ -147,7 +147,6 @@ source_set("eg2_tests") {
"//components/safe_browsing/core/common:safe_browsing_prefs", "//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/signin/public/base", "//components/signin/public/base",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser:utils",
"//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/authentication:eg_test_support+eg2", "//ios/chrome/browser/ui/authentication:eg_test_support+eg2",
"//ios/chrome/browser/ui/bookmarks:eg_test_support+eg2", "//ios/chrome/browser/ui/bookmarks:eg_test_support+eg2",
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/signin/public/base/signin_pref_names.h" #include "components/signin/public/base/signin_pref_names.h"
#import "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_app_interface.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_app_interface.h"
...@@ -48,16 +47,6 @@ using chrome_test_util::SyncSettingsConfirmButton; ...@@ -48,16 +47,6 @@ using chrome_test_util::SyncSettingsConfirmButton;
@implementation GoogleServicesSettingsTestCase @implementation GoogleServicesSettingsTestCase
- (AppLaunchConfiguration)appConfigurationForTestCase {
// Adds the command-line switch to enable support for the BrowserSignin
// policy.
AppLaunchConfiguration config;
config.additional_args.push_back(std::string("--") +
switches::kInstallBrowserSigninHandler);
config.relaunch_policy = NoForceRelaunchAndResetState;
return config;
}
// Opens the Google services settings view, and closes it. // Opens the Google services settings view, and closes it.
- (void)testOpenGoogleServicesSettings { - (void)testOpenGoogleServicesSettings {
[self openGoogleServicesSettings]; [self openGoogleServicesSettings];
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h" #import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "base/test/scoped_command_line.h"
#import "base/test/task_environment.h" #import "base/test/task_environment.h"
#import "components/pref_registry/pref_registry_syncable.h" #import "components/pref_registry/pref_registry_syncable.h"
#import "components/prefs/pref_service.h" #import "components/prefs/pref_service.h"
...@@ -13,7 +12,6 @@ ...@@ -13,7 +12,6 @@
#import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_mock_factory.h"
#import "components/sync_preferences/pref_service_syncable.h" #import "components/sync_preferences/pref_service_syncable.h"
#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/main/test_browser.h" #import "ios/chrome/browser/main/test_browser.h"
#import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/chrome/browser/prefs/browser_prefs.h"
#import "ios/chrome/browser/search_engines/template_url_service_factory.h" #import "ios/chrome/browser/search_engines/template_url_service_factory.h"
...@@ -179,9 +177,6 @@ TEST_F(SettingsTableViewControllerTest, SyncOn) { ...@@ -179,9 +177,6 @@ TEST_F(SettingsTableViewControllerTest, SyncOn) {
// Verifies that the sign-in setting item is replaced by the managed sign-in // Verifies that the sign-in setting item is replaced by the managed sign-in
// item if sign-in is disabled by policy. // item if sign-in is disabled by policy.
TEST_F(SettingsTableViewControllerTest, SigninDisabled) { TEST_F(SettingsTableViewControllerTest, SigninDisabled) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kInstallBrowserSigninHandler);
chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
CreateController(); CreateController();
CheckController(); CheckController();
......
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