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

Side by Side Diff: chrome/browser/policy/profile_policy_connector_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/profile_policy_connector.h" 5 #include "chrome/browser/policy/profile_policy_connector.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // No policy is set initially. 87 // No policy is set initially.
88 EXPECT_FALSE(connector.IsProfilePolicy(autofill::prefs::kAutofillEnabled)); 88 EXPECT_FALSE(connector.IsProfilePolicy(autofill::prefs::kAutofillEnabled));
89 PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, std::string()); 89 PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, std::string());
90 EXPECT_FALSE(connector.policy_service()->GetPolicies(chrome_ns).GetValue( 90 EXPECT_FALSE(connector.policy_service()->GetPolicies(chrome_ns).GetValue(
91 key::kAutoFillEnabled)); 91 key::kAutoFillEnabled));
92 92
93 // Set the policy at the cloud provider. 93 // Set the policy at the cloud provider.
94 cloud_policy_store_.policy_map_.Set( 94 cloud_policy_store_.policy_map_.Set(
95 key::kAutoFillEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 95 key::kAutoFillEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
96 POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(false), 96 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
97 nullptr);
98 cloud_policy_store_.NotifyStoreLoaded(); 97 cloud_policy_store_.NotifyStoreLoaded();
99 base::RunLoop().RunUntilIdle(); 98 base::RunLoop().RunUntilIdle();
100 EXPECT_TRUE(connector.IsProfilePolicy(key::kAutoFillEnabled)); 99 EXPECT_TRUE(connector.IsProfilePolicy(key::kAutoFillEnabled));
101 const base::Value* value = 100 const base::Value* value =
102 connector.policy_service()->GetPolicies(chrome_ns).GetValue( 101 connector.policy_service()->GetPolicies(chrome_ns).GetValue(
103 key::kAutoFillEnabled); 102 key::kAutoFillEnabled);
104 ASSERT_TRUE(value); 103 ASSERT_TRUE(value);
105 EXPECT_TRUE(base::FundamentalValue(false).Equals(value)); 104 EXPECT_TRUE(base::Value(false).Equals(value));
106 105
107 // Now test with a higher-priority provider also setting the policy. 106 // Now test with a higher-priority provider also setting the policy.
108 PolicyMap map; 107 PolicyMap map;
109 map.Set(key::kAutoFillEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 108 map.Set(key::kAutoFillEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
110 POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(true), 109 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
111 nullptr);
112 mock_provider_.UpdateChromePolicy(map); 110 mock_provider_.UpdateChromePolicy(map);
113 EXPECT_FALSE(connector.IsProfilePolicy(key::kAutoFillEnabled)); 111 EXPECT_FALSE(connector.IsProfilePolicy(key::kAutoFillEnabled));
114 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue( 112 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue(
115 key::kAutoFillEnabled); 113 key::kAutoFillEnabled);
116 ASSERT_TRUE(value); 114 ASSERT_TRUE(value);
117 EXPECT_TRUE(base::FundamentalValue(true).Equals(value)); 115 EXPECT_TRUE(base::Value(true).Equals(value));
118 116
119 // Cleanup. 117 // Cleanup.
120 connector.Shutdown(); 118 connector.Shutdown();
121 } 119 }
122 120
123 } // namespace policy 121 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_startup_browsertest.cc ('k') | chrome/browser/prefs/chrome_command_line_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698