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/extensions/extension_service.h" | |
12 #include "chrome/browser/net/nss_context.h" | 11 #include "chrome/browser/net/nss_context.h" |
13 #include "chrome/browser/net/url_request_mock_util.h" | 12 #include "chrome/browser/net/url_request_mock_util.h" |
14 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
15 #include "chromeos/login/user_names.h" | 14 #include "chromeos/login/user_names.h" |
16 #include "components/policy/core/browser/browser_policy_connector.h" | 15 #include "components/policy/core/browser/browser_policy_connector.h" |
17 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 16 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
18 #include "components/policy/core/common/policy_map.h" | 17 #include "components/policy/core/common/policy_map.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" |
| 23 #include "extensions/browser/extension_registry.h" |
24 #include "extensions/browser/notification_types.h" | 24 #include "extensions/browser/notification_types.h" |
25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
26 #include "net/cert/nss_cert_database.h" | 26 #include "net/cert/nss_cert_database.h" |
27 #include "net/test/url_request/url_request_mock_http_job.h" | 27 #include "net/test/url_request/url_request_mock_http_job.h" |
28 #include "policy/policy_constants.h" | 28 #include "policy/policy_constants.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // The test extension has a certificate referencing this private key which will | 33 // The test extension has a certificate referencing this private key which will |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // manifest and that such extensions don't see the | 366 // manifest and that such extensions don't see the |
367 // chrome.enterprise.platformKeys namespace. | 367 // chrome.enterprise.platformKeys namespace. |
368 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, | 368 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, |
369 EnterprisePlatformKeysIsRestrictedToPolicyExtension) { | 369 EnterprisePlatformKeysIsRestrictedToPolicyExtension) { |
370 ASSERT_TRUE(RunExtensionSubtest("enterprise_platform_keys", | 370 ASSERT_TRUE(RunExtensionSubtest("enterprise_platform_keys", |
371 "api_not_available.html", | 371 "api_not_available.html", |
372 kFlagIgnoreManifestWarnings)); | 372 kFlagIgnoreManifestWarnings)); |
373 | 373 |
374 base::FilePath extension_path = | 374 base::FilePath extension_path = |
375 test_data_dir_.AppendASCII("enterprise_platform_keys"); | 375 test_data_dir_.AppendASCII("enterprise_platform_keys"); |
376 ExtensionService* service = | 376 extensions::ExtensionRegistry* registry = |
377 extensions::ExtensionSystem::Get(profile())->extension_service(); | 377 extensions::ExtensionRegistry::Get(profile()); |
378 const extensions::Extension* extension = | 378 const extensions::Extension* extension = |
379 GetExtensionByPath(service->extensions(), extension_path); | 379 GetExtensionByPath(registry->enabled_extensions(), extension_path); |
380 ASSERT_FALSE(extension->install_warnings().empty()); | 380 ASSERT_FALSE(extension->install_warnings().empty()); |
381 EXPECT_EQ( | 381 EXPECT_EQ( |
382 "'enterprise.platformKeys' is not allowed for specified install " | 382 "'enterprise.platformKeys' is not allowed for specified install " |
383 "location.", | 383 "location.", |
384 extension->install_warnings()[0].message); | 384 extension->install_warnings()[0].message); |
385 } | 385 } |
OLD | NEW |