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

Unified Diff: chrome/browser/policy/configuration_policy_pref_store_unittest.cc

Issue 10417032: Disable sync promo when RestoreOnStartupURLs policy is used (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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/policy/configuration_policy_pref_store_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index b89ebdf55b6c7b27b0e670cdf4b7079021d36ff9..ec6e29058260995ace91cdc0b23938c38f04eb70 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -87,8 +87,6 @@ INSTANTIATE_TEST_CASE_P(
ConfigurationPolicyPrefStoreListTestInstance,
ConfigurationPolicyPrefStoreListTest,
testing::Values(
- PolicyAndPref(key::kRestoreOnStartupURLs,
- prefs::kURLsToRestoreOnStartup),
PolicyAndPref(key::kDisabledPlugins,
prefs::kPluginsDisabledPlugins),
PolicyAndPref(key::kDisabledPluginsExceptions,
@@ -1071,4 +1069,30 @@ TEST_F(ConfigurationPolicyPrefStoreOthersTest, JavascriptEnabledOverridden) {
EXPECT_TRUE(base::FundamentalValue(CONTENT_SETTING_ALLOW).Equals(value));
}
+TEST_F(ConfigurationPolicyPrefStoreOthersTest, RestoreOnStartupURLs) {
+ EXPECT_EQ(PrefStore::READ_NO_VALUE,
+ store_->GetValue(prefs::kURLsToRestoreOnStartup, NULL));
+ EXPECT_EQ(PrefStore::READ_NO_VALUE,
+ store_->GetValue(prefs::kSyncPromoShowOnFirstRunAllowed, NULL));
+ base::ListValue* in_urls = new base::ListValue();
+ in_urls->Append(base::Value::CreateStringValue("test1"));
+ in_urls->Append(base::Value::CreateStringValue("test2,"));
+ PolicyMap policy;
+ policy.Set(key::kRestoreOnStartupURLs, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, in_urls);
+ provider_.UpdateChromePolicy(policy);
+ const base::Value* out_urls = NULL;
+ EXPECT_EQ(PrefStore::READ_OK,
+ store_->GetValue(prefs::kURLsToRestoreOnStartup, &out_urls));
+ ASSERT_TRUE(out_urls);
+ EXPECT_TRUE(in_urls->Equals(out_urls));
+ const base::Value* out_sync_promo_enabled = NULL;
+ EXPECT_EQ(PrefStore::READ_OK,
+ store_->GetValue(prefs::kSyncPromoShowOnFirstRunAllowed,
+ &out_sync_promo_enabled));
+ ASSERT_TRUE(out_sync_promo_enabled);
+ EXPECT_TRUE(base::Value::CreateBooleanValue(false)->
Mattias Nissler (ping if slow) 2012/05/22 14:58:41 You are leaking the created value here. An alterna
bartfab (slow) 2012/05/22 15:30:54 I leaked it on purpose because I figured in_urls w
Mattias Nissler (ping if slow) 2012/05/22 15:35:44 The rule is "Never leak a thing!", even in unit te
+ Equals(out_sync_promo_enabled));
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698