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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_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_manager_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 base::UTF8ToUTF16(""), 0, std::string(), factories); 106 base::UTF8ToUTF16(""), 0, std::string(), factories);
107 // Usually the signin Profile and the main Profile are separate, but since 107 // Usually the signin Profile and the main Profile are separate, but since
108 // the signin Profile is an OTR Profile then for this test it suffices to 108 // the signin Profile is an OTR Profile then for this test it suffices to
109 // attach it to the main Profile. 109 // attach it to the main Profile.
110 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); 110 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_);
111 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); 111 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile());
112 112
113 chrome::RegisterLocalState(prefs_.registry()); 113 chrome::RegisterLocalState(prefs_.registry());
114 114
115 // Set up a policy map for testing. 115 // Set up a policy map for testing.
116 policy_map_.Set( 116 policy_map_.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY,
117 key::kHomepageLocation, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 117 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
118 POLICY_SOURCE_CLOUD, 118 base::MakeUnique<base::StringValue>("http://chromium.org"),
119 base::WrapUnique(new base::StringValue("http://chromium.org")), 119 nullptr);
120 nullptr);
121 policy_map_.Set( 120 policy_map_.Set(
122 key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY, 121 key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY,
123 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, 122 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
124 base::WrapUnique(new base::StringValue("primary-only")), nullptr); 123 base::MakeUnique<base::StringValue>("primary-only"), nullptr);
125 policy_map_.Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY, 124 policy_map_.Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY,
126 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 125 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
127 base::WrapUnique(new base::FundamentalValue(false)), 126 base::MakeUnique<base::FundamentalValue>(false), nullptr);
128 nullptr); 127 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy,
129 policy_map_.Set( 128 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
130 key::kCaptivePortalAuthenticationIgnoresProxy, POLICY_LEVEL_MANDATORY, 129 POLICY_SOURCE_CLOUD,
131 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 130 base::MakeUnique<base::FundamentalValue>(false), nullptr);
132 base::WrapUnique(new base::FundamentalValue(false)), nullptr);
133 policy_map_.Set(key::kAllowDinosaurEasterEgg, POLICY_LEVEL_MANDATORY, 131 policy_map_.Set(key::kAllowDinosaurEasterEgg, POLICY_LEVEL_MANDATORY,
134 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, 132 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT,
135 base::WrapUnique(new base::FundamentalValue(false)), 133 base::MakeUnique<base::FundamentalValue>(false), nullptr);
136 nullptr);
137 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 134 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
138 .CopyFrom(policy_map_); 135 .CopyFrom(policy_map_);
139 136
140 // Create fake policy blobs to deliver to the client. 137 // Create fake policy blobs to deliver to the client.
141 em::DeviceRegisterResponse* register_response = 138 em::DeviceRegisterResponse* register_response =
142 register_blob_.mutable_register_response(); 139 register_blob_.mutable_register_response();
143 register_response->set_device_management_token("dmtoken123"); 140 register_response->set_device_management_token("dmtoken123");
144 141
145 em::CloudPolicySettings policy_proto; 142 em::CloudPolicySettings policy_proto;
146 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); 143 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org");
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 598 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
602 EXPECT_TRUE(manager_->core()->client()->is_registered()); 599 EXPECT_TRUE(manager_->core()->client()->is_registered());
603 600
604 // The refresh scheduler takes care of the initial fetch for unmanaged users. 601 // The refresh scheduler takes care of the initial fetch for unmanaged users.
605 // Running the task runner issues the initial fetch. 602 // Running the task runner issues the initial fetch.
606 FetchPolicy( 603 FetchPolicy(
607 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); 604 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_));
608 } 605 }
609 606
610 } // namespace policy 607 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698