OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
21 #include "content/public/browser/plugin_service.h" | 21 #include "content/public/browser/plugin_service.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
24 #include "webkit/plugins/webplugininfo.h" | 24 #include "webkit/plugins/webplugininfo.h" |
25 | 25 |
26 using content::PluginService; | 26 using content::PluginService; |
27 using content::WebContents; | 27 using content::WebContents; |
28 using extensions::Extension; | 28 using extensions::Extension; |
| 29 using extensions::Manifest; |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 const char* kExtensionId = "bjjcibdiodkkeanflmiijlcfieiemced"; | 33 const char* kExtensionId = "bjjcibdiodkkeanflmiijlcfieiemced"; |
33 | 34 |
34 // This class tests that the Native Client plugin is blocked unless the | 35 // This class tests that the Native Client plugin is blocked unless the |
35 // .nexe is part of an extension from the Chrome Webstore. | 36 // .nexe is part of an extension from the Chrome Webstore. |
36 class NaClExtensionTest : public ExtensionBrowserTest { | 37 class NaClExtensionTest : public ExtensionBrowserTest { |
37 public: | 38 public: |
38 NaClExtensionTest() {} | 39 NaClExtensionTest() {} |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ASSERT_TRUE(extension); | 134 ASSERT_TRUE(extension); |
134 CheckPluginsCreated(extension, false); | 135 CheckPluginsCreated(extension, false); |
135 } | 136 } |
136 | 137 |
137 // Test that the NaCl plugin isn't blocked for component extensions. | 138 // Test that the NaCl plugin isn't blocked for component extensions. |
138 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, ComponentExtension) { | 139 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, ComponentExtension) { |
139 ASSERT_TRUE(test_server()->Start()); | 140 ASSERT_TRUE(test_server()->Start()); |
140 | 141 |
141 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); | 142 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); |
142 ASSERT_TRUE(extension); | 143 ASSERT_TRUE(extension); |
143 ASSERT_EQ(extension->location(), Extension::COMPONENT); | 144 ASSERT_EQ(extension->location(), Manifest::COMPONENT); |
144 CheckPluginsCreated(extension, true); | 145 CheckPluginsCreated(extension, true); |
145 } | 146 } |
146 | 147 |
147 // Test that the NaCl plugin isn't blocked for unpacked extensions. | 148 // Test that the NaCl plugin isn't blocked for unpacked extensions. |
148 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { | 149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { |
149 ASSERT_TRUE(test_server()->Start()); | 150 ASSERT_TRUE(test_server()->Start()); |
150 | 151 |
151 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); | 152 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); |
152 ASSERT_TRUE(extension); | 153 ASSERT_TRUE(extension); |
153 ASSERT_EQ(extension->location(), Extension::LOAD); | 154 ASSERT_EQ(extension->location(), Manifest::LOAD); |
154 CheckPluginsCreated(extension, true); | 155 CheckPluginsCreated(extension, true); |
155 } | 156 } |
156 | 157 |
157 } // namespace | 158 } // namespace |
OLD | NEW |