| 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/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ASSERT_TRUE(extension); | 135 ASSERT_TRUE(extension); |
| 135 CheckPluginsCreated(extension, false); | 136 CheckPluginsCreated(extension, false); |
| 136 } | 137 } |
| 137 | 138 |
| 138 // Test that the NaCl plugin isn't blocked for component extensions. | 139 // Test that the NaCl plugin isn't blocked for component extensions. |
| 139 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, ComponentExtension) { | 140 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, ComponentExtension) { |
| 140 ASSERT_TRUE(test_server()->Start()); | 141 ASSERT_TRUE(test_server()->Start()); |
| 141 | 142 |
| 142 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); | 143 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); |
| 143 ASSERT_TRUE(extension); | 144 ASSERT_TRUE(extension); |
| 144 ASSERT_EQ(extension->location(), Extension::COMPONENT); | 145 ASSERT_EQ(extension->location(), Manifest::COMPONENT); |
| 145 CheckPluginsCreated(extension, true); | 146 CheckPluginsCreated(extension, true); |
| 146 } | 147 } |
| 147 | 148 |
| 148 // Test that the NaCl plugin isn't blocked for unpacked extensions. | 149 // Test that the NaCl plugin isn't blocked for unpacked extensions. |
| 149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { | 150 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { |
| 150 ASSERT_TRUE(test_server()->Start()); | 151 ASSERT_TRUE(test_server()->Start()); |
| 151 | 152 |
| 152 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); | 153 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); |
| 153 ASSERT_TRUE(extension); | 154 ASSERT_TRUE(extension); |
| 154 ASSERT_EQ(extension->location(), Extension::LOAD); | 155 ASSERT_EQ(extension->location(), Manifest::LOAD); |
| 155 CheckPluginsCreated(extension, true); | 156 CheckPluginsCreated(extension, true); |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace | 159 } // namespace |
| OLD | NEW |