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

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

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 base::WriteFile(schema_path, json_data.data(), json_data.size()); 305 base::WriteFile(schema_path, json_data.data(), json_data.size());
306 306
307 // Build extension that contains the policy schema. 307 // Build extension that contains the policy schema.
308 extensions::DictionaryBuilder storage; 308 extensions::DictionaryBuilder storage;
309 storage.Set("managed_schema", schema_file); 309 storage.Set("managed_schema", schema_file);
310 310
311 extensions::DictionaryBuilder manifest; 311 extensions::DictionaryBuilder manifest;
312 manifest.Set("name", "test") 312 manifest.Set("name", "test")
313 .Set("version", "1") 313 .Set("version", "1")
314 .Set("manifest_version", 2) 314 .Set("manifest_version", 2)
315 .Set("storage", std::move(storage)); 315 .Set("storage", storage.Build());
316 316
317 extensions::ExtensionBuilder builder; 317 extensions::ExtensionBuilder builder;
318 builder.SetPath(temp_dir_.path()); 318 builder.SetPath(temp_dir_.path());
319 builder.SetManifest(std::move(manifest)); 319 builder.SetManifest(manifest.Build());
320 320
321 // Install extension. 321 // Install extension.
322 ExtensionService* service = extensions::ExtensionSystem::Get( 322 ExtensionService* service = extensions::ExtensionSystem::Get(
323 browser()->profile())->extension_service(); 323 browser()->profile())->extension_service();
324 EXPECT_CALL(provider_, RefreshPolicies()); 324 EXPECT_CALL(provider_, RefreshPolicies());
325 service->OnExtensionInstalled(builder.Build().get(), syncer::StringOrdinal(), 325 service->OnExtensionInstalled(builder.Build().get(), syncer::StringOrdinal(),
326 0); 326 0);
327 327
328 std::vector<std::vector<std::string>> expected_policies; 328 std::vector<std::vector<std::string>> expected_policies;
329 policy::Schema chrome_schema = 329 policy::Schema chrome_schema =
330 policy::Schema::Wrap(policy::GetChromeSchemaData()); 330 policy::Schema::Wrap(policy::GetChromeSchemaData());
331 ASSERT_TRUE(chrome_schema.valid()); 331 ASSERT_TRUE(chrome_schema.valid());
332 332
333 for (policy::Schema::Iterator it = chrome_schema.GetPropertiesIterator(); 333 for (policy::Schema::Iterator it = chrome_schema.GetPropertiesIterator();
334 !it.IsAtEnd(); it.Advance()) { 334 !it.IsAtEnd(); it.Advance()) {
335 expected_policies.push_back( 335 expected_policies.push_back(
336 PopulateExpectedPolicy( 336 PopulateExpectedPolicy(
337 it.key(), std::string(), std::string(), nullptr, false)); 337 it.key(), std::string(), std::string(), nullptr, false));
338 } 338 }
339 // Add newly added policy to expected policy list. 339 // Add newly added policy to expected policy list.
340 expected_policies.push_back(PopulateExpectedPolicy( 340 expected_policies.push_back(PopulateExpectedPolicy(
341 newly_added_policy_name, std::string(), std::string(), nullptr, false)); 341 newly_added_policy_name, std::string(), std::string(), nullptr, false));
342 342
343 // Verify if policy UI includes policy that extension have. 343 // Verify if policy UI includes policy that extension have.
344 VerifyPolicies(expected_policies); 344 VerifyPolicies(expected_policies);
345 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698