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

Unified Diff: chrome/browser/configuration_policy_pref_store_unittest.cc

Issue 1692011: Implementation of managed policy: Policy Abstraction (Closed)
Patch Set: check no changes Created 10 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
« no previous file with comments | « chrome/browser/configuration_policy_pref_store.cc ('k') | chrome/browser/configuration_policy_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/configuration_policy_pref_store_unittest.cc
diff --git a/chrome/browser/configuration_policy_pref_store_unittest.cc b/chrome/browser/configuration_policy_pref_store_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1544b18d0fc9b1a90eed32e123513d3767706292
--- /dev/null
+++ b/chrome/browser/configuration_policy_pref_store_unittest.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 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 <gtest/gtest.h>
+
+#include "chrome/browser/configuration_policy_pref_store.h"
+#include "chrome/common/pref_names.h"
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingHomePageDefault) {
+ ConfigurationPolicyPrefStore store(0);
+ std::wstring result;
+ store.prefs()->GetString(prefs::kHomePage, &result);
+ EXPECT_EQ(result, L"");
+}
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingHomePageOverride) {
+ ConfigurationPolicyPrefStore store(0);
+ store.Apply(ConfigurationPolicyPrefStore::kPolicyHomePage,
+ Value::CreateStringValue("http://chromium.org"));
+ std::wstring result;
+ store.prefs()->GetString(prefs::kHomePage, &result);
+ EXPECT_EQ(result, L"http://chromium.org");
+}
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingHomepageIsNewTabPageDefault) {
+ ConfigurationPolicyPrefStore store(0);
+ bool result = false;
+ store.prefs()->GetBoolean(prefs::kHomePageIsNewTabPage, &result);
+ EXPECT_FALSE(result);
+ result = true;
+ store.prefs()->GetBoolean(prefs::kHomePageIsNewTabPage, &result);
+ EXPECT_TRUE(result);
+}
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingHomepageIsNewTabPage) {
+ ConfigurationPolicyPrefStore store(0);
+ store.Apply(ConfigurationPolicyPrefStore::kPolicyHomepageIsNewTabPage,
+ Value::CreateBooleanValue(false));
+ bool result = true;
+ store.prefs()->GetBoolean(prefs::kHomePageIsNewTabPage, &result);
+ EXPECT_FALSE(result);
+
+ store.Apply(ConfigurationPolicyPrefStore::kPolicyHomepageIsNewTabPage,
+ Value::CreateBooleanValue(true));
+ store.prefs()->GetBoolean(prefs::kHomePageIsNewTabPage, &result);
+ EXPECT_TRUE(result);
+}
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingCookiesEnabledDefault) {
+ ConfigurationPolicyPrefStore store(0);
+ int result = 0;
+ store.prefs()->GetInteger(prefs::kCookieBehavior, &result);
+ EXPECT_EQ(result, 0);
+}
+
+TEST(ConfigurationPolicyPrefStoreTest, TestSettingCookiesEnabledOverride) {
+ ConfigurationPolicyPrefStore store(0);
+ store.Apply(ConfigurationPolicyPrefStore::kPolicyCookiesEnabled,
+ Value::CreateIntegerValue(2));
+ int result = 0;
+ store.prefs()->GetInteger(prefs::kCookieBehavior, &result);
+ EXPECT_EQ(result, 2);
+}
+
« no previous file with comments | « chrome/browser/configuration_policy_pref_store.cc ('k') | chrome/browser/configuration_policy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698