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