OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <cryptohi.h> | 5 #include <cryptohi.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); | 360 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); |
361 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( | 361 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( |
362 update_manifest_path.MaybeAsASCII())); | 362 update_manifest_path.MaybeAsASCII())); |
363 | 363 |
364 std::unique_ptr<base::ListValue> forcelist(new base::ListValue); | 364 std::unique_ptr<base::ListValue> forcelist(new base::ListValue); |
365 forcelist->AppendString(base::StringPrintf( | 365 forcelist->AppendString(base::StringPrintf( |
366 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); | 366 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); |
367 | 367 |
368 policy::PolicyMap policy; | 368 policy::PolicyMap policy; |
369 policy.Set(policy::key::kExtensionInstallForcelist, | 369 policy.Set(policy::key::kExtensionInstallForcelist, |
370 policy::POLICY_LEVEL_MANDATORY, | 370 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, |
371 policy::POLICY_SCOPE_MACHINE, | 371 policy::POLICY_SOURCE_CLOUD, std::move(forcelist), nullptr); |
372 policy::POLICY_SOURCE_CLOUD, | |
373 forcelist.release(), | |
374 NULL); | |
375 | 372 |
376 // Set the policy and wait until the extension is installed. | 373 // Set the policy and wait until the extension is installed. |
377 extensions::TestExtensionRegistryObserver observer( | 374 extensions::TestExtensionRegistryObserver observer( |
378 extensions::ExtensionRegistry::Get(profile())); | 375 extensions::ExtensionRegistry::Get(profile())); |
379 policy_provider_.UpdateChromePolicy(policy); | 376 policy_provider_.UpdateChromePolicy(policy); |
380 observer.WaitForExtensionWillBeInstalled(); | 377 observer.WaitForExtensionWillBeInstalled(); |
381 } | 378 } |
382 | 379 |
383 // Load |page_url| in |browser| and wait for PASSED or FAILED notification. | 380 // Load |page_url| in |browser| and wait for PASSED or FAILED notification. |
384 // The functionality of this function is reduced functionality of | 381 // The functionality of this function is reduced functionality of |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 extensions::ExtensionRegistry* registry = | 508 extensions::ExtensionRegistry* registry = |
512 extensions::ExtensionRegistry::Get(profile()); | 509 extensions::ExtensionRegistry::Get(profile()); |
513 const extensions::Extension* extension = | 510 const extensions::Extension* extension = |
514 GetExtensionByPath(registry->enabled_extensions(), extension_path); | 511 GetExtensionByPath(registry->enabled_extensions(), extension_path); |
515 ASSERT_FALSE(extension->install_warnings().empty()); | 512 ASSERT_FALSE(extension->install_warnings().empty()); |
516 EXPECT_EQ( | 513 EXPECT_EQ( |
517 "'enterprise.platformKeys' is not allowed for specified install " | 514 "'enterprise.platformKeys' is not allowed for specified install " |
518 "location.", | 515 "location.", |
519 extension->install_warnings()[0].message); | 516 extension->install_warnings()[0].message); |
520 } | 517 } |
OLD | NEW |