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

Side by Side Diff: components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/common/cloud/user_cloud_policy_store.h" 5 #include "components/policy/core/common/cloud/user_cloud_policy_store.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 base::FilePath key_file() { 94 base::FilePath key_file() {
95 return tmp_dir_.path().AppendASCII("policy_key"); 95 return tmp_dir_.path().AppendASCII("policy_key");
96 } 96 }
97 97
98 // Verifies that store_->policy_map() has the appropriate entries. 98 // Verifies that store_->policy_map() has the appropriate entries.
99 void VerifyPolicyMap(CloudPolicyStore* store) { 99 void VerifyPolicyMap(CloudPolicyStore* store) {
100 EXPECT_EQ(2U, store->policy_map().size()); 100 EXPECT_EQ(2U, store->policy_map().size());
101 const PolicyMap::Entry* entry = 101 const PolicyMap::Entry* entry =
102 store->policy_map().Get(key::kPasswordManagerEnabled); 102 store->policy_map().Get(key::kPasswordManagerEnabled);
103 ASSERT_TRUE(entry); 103 ASSERT_TRUE(entry);
104 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); 104 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value.get()));
105 ASSERT_TRUE(store->policy_map().Get(key::kURLBlacklist)); 105 ASSERT_TRUE(store->policy_map().Get(key::kURLBlacklist));
106 } 106 }
107 107
108 // Install an expectation on |observer_| for an error code. 108 // Install an expectation on |observer_| for an error code.
109 void ExpectError(CloudPolicyStore* store, CloudPolicyStore::Status error) { 109 void ExpectError(CloudPolicyStore* store, CloudPolicyStore::Status error) {
110 EXPECT_CALL(observer_, 110 EXPECT_CALL(observer_,
111 OnStoreError(AllOf(Eq(store), 111 OnStoreError(AllOf(Eq(store),
112 Property(&CloudPolicyStore::status, 112 Property(&CloudPolicyStore::status,
113 Eq(error))))); 113 Eq(error)))));
114 } 114 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 loop_.task_runner())); 508 loop_.task_runner()));
509 store2->SetSigninUsername(PolicyBuilder::kFakeUsername); 509 store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
510 store2->AddObserver(&observer_); 510 store2->AddObserver(&observer_);
511 ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR); 511 ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
512 store2->Load(); 512 store2->Load();
513 RunUntilIdle(); 513 RunUntilIdle();
514 store2->RemoveObserver(&observer_); 514 store2->RemoveObserver(&observer_);
515 } 515 }
516 516
517 } // namespace policy 517 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698