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

Unified Diff: components/policy/core/browser/configuration_policy_pref_store_unittest.cc

Issue 210063003: Refactor TestingPrefStore to make it useful to some tests of load errors and asynchrony. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 6 years, 9 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 | « base/prefs/testing_pref_store.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/browser/configuration_policy_pref_store_unittest.cc
diff --git a/components/policy/core/browser/configuration_policy_pref_store_unittest.cc b/components/policy/core/browser/configuration_policy_pref_store_unittest.cc
index c277253246504a7a0b167dbb81d229247eb41052..4b674208269f50753998063569323767657b3309 100644
--- a/components/policy/core/browser/configuration_policy_pref_store_unittest.cc
+++ b/components/policy/core/browser/configuration_policy_pref_store_unittest.cc
@@ -176,7 +176,6 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) {
const base::Value* value = NULL;
EXPECT_FALSE(store_->GetValue(kTestPolicy, NULL));
- EXPECT_CALL(observer_, OnPrefValueChanged(kTestPref)).Times(1);
PolicyMap policy;
policy.Set(kTestPolicy,
POLICY_LEVEL_MANDATORY,
@@ -184,18 +183,16 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Refresh) {
base::Value::CreateStringValue("http://www.chromium.org"),
NULL);
UpdateProviderPolicy(policy);
- Mock::VerifyAndClearExpectations(&observer_);
+ observer_.VerifyAndResetChangedKey(kTestPref);
EXPECT_TRUE(store_->GetValue(kTestPref, &value));
EXPECT_TRUE(base::StringValue("http://www.chromium.org").Equals(value));
- EXPECT_CALL(observer_, OnPrefValueChanged(_)).Times(0);
UpdateProviderPolicy(policy);
- Mock::VerifyAndClearExpectations(&observer_);
+ EXPECT_TRUE(observer_.changed_keys.empty());
- EXPECT_CALL(observer_, OnPrefValueChanged(kTestPref)).Times(1);
policy.Erase(kTestPolicy);
UpdateProviderPolicy(policy);
- Mock::VerifyAndClearExpectations(&observer_);
+ observer_.VerifyAndResetChangedKey(kTestPref);
EXPECT_FALSE(store_->GetValue(kTestPref, NULL));
}
@@ -203,9 +200,10 @@ TEST_F(ConfigurationPolicyPrefStoreRefreshTest, Initialization) {
EXPECT_FALSE(store_->IsInitializationComplete());
EXPECT_CALL(provider_, IsInitializationComplete(POLICY_DOMAIN_CHROME))
.WillRepeatedly(Return(true));
- EXPECT_CALL(observer_, OnInitializationCompleted(true)).Times(1);
PolicyMap policy;
UpdateProviderPolicy(policy);
+ EXPECT_TRUE(observer_.initialized);
+ EXPECT_TRUE(observer_.initialization_success);
Mock::VerifyAndClearExpectations(&observer_);
EXPECT_TRUE(store_->IsInitializationComplete());
}
« no previous file with comments | « base/prefs/testing_pref_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698