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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/policy/user_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 .WillOnce(SaveArg<2>(&store_callback)); 149 .WillOnce(SaveArg<2>(&store_callback));
150 store_->Store(policy_.policy()); 150 store_->Store(policy_.policy());
151 RunUntilIdle(); 151 RunUntilIdle();
152 Mock::VerifyAndClearExpectations(&session_manager_client_); 152 Mock::VerifyAndClearExpectations(&session_manager_client_);
153 ASSERT_FALSE(store_callback.is_null()); 153 ASSERT_FALSE(store_callback.is_null());
154 154
155 // The new policy shouldn't be present yet. 155 // The new policy shouldn't be present yet.
156 PolicyMap previous_policy; 156 PolicyMap previous_policy;
157 EXPECT_EQ(previous_value != NULL, store_->policy() != NULL); 157 EXPECT_EQ(previous_value != NULL, store_->policy() != NULL);
158 if (previous_value) { 158 if (previous_value) {
159 previous_policy.Set( 159 previous_policy.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY,
160 key::kHomepageLocation, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 160 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
161 POLICY_SOURCE_CLOUD, 161 base::MakeUnique<base::StringValue>(previous_value),
162 base::WrapUnique(new base::StringValue(previous_value)), nullptr); 162 nullptr);
163 } 163 }
164 EXPECT_TRUE(previous_policy.Equals(store_->policy_map())); 164 EXPECT_TRUE(previous_policy.Equals(store_->policy_map()));
165 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); 165 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status());
166 166
167 // Store the new public key so that the validation after the retrieve 167 // Store the new public key so that the validation after the retrieve
168 // operation completes can verify the signature. 168 // operation completes can verify the signature.
169 if (new_public_key) 169 if (new_public_key)
170 StoreUserPolicyKey(*new_public_key); 170 StoreUserPolicyKey(*new_public_key);
171 171
172 // Let the store operation complete. 172 // Let the store operation complete.
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 Mock::VerifyAndClearExpectations(&cryptohome_client_); 666 Mock::VerifyAndClearExpectations(&cryptohome_client_);
667 667
668 EXPECT_FALSE(store_->policy()); 668 EXPECT_FALSE(store_->policy());
669 EXPECT_TRUE(store_->policy_map().empty()); 669 EXPECT_TRUE(store_->policy_map().empty());
670 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); 670 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status());
671 } 671 }
672 672
673 } // namespace 673 } // namespace
674 674
675 } // namespace policy 675 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698