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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 }; | 145 }; |
146 | 146 |
147 // Test that the NaCl plugin isn't blocked for Webstore extensions. | 147 // Test that the NaCl plugin isn't blocked for Webstore extensions. |
148 // Disabled: http://crbug.com/319892 | 148 // Disabled: http://crbug.com/319892 |
149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_WebStoreExtension) { | 149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_WebStoreExtension) { |
150 ASSERT_TRUE(test_server()->Start()); | 150 ASSERT_TRUE(embedded_test_server()->Start()); |
151 | 151 |
152 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); | 152 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); |
153 ASSERT_TRUE(extension); | 153 ASSERT_TRUE(extension); |
154 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); | 154 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); |
155 } | 155 } |
156 | 156 |
157 // Test that the NaCl plugin is blocked for non-Webstore extensions. | 157 // Test that the NaCl plugin is blocked for non-Webstore extensions. |
158 // Disabled: http://crbug.com/319892 | 158 // Disabled: http://crbug.com/319892 |
159 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonWebStoreExtension) { | 159 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonWebStoreExtension) { |
160 ASSERT_TRUE(test_server()->Start()); | 160 ASSERT_TRUE(embedded_test_server()->Start()); |
161 | 161 |
162 const Extension* extension = InstallExtension(INSTALL_TYPE_NON_WEBSTORE); | 162 const Extension* extension = InstallExtension(INSTALL_TYPE_NON_WEBSTORE); |
163 ASSERT_TRUE(extension); | 163 ASSERT_TRUE(extension); |
164 CheckPluginsCreated(extension, PLUGIN_TYPE_NONE); | 164 CheckPluginsCreated(extension, PLUGIN_TYPE_NONE); |
165 } | 165 } |
166 | 166 |
167 // Test that the NaCl plugin isn't blocked for component extensions. | 167 // Test that the NaCl plugin isn't blocked for component extensions. |
168 // Disabled: http://crbug.com/319892 | 168 // Disabled: http://crbug.com/319892 |
169 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_ComponentExtension) { | 169 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_ComponentExtension) { |
170 ASSERT_TRUE(test_server()->Start()); | 170 ASSERT_TRUE(embedded_test_server()->Start()); |
171 | 171 |
172 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); | 172 const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); |
173 ASSERT_TRUE(extension); | 173 ASSERT_TRUE(extension); |
174 ASSERT_EQ(extension->location(), Manifest::COMPONENT); | 174 ASSERT_EQ(extension->location(), Manifest::COMPONENT); |
175 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); | 175 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); |
176 } | 176 } |
177 | 177 |
178 // Test that the NaCl plugin isn't blocked for unpacked extensions. | 178 // Test that the NaCl plugin isn't blocked for unpacked extensions. |
179 // Disabled: http://crbug.com/319892 | 179 // Disabled: http://crbug.com/319892 |
180 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_UnpackedExtension) { | 180 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_UnpackedExtension) { |
181 ASSERT_TRUE(test_server()->Start()); | 181 ASSERT_TRUE(embedded_test_server()->Start()); |
182 | 182 |
183 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); | 183 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); |
184 ASSERT_TRUE(extension); | 184 ASSERT_TRUE(extension); |
185 ASSERT_EQ(extension->location(), Manifest::UNPACKED); | 185 ASSERT_EQ(extension->location(), Manifest::UNPACKED); |
186 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); | 186 CheckPluginsCreated(extension, PLUGIN_TYPE_ALL); |
187 } | 187 } |
188 | 188 |
189 // Test that the NaCl plugin is blocked for non chrome-extension urls, except | 189 // Test that the NaCl plugin is blocked for non chrome-extension urls, except |
190 // if it's a content (MIME type) handler. | 190 // if it's a content (MIME type) handler. |
191 // Disabled: http://crbug.com/319892 | 191 // Disabled: http://crbug.com/319892 |
192 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonExtensionScheme) { | 192 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonExtensionScheme) { |
193 ASSERT_TRUE(test_server()->Start()); | 193 ASSERT_TRUE(embedded_test_server()->Start()); |
194 | 194 |
195 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); | 195 const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE); |
196 ASSERT_TRUE(extension); | 196 ASSERT_TRUE(extension); |
197 CheckPluginsCreated( | 197 CheckPluginsCreated( |
198 test_server()->GetURL("files/extensions/native_client/test.html"), | 198 embedded_test_server()->GetURL("/extensions/native_client/test.html"), |
199 PLUGIN_TYPE_CONTENT_HANDLER); | 199 PLUGIN_TYPE_CONTENT_HANDLER); |
200 } | 200 } |
201 | 201 |
202 // Test that NaCl plugin isn't blocked for hosted app URLs. | 202 // Test that NaCl plugin isn't blocked for hosted app URLs. |
203 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, HostedApp) { | 203 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, HostedApp) { |
204 host_resolver()->AddRule("*", "127.0.0.1"); | 204 host_resolver()->AddRule("*", "127.0.0.1"); |
205 ASSERT_TRUE(test_server()->Start()); | 205 ASSERT_TRUE(embedded_test_server()->Start()); |
206 | 206 |
207 GURL url = test_server()->GetURL("files/extensions/native_client/test.html"); | 207 GURL url = |
| 208 embedded_test_server()->GetURL("/extensions/native_client/test.html"); |
208 GURL::Replacements replace_host; | 209 GURL::Replacements replace_host; |
209 replace_host.SetHostStr("localhost"); | 210 replace_host.SetHostStr("localhost"); |
210 replace_host.ClearPort(); | 211 replace_host.ClearPort(); |
211 url = url.ReplaceComponents(replace_host); | 212 url = url.ReplaceComponents(replace_host); |
212 | 213 |
213 const Extension* extension = InstallHostedApp(); | 214 const Extension* extension = InstallHostedApp(); |
214 ASSERT_TRUE(extension); | 215 ASSERT_TRUE(extension); |
215 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); | 216 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); |
216 } | 217 } |
217 | 218 |
218 } // namespace | 219 } // namespace |
OLD | NEW |