| Index: components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
|
| diff --git a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
|
| index 70299fa3f53ca5153b94be474950ca0caf86d3c0..2d5a897bc7eb538cab2530d5b380fc503e281e51 100644
|
| --- a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
|
| +++ b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
|
| @@ -74,12 +74,9 @@ ConfigurationPolicyProvider* TestHarness::CreateProvider(
|
| scoped_refptr<base::SequencedTaskRunner> task_runner) {
|
| // Create and initialize the store.
|
| store_.NotifyStoreLoaded();
|
| - ConfigurationPolicyProvider* provider = new CloudPolicyManager(
|
| - PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()),
|
| - &store_,
|
| - task_runner,
|
| - task_runner,
|
| - task_runner);
|
| + ConfigurationPolicyProvider* provider =
|
| + new CloudPolicyManager(dm_protocol::kChromeUserPolicyType, std::string(),
|
| + &store_, task_runner, task_runner, task_runner);
|
| Mock::VerifyAndClearExpectations(&store_);
|
| return provider;
|
| }
|
| @@ -92,7 +89,7 @@ void TestHarness::InstallStringPolicy(const std::string& policy_name,
|
| policy_level(),
|
| policy_scope(),
|
| new base::StringValue(policy_value),
|
| - NULL);
|
| + nullptr);
|
| }
|
|
|
| void TestHarness::InstallIntegerPolicy(const std::string& policy_name,
|
| @@ -101,7 +98,7 @@ void TestHarness::InstallIntegerPolicy(const std::string& policy_name,
|
| policy_level(),
|
| policy_scope(),
|
| new base::FundamentalValue(policy_value),
|
| - NULL);
|
| + nullptr);
|
| }
|
|
|
| void TestHarness::InstallBooleanPolicy(const std::string& policy_name,
|
| @@ -110,20 +107,20 @@ void TestHarness::InstallBooleanPolicy(const std::string& policy_name,
|
| policy_level(),
|
| policy_scope(),
|
| new base::FundamentalValue(policy_value),
|
| - NULL);
|
| + nullptr);
|
| }
|
|
|
| void TestHarness::InstallStringListPolicy(const std::string& policy_name,
|
| const base::ListValue* policy_value) {
|
| store_.policy_map_.Set(policy_name, policy_level(), policy_scope(),
|
| - policy_value->DeepCopy(), NULL);
|
| + policy_value->DeepCopy(), nullptr);
|
| }
|
|
|
| void TestHarness::InstallDictionaryPolicy(
|
| const std::string& policy_name,
|
| const base::DictionaryValue* policy_value) {
|
| store_.policy_map_.Set(policy_name, policy_level(), policy_scope(),
|
| - policy_value->DeepCopy(), NULL);
|
| + policy_value->DeepCopy(), nullptr);
|
| }
|
|
|
| // static
|
| @@ -148,9 +145,8 @@ class TestCloudPolicyManager : public CloudPolicyManager {
|
| TestCloudPolicyManager(
|
| CloudPolicyStore* store,
|
| const scoped_refptr<base::SequencedTaskRunner>& task_runner)
|
| - : CloudPolicyManager(PolicyNamespaceKey(
|
| - dm_protocol::kChromeUserPolicyType,
|
| - std::string()),
|
| + : CloudPolicyManager(dm_protocol::kChromeUserPolicyType,
|
| + std::string(),
|
| store,
|
| task_runner,
|
| task_runner,
|
| @@ -167,14 +163,14 @@ class TestCloudPolicyManager : public CloudPolicyManager {
|
| DISALLOW_COPY_AND_ASSIGN(TestCloudPolicyManager);
|
| };
|
|
|
| -MATCHER_P(ProtoMatches, proto, "") {
|
| +MATCHER_P(ProtoMatches, proto, std::string()) {
|
| return arg.SerializePartialAsString() == proto.SerializePartialAsString();
|
| }
|
|
|
| class CloudPolicyManagerTest : public testing::Test {
|
| protected:
|
| CloudPolicyManagerTest()
|
| - : policy_ns_key_(dm_protocol::kChromeUserPolicyType, std::string()) {}
|
| + : policy_type_(dm_protocol::kChromeUserPolicyType) {}
|
|
|
| void SetUp() override {
|
| // Set up a policy map for testing.
|
| @@ -182,7 +178,7 @@ class CloudPolicyManagerTest : public testing::Test {
|
| POLICY_LEVEL_MANDATORY,
|
| POLICY_SCOPE_USER,
|
| new base::StringValue("value"),
|
| - NULL);
|
| + nullptr);
|
| expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
|
| .CopyFrom(policy_map_);
|
|
|
| @@ -206,7 +202,7 @@ class CloudPolicyManagerTest : public testing::Test {
|
| base::MessageLoop loop_;
|
|
|
| // Testing policy.
|
| - const PolicyNamespaceKey policy_ns_key_;
|
| + const std::string policy_type_;
|
| UserPolicyBuilder policy_;
|
| PolicyMap policy_map_;
|
| PolicyBundle expected_bundle_;
|
| @@ -266,7 +262,7 @@ TEST_F(CloudPolicyManagerTest, RegistrationAndFetch) {
|
| client->SetDMToken(policy_.policy_data().request_token());
|
| client->NotifyRegistrationStateChanged();
|
|
|
| - client->SetPolicy(policy_ns_key_, policy_.policy());
|
| + client->SetPolicy(policy_type_, std::string(), policy_.policy());
|
| EXPECT_CALL(store_, Store(ProtoMatches(policy_.policy())));
|
| client->NotifyPolicyFetched();
|
| Mock::VerifyAndClearExpectations(&store_);
|
| @@ -339,7 +335,7 @@ TEST_F(CloudPolicyManagerTest, RefreshSuccessful) {
|
| // Respond to the policy fetch, which should trigger a write to |store_|.
|
| EXPECT_CALL(observer_, OnUpdatePolicy(_)).Times(0);
|
| EXPECT_CALL(store_, Store(_));
|
| - client->SetPolicy(policy_ns_key_, policy_.policy());
|
| + client->SetPolicy(policy_type_, std::string(), policy_.policy());
|
| client->NotifyPolicyFetched();
|
| Mock::VerifyAndClearExpectations(&observer_);
|
| Mock::VerifyAndClearExpectations(&store_);
|
|
|