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

Side by Side Diff: chrome/browser/ui/webui/policy_ui_browsertest.cc

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 std::unique_ptr<base::ListValue> restore_on_startup_urls(new base::ListValue); 217 std::unique_ptr<base::ListValue> restore_on_startup_urls(new base::ListValue);
218 restore_on_startup_urls->AppendString("aaa"); 218 restore_on_startup_urls->AppendString("aaa");
219 restore_on_startup_urls->AppendString("bbb"); 219 restore_on_startup_urls->AppendString("bbb");
220 restore_on_startup_urls->AppendString("ccc"); 220 restore_on_startup_urls->AppendString("ccc");
221 values.Set(policy::key::kRestoreOnStartupURLs, policy::POLICY_LEVEL_MANDATORY, 221 values.Set(policy::key::kRestoreOnStartupURLs, policy::POLICY_LEVEL_MANDATORY,
222 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 222 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
223 std::move(restore_on_startup_urls), nullptr); 223 std::move(restore_on_startup_urls), nullptr);
224 expected_values[policy::key::kRestoreOnStartupURLs] = "aaa,bbb,ccc"; 224 expected_values[policy::key::kRestoreOnStartupURLs] = "aaa,bbb,ccc";
225 values.Set(policy::key::kHomepageLocation, policy::POLICY_LEVEL_MANDATORY, 225 values.Set(policy::key::kHomepageLocation, policy::POLICY_LEVEL_MANDATORY,
226 policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD, 226 policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD,
227 base::WrapUnique(new base::StringValue("http://google.com")), 227 base::MakeUnique<base::StringValue>("http://google.com"), nullptr);
228 nullptr);
229 expected_values[policy::key::kHomepageLocation] = "http://google.com"; 228 expected_values[policy::key::kHomepageLocation] = "http://google.com";
230 values.Set(policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_RECOMMENDED, 229 values.Set(policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_RECOMMENDED,
231 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 230 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
232 base::WrapUnique(new base::FundamentalValue(4)), nullptr); 231 base::MakeUnique<base::FundamentalValue>(4), nullptr);
233 expected_values[policy::key::kRestoreOnStartup] = "4"; 232 expected_values[policy::key::kRestoreOnStartup] = "4";
234 values.Set(policy::key::kShowHomeButton, policy::POLICY_LEVEL_RECOMMENDED, 233 values.Set(policy::key::kShowHomeButton, policy::POLICY_LEVEL_RECOMMENDED,
235 policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD, 234 policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD,
236 base::WrapUnique(new base::FundamentalValue(true)), nullptr); 235 base::MakeUnique<base::FundamentalValue>(true), nullptr);
237 expected_values[policy::key::kShowHomeButton] = "true"; 236 expected_values[policy::key::kShowHomeButton] = "true";
238 // Set the value of a policy that does not exist. 237 // Set the value of a policy that does not exist.
239 const std::string kUnknownPolicy = "NoSuchThing"; 238 const std::string kUnknownPolicy = "NoSuchThing";
240 values.Set(kUnknownPolicy, policy::POLICY_LEVEL_MANDATORY, 239 values.Set(kUnknownPolicy, policy::POLICY_LEVEL_MANDATORY,
241 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_PLATFORM, 240 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_PLATFORM,
242 base::WrapUnique(new base::FundamentalValue(true)), nullptr); 241 base::MakeUnique<base::FundamentalValue>(true), nullptr);
243 expected_values[kUnknownPolicy] = "true"; 242 expected_values[kUnknownPolicy] = "true";
244 UpdateProviderPolicy(values); 243 UpdateProviderPolicy(values);
245 244
246 // Expect that the policy table contains, in order: 245 // Expect that the policy table contains, in order:
247 // * All known policies whose value has been set, in alphabetical order. 246 // * All known policies whose value has been set, in alphabetical order.
248 // * The unknown policy. 247 // * The unknown policy.
249 // * All known policies whose value has not been set, in alphabetical order. 248 // * All known policies whose value has not been set, in alphabetical order.
250 std::vector<std::vector<std::string> > expected_policies; 249 std::vector<std::vector<std::string> > expected_policies;
251 size_t first_unset_position = 0; 250 size_t first_unset_position = 0;
252 policy::Schema chrome_schema = 251 policy::Schema chrome_schema =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 PopulateExpectedPolicy( 324 PopulateExpectedPolicy(
326 it.key(), std::string(), std::string(), nullptr, false)); 325 it.key(), std::string(), std::string(), nullptr, false));
327 } 326 }
328 // Add newly added policy to expected policy list. 327 // Add newly added policy to expected policy list.
329 expected_policies.push_back(PopulateExpectedPolicy( 328 expected_policies.push_back(PopulateExpectedPolicy(
330 newly_added_policy_name, std::string(), std::string(), nullptr, false)); 329 newly_added_policy_name, std::string(), std::string(), nullptr, false));
331 330
332 // Verify if policy UI includes policy that extension have. 331 // Verify if policy UI includes policy that extension have.
333 VerifyPolicies(expected_policies); 332 VerifyPolicies(expected_policies);
334 } 333 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/startup_pages_handler.cc ('k') | chrome/browser/ui/webui/policy_ui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698