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

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

Issue 11667006: Create a list of policy changes before notifying observers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another ToT merge Created 7 years, 11 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/policy/policy_browsertest.cc ('k') | chrome/browser/policy/policy_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_prefs_browsertest.cc
diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc
index 91f7834bd470387100b31d6ea2e15e622ba12011..700a5b78903994e9abd51788f8734874c32cb528 100644
--- a/chrome/browser/policy/policy_prefs_browsertest.cc
+++ b/chrome/browser/policy/policy_prefs_browsertest.cc
@@ -14,6 +14,7 @@
#include "base/json/json_reader.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -393,6 +394,12 @@ class PolicyPrefsTest
TemplateURLServiceFactory::GetForProfile(browser()->profile()));
}
+ void UpdateProviderPolicy(const PolicyMap& policy) {
+ provider_.UpdateChromePolicy(policy);
+ base::RunLoop loop;
+ loop.RunUntilIdle();
+ }
+
PolicyTestCases policy_test_cases_;
MockConfigurationPolicyProvider provider_;
};
@@ -442,13 +449,13 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, PolicyToPrefsMapping) {
// Verify that setting the policy overrides the pref.
const PolicyMap kNoPolicies;
- provider_.UpdateChromePolicy(kNoPolicies);
+ UpdateProviderPolicy(kNoPolicies);
EXPECT_TRUE(pref->IsDefaultValue());
EXPECT_TRUE(pref->IsUserModifiable());
EXPECT_FALSE(pref->IsUserControlled());
EXPECT_FALSE(pref->IsManaged());
- provider_.UpdateChromePolicy(test_case->test_policy());
+ UpdateProviderPolicy(test_case->test_policy());
EXPECT_FALSE(pref->IsDefaultValue());
EXPECT_FALSE(pref->IsUserModifiable());
EXPECT_FALSE(pref->IsUserControlled());
@@ -506,14 +513,14 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) {
// Check that no controlled setting indicator is visible when no value is
// set by policy.
PolicyMap policies;
- provider_.UpdateChromePolicy(policies);
+ UpdateProviderPolicy(policies);
VerifyControlledSettingIndicators(browser(), indicator_selector,
"", "", false);
// Check that the appropriate controlled setting indicator is shown when a
// value is enforced by policy.
policies.LoadFrom(&(*indicator_test_case)->policy(),
POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
- provider_.UpdateChromePolicy(policies);
+ UpdateProviderPolicy(policies);
VerifyControlledSettingIndicators(browser(), indicator_selector,
(*indicator_test_case)->value(),
"policy",
@@ -536,7 +543,7 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) {
// recommendation.
policies.LoadFrom(&(*indicator_test_case)->policy(),
POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER);
- provider_.UpdateChromePolicy(policies);
+ UpdateProviderPolicy(policies);
VerifyControlledSettingIndicators(browser(), indicator_selector,
(*indicator_test_case)->value(),
"recommended",
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/policy/policy_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698