| 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/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 24 #include "net/dns/mock_host_resolver.h" | 24 #include "net/dns/mock_host_resolver.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 using extensions::Manifest; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const char* kExtensionId = "bjjcibdiodkkeanflmiijlcfieiemced"; | 33 const char kExtensionId[] = "bjjcibdiodkkeanflmiijlcfieiemced"; |
| 34 | 34 |
| 35 // 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 |
| 36 // .nexe is part of an extension from the Chrome Webstore. | 36 // .nexe is part of an extension from the Chrome Webstore. |
| 37 class NaClExtensionTest : public ExtensionBrowserTest { | 37 class NaClExtensionTest : public ExtensionBrowserTest { |
| 38 public: | 38 public: |
| 39 NaClExtensionTest() {} | 39 NaClExtensionTest() {} |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 enum InstallType { | 42 enum InstallType { |
| 43 INSTALL_TYPE_COMPONENT, | 43 INSTALL_TYPE_COMPONENT, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 (expected_to_succeed & PLUGIN_TYPE_EMBED) != 0); | 135 (expected_to_succeed & PLUGIN_TYPE_EMBED) != 0); |
| 136 EXPECT_EQ(content_handler_plugin_created, | 136 EXPECT_EQ(content_handler_plugin_created, |
| 137 (expected_to_succeed & PLUGIN_TYPE_CONTENT_HANDLER) != 0); | 137 (expected_to_succeed & PLUGIN_TYPE_CONTENT_HANDLER) != 0); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void CheckPluginsCreated(const Extension* extension, | 140 void CheckPluginsCreated(const Extension* extension, |
| 141 PluginType expected_to_succeed) { | 141 PluginType expected_to_succeed) { |
| 142 CheckPluginsCreated(extension->GetResourceURL("test.html"), | 142 CheckPluginsCreated(extension->GetResourceURL("test.html"), |
| 143 expected_to_succeed); | 143 expected_to_succeed); |
| 144 } | 144 } |
| 145 | |
| 146 }; | 145 }; |
| 147 | 146 |
| 148 // Test that the NaCl plugin isn't blocked for Webstore extensions. | 147 // Test that the NaCl plugin isn't blocked for Webstore extensions. |
| 149 // Disabled: http://crbug.com/319892 | 148 // Disabled: http://crbug.com/319892 |
| 150 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_WebStoreExtension) { | 149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_WebStoreExtension) { |
| 151 ASSERT_TRUE(test_server()->Start()); | 150 ASSERT_TRUE(test_server()->Start()); |
| 152 | 151 |
| 153 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); | 152 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); |
| 154 ASSERT_TRUE(extension); | 153 ASSERT_TRUE(extension); |
| 155 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); | 154 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 replace_host.SetHostStr(host_str); | 210 replace_host.SetHostStr(host_str); |
| 212 replace_host.ClearPort(); | 211 replace_host.ClearPort(); |
| 213 url = url.ReplaceComponents(replace_host); | 212 url = url.ReplaceComponents(replace_host); |
| 214 | 213 |
| 215 const Extension* extension = InstallHostedApp(); | 214 const Extension* extension = InstallHostedApp(); |
| 216 ASSERT_TRUE(extension); | 215 ASSERT_TRUE(extension); |
| 217 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); | 216 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); |
| 218 } | 217 } |
| 219 | 218 |
| 220 } // namespace | 219 } // namespace |
| OLD | NEW |