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

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests and link UpdateLogin to kSigninAllowed pref. Created 7 years, 10 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: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
index 2ffc9fa8e481a6d570641fb68c3d798671c01715..fd37058a4651f0b254c9576da7ed930ed25922a6 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
@@ -533,6 +533,18 @@ TEST_F(OneClickSigninHelperTest, CanOfferDisabledByPolicy) {
web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL,
"user@gmail.com", NULL));
+ // Simulate a policy disabling signin by writing kSigninAllowed directly.
+ profile_->GetTestingPrefService()->SetManagedPref(
+ prefs::kSigninAllowed, base::Value::CreateBooleanValue(false));
+
+ EXPECT_FALSE(OneClickSigninHelper::CanOffer(
+ web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL,
+ "user@gmail.com", NULL));
+
+ // Reset the preference value to true.
+ profile_->GetTestingPrefService()->SetManagedPref(
+ prefs::kSigninAllowed, base::Value::CreateBooleanValue(true));
+
// Simulate a policy disabling sync by writing kSyncManaged directly.
profile_->GetTestingPrefService()->SetManagedPref(
prefs::kSyncManaged, base::Value::CreateBooleanValue(true));
@@ -690,6 +702,18 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) {
OneClickSigninHelper::CanOfferOnIOThreadImpl(
valid_gaia_url_, "", &request_, io_data.get()));
+ // Simulate a policy disabling signin by writing kSigninAllowed directly.
+ // We should not offer to sign in the browser.
+ profile_->GetTestingPrefService()->SetManagedPref(
+ prefs::kSigninAllowed, base::Value::CreateBooleanValue(false));
+ EXPECT_EQ(OneClickSigninHelper::DONT_OFFER,
+ OneClickSigninHelper::CanOfferOnIOThreadImpl(
+ valid_gaia_url_, "", &request_, io_data.get()));
+
+ // Reset the preference.
+ profile_->GetTestingPrefService()->SetManagedPref(
+ prefs::kSigninAllowed, base::Value::CreateBooleanValue(true));
+
// Simulate a policy disabling sync by writing kSyncManaged directly.
// We should still offer to sign in the browser.
profile_->GetTestingPrefService()->SetManagedPref(

Powered by Google App Engine
This is Rietveld 408576698