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 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/net/nss_context.h" | 11 #include "chrome/browser/net/nss_context.h" |
12 #include "chrome/browser/net/url_request_mock_util.h" | 12 #include "chrome/browser/net/url_request_mock_util.h" |
13 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
14 #include "chromeos/login/user_names.h" | 14 #include "chromeos/login/user_names.h" |
15 #include "components/policy/core/browser/browser_policy_connector.h" | 15 #include "components/policy/core/browser/browser_policy_connector.h" |
16 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 16 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
17 #include "components/policy/core/common/policy_map.h" | 17 #include "components/policy/core/common/policy_map.h" |
18 #include "components/policy/core/common/policy_types.h" | |
19 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
20 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
21 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
22 #include "crypto/nss_util_internal.h" | 21 #include "crypto/nss_util_internal.h" |
23 #include "crypto/scoped_test_system_nss_key_slot.h" | 22 #include "crypto/scoped_test_system_nss_key_slot.h" |
24 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
25 #include "extensions/browser/notification_types.h" | 24 #include "extensions/browser/notification_types.h" |
26 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
27 #include "net/cert/nss_cert_database.h" | 26 #include "net/cert/nss_cert_database.h" |
28 #include "net/test/url_request/url_request_mock_http_job.h" | 27 #include "net/test/url_request/url_request_mock_http_job.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 net::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path)); | 296 net::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path)); |
298 | 297 |
299 scoped_ptr<base::ListValue> forcelist(new base::ListValue); | 298 scoped_ptr<base::ListValue> forcelist(new base::ListValue); |
300 forcelist->AppendString(base::StringPrintf( | 299 forcelist->AppendString(base::StringPrintf( |
301 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); | 300 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); |
302 | 301 |
303 policy::PolicyMap policy; | 302 policy::PolicyMap policy; |
304 policy.Set(policy::key::kExtensionInstallForcelist, | 303 policy.Set(policy::key::kExtensionInstallForcelist, |
305 policy::POLICY_LEVEL_MANDATORY, | 304 policy::POLICY_LEVEL_MANDATORY, |
306 policy::POLICY_SCOPE_MACHINE, | 305 policy::POLICY_SCOPE_MACHINE, |
307 policy::POLICY_SOURCE_CLOUD, | |
308 forcelist.release(), | 306 forcelist.release(), |
309 NULL); | 307 NULL); |
310 | 308 |
311 // Set the policy and wait until the extension is installed. | 309 // Set the policy and wait until the extension is installed. |
312 content::WindowedNotificationObserver observer( | 310 content::WindowedNotificationObserver observer( |
313 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, | 311 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, |
314 content::NotificationService::AllSources()); | 312 content::NotificationService::AllSources()); |
315 policy_provider_.UpdateChromePolicy(policy); | 313 policy_provider_.UpdateChromePolicy(policy); |
316 observer.Wait(); | 314 observer.Wait(); |
317 } | 315 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 extensions::ExtensionRegistry* registry = | 376 extensions::ExtensionRegistry* registry = |
379 extensions::ExtensionRegistry::Get(profile()); | 377 extensions::ExtensionRegistry::Get(profile()); |
380 const extensions::Extension* extension = | 378 const extensions::Extension* extension = |
381 GetExtensionByPath(registry->enabled_extensions(), extension_path); | 379 GetExtensionByPath(registry->enabled_extensions(), extension_path); |
382 ASSERT_FALSE(extension->install_warnings().empty()); | 380 ASSERT_FALSE(extension->install_warnings().empty()); |
383 EXPECT_EQ( | 381 EXPECT_EQ( |
384 "'enterprise.platformKeys' is not allowed for specified install " | 382 "'enterprise.platformKeys' is not allowed for specified install " |
385 "location.", | 383 "location.", |
386 extension->install_warnings()[0].message); | 384 extension->install_warnings()[0].message); |
387 } | 385 } |
OLD | NEW |