summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/policy/configuration_policy_pref_store_unittest.cc')
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store_unittest.cc206
1 files changed, 76 insertions, 130 deletions
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index cf5f0c5..2b5ea8e 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -69,8 +69,7 @@ class ConfigurationPolicyPrefStoreListTest
public testing::WithParamInterface<PolicyAndPref> {};
TEST_P(ConfigurationPolicyPrefStoreListTest, GetDefault) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(GetParam().pref_name(), NULL));
+ EXPECT_FALSE(store_->GetValue(GetParam().pref_name(), NULL));
}
TEST_P(ConfigurationPolicyPrefStoreListTest, SetValue) {
@@ -82,8 +81,7 @@ TEST_P(ConfigurationPolicyPrefStoreListTest, SetValue) {
POLICY_SCOPE_USER, in_value);
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(GetParam().pref_name(), &value));
+ EXPECT_TRUE(store_->GetValue(GetParam().pref_name(), &value));
ASSERT_TRUE(value);
EXPECT_TRUE(in_value->Equals(value));
}
@@ -115,8 +113,7 @@ class ConfigurationPolicyPrefStoreStringTest
public testing::WithParamInterface<PolicyAndPref> {};
TEST_P(ConfigurationPolicyPrefStoreStringTest, GetDefault) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(GetParam().pref_name(), NULL));
+ EXPECT_FALSE(store_->GetValue(GetParam().pref_name(), NULL));
}
TEST_P(ConfigurationPolicyPrefStoreStringTest, SetValue) {
@@ -126,8 +123,7 @@ TEST_P(ConfigurationPolicyPrefStoreStringTest, SetValue) {
base::Value::CreateStringValue("http://chromium.org"));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(GetParam().pref_name(), &value));
+ EXPECT_TRUE(store_->GetValue(GetParam().pref_name(), &value));
ASSERT_TRUE(value);
EXPECT_TRUE(base::StringValue("http://chromium.org").Equals(value));
}
@@ -167,8 +163,7 @@ class ConfigurationPolicyPrefStoreBooleanTest
public testing::WithParamInterface<PolicyAndPref> {};
TEST_P(ConfigurationPolicyPrefStoreBooleanTest, GetDefault) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(GetParam().pref_name(), NULL));
+ EXPECT_FALSE(store_->GetValue(GetParam().pref_name(), NULL));
}
TEST_P(ConfigurationPolicyPrefStoreBooleanTest, SetValue) {
@@ -177,8 +172,7 @@ TEST_P(ConfigurationPolicyPrefStoreBooleanTest, SetValue) {
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(GetParam().pref_name(), &value));
+ EXPECT_TRUE(store_->GetValue(GetParam().pref_name(), &value));
ASSERT_TRUE(value);
bool boolean_value = true;
bool result = value->GetAsBoolean(&boolean_value);
@@ -189,8 +183,7 @@ TEST_P(ConfigurationPolicyPrefStoreBooleanTest, SetValue) {
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
provider_.UpdateChromePolicy(policy);
value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(GetParam().pref_name(), &value));
+ EXPECT_TRUE(store_->GetValue(GetParam().pref_name(), &value));
boolean_value = false;
result = value->GetAsBoolean(&boolean_value);
ASSERT_TRUE(result);
@@ -307,8 +300,7 @@ class ConfigurationPolicyPrefStoreIntegerTest
public testing::WithParamInterface<PolicyAndPref> {};
TEST_P(ConfigurationPolicyPrefStoreIntegerTest, GetDefault) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(GetParam().pref_name(), NULL));
+ EXPECT_FALSE(store_->GetValue(GetParam().pref_name(), NULL));
}
TEST_P(ConfigurationPolicyPrefStoreIntegerTest, SetValue) {
@@ -317,8 +309,7 @@ TEST_P(ConfigurationPolicyPrefStoreIntegerTest, SetValue) {
POLICY_SCOPE_USER, base::Value::CreateIntegerValue(2));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(GetParam().pref_name(), &value));
+ EXPECT_TRUE(store_->GetValue(GetParam().pref_name(), &value));
EXPECT_TRUE(base::FundamentalValue(2).Equals(value));
}
@@ -360,8 +351,7 @@ class ConfigurationPolicyPrefStoreProxyTest
const std::string& expected_proxy_bypass_list,
const ProxyPrefs::ProxyMode& expected_proxy_mode) {
const base::Value* value = NULL;
- ASSERT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kProxy, &value));
+ ASSERT_TRUE(store_->GetValue(prefs::kProxy, &value));
ASSERT_EQ(base::Value::TYPE_DICTIONARY, value->GetType());
ProxyConfigDictionary dict(
static_cast<const base::DictionaryValue*>(value));
@@ -433,7 +423,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsInvalid) {
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_NO_VALUE, store_->GetValue(prefs::kProxy, &value));
+ EXPECT_FALSE(store_->GetValue(prefs::kProxy, &value));
}
@@ -492,7 +482,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeInvalid) {
ProxyPrefs::kPacScriptProxyModeName));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_NO_VALUE, store_->GetValue(prefs::kProxy, &value));
+ EXPECT_FALSE(store_->GetValue(prefs::kProxy, &value));
}
// Regression test for http://crbug.com/78016, CPanel returns empty strings
@@ -555,8 +545,7 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ProxyInvalid) {
POLICY_SCOPE_USER, base::Value::CreateIntegerValue(i));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kProxy, &value));
+ EXPECT_FALSE(store_->GetValue(prefs::kProxy, &value));
}
}
@@ -630,36 +619,30 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MinimallyDefined) {
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
EXPECT_TRUE(base::StringValue(kSearchURL).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderName, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderName, &value));
EXPECT_TRUE(base::StringValue("test.com").Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderKeyword, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderKeyword, &value));
EXPECT_TRUE(base::StringValue("test.com").Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSuggestURL,
+ &value));
EXPECT_TRUE(base::StringValue(std::string()).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderIconURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderIconURL, &value));
EXPECT_TRUE(base::StringValue(std::string()).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderEncodings, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderEncodings, &value));
EXPECT_TRUE(base::StringValue(std::string()).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderInstantURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderInstantURL,
+ &value));
EXPECT_TRUE(base::StringValue(std::string()).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs,
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs,
&value));
EXPECT_TRUE(base::ListValue().Equals(value));
}
@@ -672,31 +655,26 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, FullyDefined) {
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
EXPECT_TRUE(base::StringValue(kSearchURL).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderName, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderName, &value));
EXPECT_TRUE(base::StringValue(kName).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderKeyword, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderKeyword, &value));
EXPECT_TRUE(base::StringValue(kKeyword).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSuggestURL,
+ &value));
EXPECT_TRUE(base::StringValue(kSuggestURL).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderIconURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderIconURL, &value));
EXPECT_TRUE(base::StringValue(kIconURL).Equals(value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderEncodings, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderEncodings, &value));
EXPECT_TRUE(base::StringValue("UTF-16;UTF-8").Equals(value));
- EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(
+ EXPECT_TRUE(store_->GetValue(
prefs::kDefaultSearchProviderAlternateURLs, &value));
EXPECT_TRUE(default_alternate_urls_.Equals(value));
}
@@ -709,20 +687,14 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, MissingUrl) {
policy.Erase(key::kDefaultSearchProviderSearchURL);
provider_.UpdateChromePolicy(policy);
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderName, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderKeyword, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderName, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderKeyword, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs,
+ NULL));
}
// Checks that if the default search policy is invalid, that no elements of the
@@ -736,20 +708,14 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Invalid) {
base::Value::CreateStringValue(bad_search_url));
provider_.UpdateChromePolicy(policy);
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderName, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderKeyword, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderName, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderKeyword, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderSuggestURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderIconURL, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderEncodings, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kDefaultSearchProviderAlternateURLs,
+ NULL));
}
// Checks that if the default search policy is invalid, that no elements of the
@@ -761,12 +727,10 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Disabled) {
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderEnabled, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderEnabled, &value));
base::FundamentalValue expected_enabled(false);
EXPECT_TRUE(base::Value::Equals(&expected_enabled, value));
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value));
base::StringValue expected_search_url("");
EXPECT_TRUE(base::Value::Equals(&expected_search_url, value));
}
@@ -802,8 +766,7 @@ class ConfigurationPolicyPrefStoreIncognitoModeTest
void VerifyValues(IncognitoModePrefs::Availability availability) {
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kIncognitoModeAvailability, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kIncognitoModeAvailability, &value));
EXPECT_TRUE(base::FundamentalValue(availability).Equals(value));
}
};
@@ -833,8 +796,7 @@ TEST_F(ConfigurationPolicyPrefStoreIncognitoModeTest,
NoObsoletePolicyAndNoIncognitoAvailability) {
SetPolicies(INCOGNITO_ENABLED_UNKNOWN, kIncognitoModeAvailabilityNotSet);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kIncognitoModeAvailability, &value));
+ EXPECT_FALSE(store_->GetValue(prefs::kIncognitoModeAvailability, &value));
}
// Checks that if the obsolete IncognitoEnabled policy is set, if sets
@@ -869,8 +831,7 @@ class ConfigurationPolicyPrefStoreSyncTest
: public ConfigurationPolicyPrefStoreTest {};
TEST_F(ConfigurationPolicyPrefStoreSyncTest, Default) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kSyncManaged, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kSyncManaged, NULL));
}
TEST_F(ConfigurationPolicyPrefStoreSyncTest, Enabled) {
@@ -879,8 +840,7 @@ TEST_F(ConfigurationPolicyPrefStoreSyncTest, Enabled) {
base::Value::CreateBooleanValue(false));
provider_.UpdateChromePolicy(policy);
// Enabling Sync should not set the pref.
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kSyncManaged, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kSyncManaged, NULL));
}
TEST_F(ConfigurationPolicyPrefStoreSyncTest, Disabled) {
@@ -890,7 +850,7 @@ TEST_F(ConfigurationPolicyPrefStoreSyncTest, Disabled) {
provider_.UpdateChromePolicy(policy);
// Sync should be flagged as managed.
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kSyncManaged, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kSyncManaged, &value));
ASSERT_TRUE(value);
bool sync_managed = false;
bool result = value->GetAsBoolean(&sync_managed);
@@ -904,22 +864,20 @@ class ConfigurationPolicyPrefStorePromptDownloadTest
: public ConfigurationPolicyPrefStoreTest {};
TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, Default) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kPromptForDownload, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
}
#if !defined(OS_CHROMEOS)
TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, SetDownloadDirectory) {
PolicyMap policy;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kPromptForDownload, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
policy.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateStringValue(""));
provider_.UpdateChromePolicy(policy);
// Setting a DownloadDirectory should disable the PromptForDownload pref.
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kPromptForDownload,
+ EXPECT_TRUE(store_->GetValue(prefs::kPromptForDownload,
&value));
ASSERT_TRUE(value);
bool prompt_for_download = true;
@@ -932,30 +890,27 @@ TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, SetDownloadDirectory) {
TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest,
EnableFileSelectionDialogs) {
PolicyMap policy;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kPromptForDownload, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
policy.Set(key::kAllowFileSelectionDialogs, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
provider_.UpdateChromePolicy(policy);
// Allowing file-selection dialogs should not influence the PromptForDownload
// pref.
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kPromptForDownload, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
}
TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest,
DisableFileSelectionDialogs) {
PolicyMap policy;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kPromptForDownload, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
policy.Set(key::kAllowFileSelectionDialogs, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
provider_.UpdateChromePolicy(policy);
// Disabling file-selection dialogs should disable the PromptForDownload pref.
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK, store_->GetValue(prefs::kPromptForDownload,
+ EXPECT_TRUE(store_->GetValue(prefs::kPromptForDownload,
&value));
ASSERT_TRUE(value);
bool prompt_for_download = true;
@@ -969,8 +924,7 @@ class ConfigurationPolicyPrefStoreAutofillTest
: public ConfigurationPolicyPrefStoreTest {};
TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Default) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kAutofillEnabled, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kAutofillEnabled, NULL));
}
TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Enabled) {
@@ -979,8 +933,7 @@ TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Enabled) {
base::Value::CreateBooleanValue(true));
provider_.UpdateChromePolicy(policy);
// Enabling Autofill should not set the pref.
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kAutofillEnabled, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kAutofillEnabled, NULL));
}
TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Disabled) {
@@ -990,8 +943,7 @@ TEST_F(ConfigurationPolicyPrefStoreAutofillTest, Disabled) {
provider_.UpdateChromePolicy(policy);
// Disabling Autofill should switch the pref to managed.
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kAutofillEnabled, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kAutofillEnabled, &value));
ASSERT_TRUE(value);
bool autofill_enabled = true;
bool result = value->GetAsBoolean(&autofill_enabled);
@@ -1018,8 +970,7 @@ class ConfigurationPolicyPrefStoreRefreshTest
TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) {
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kHomePage, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kHomePage, NULL));
EXPECT_CALL(observer_, OnPrefValueChanged(prefs::kHomePage)).Times(1);
PolicyMap policy;
@@ -1027,8 +978,7 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) {
base::Value::CreateStringValue("http://www.chromium.org"));
provider_.UpdateChromePolicy(policy);
Mock::VerifyAndClearExpectations(&observer_);
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kHomePage, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kHomePage, &value));
EXPECT_TRUE(base::StringValue("http://www.chromium.org").Equals(value));
EXPECT_CALL(observer_, OnPrefValueChanged(_)).Times(0);
@@ -1039,8 +989,7 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) {
policy.Erase(key::kHomepageLocation);
provider_.UpdateChromePolicy(policy);
Mock::VerifyAndClearExpectations(&observer_);
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kHomePage, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kHomePage, NULL));
}
TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Initialization) {
@@ -1060,41 +1009,38 @@ class ConfigurationPolicyPrefStoreOthersTest
TEST_F(ConfigurationPolicyPrefStoreOthersTest, JavascriptEnabled) {
// This is a boolean policy, but affects an integer preference.
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
PolicyMap policy;
policy.Set(key::kJavascriptEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
provider_.UpdateChromePolicy(policy);
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
policy.Set(key::kJavascriptEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting,
+ &value));
EXPECT_TRUE(base::FundamentalValue(CONTENT_SETTING_BLOCK).Equals(value));
}
TEST_F(ConfigurationPolicyPrefStoreOthersTest, JavascriptEnabledOverridden) {
- EXPECT_EQ(PrefStore::READ_NO_VALUE,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
+ EXPECT_FALSE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, NULL));
PolicyMap policy;
policy.Set(key::kJavascriptEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
provider_.UpdateChromePolicy(policy);
const base::Value* value = NULL;
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting,
+ &value));
EXPECT_TRUE(base::FundamentalValue(CONTENT_SETTING_BLOCK).Equals(value));
// DefaultJavaScriptSetting overrides JavascriptEnabled.
policy.Set(key::kDefaultJavaScriptSetting, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
base::Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
provider_.UpdateChromePolicy(policy);
- EXPECT_EQ(PrefStore::READ_OK,
- store_->GetValue(prefs::kManagedDefaultJavaScriptSetting, &value));
+ EXPECT_TRUE(store_->GetValue(prefs::kManagedDefaultJavaScriptSetting,
+ &value));
EXPECT_TRUE(base::FundamentalValue(CONTENT_SETTING_ALLOW).Equals(value));
}