OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Tests for the top plugins to catch regressions in our plugin host code, as | 5 // Tests for the top plugins to catch regressions in our plugin host code, as |
6 // well as in the out of process code. Currently this tests: | 6 // well as in the out of process code. Currently this tests: |
7 // Flash | 7 // Flash |
8 // Real | 8 // Real |
9 // QuickTime | 9 // QuickTime |
10 // Windows Media Player | 10 // Windows Media Player |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include <stdlib.h> | 24 #include <stdlib.h> |
25 #include <string.h> | 25 #include <string.h> |
26 #include <memory.h> | 26 #include <memory.h> |
27 | 27 |
28 #include <string> | 28 #include <string> |
29 | 29 |
30 #include "base/file_path.h" | 30 #include "base/file_path.h" |
31 #include "base/file_util.h" | 31 #include "base/file_util.h" |
32 #include "base/message_loop.h" | 32 #include "base/message_loop.h" |
33 #include "base/path_service.h" | 33 #include "base/path_service.h" |
| 34 #include "base/test/test_timeouts.h" |
34 #include "chrome/browser/net/url_request_mock_http_job.h" | 35 #include "chrome/browser/net/url_request_mock_http_job.h" |
35 #include "chrome/browser/plugin_download_helper.h" | 36 #include "chrome/browser/plugin_download_helper.h" |
36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/chrome_paths.h" | 38 #include "chrome/common/chrome_paths.h" |
38 #include "chrome/test/automation/tab_proxy.h" | 39 #include "chrome/test/automation/tab_proxy.h" |
39 #include "chrome/test/ui/ui_test.h" | 40 #include "chrome/test/ui/ui_test.h" |
40 #include "net/base/capturing_net_log.h" | 41 #include "net/base/capturing_net_log.h" |
41 #include "net/base/cert_verifier.h" | 42 #include "net/base/cert_verifier.h" |
42 #include "net/base/host_resolver.h" | 43 #include "net/base/host_resolver.h" |
43 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Flash plugin in the future? | 136 // Flash plugin in the future? |
136 std::string kFlashQuery = | 137 std::string kFlashQuery = |
137 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
138 "npswf32.dll" | 139 "npswf32.dll" |
139 #elif defined(OS_MACOSX) | 140 #elif defined(OS_MACOSX) |
140 "Flash Player.plugin" | 141 "Flash Player.plugin" |
141 #elif defined(OS_POSIX) | 142 #elif defined(OS_POSIX) |
142 "libflashplayer.so" | 143 "libflashplayer.so" |
143 #endif | 144 #endif |
144 ; | 145 ; |
145 TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false); | 146 TestPlugin("flash.html?" + kFlashQuery, |
| 147 TestTimeouts::action_max_timeout_ms(), false); |
146 } | 148 } |
147 | 149 |
148 class ClickToPlayPluginTest : public PluginTest { | 150 class ClickToPlayPluginTest : public PluginTest { |
149 public: | 151 public: |
150 ClickToPlayPluginTest() { | 152 ClickToPlayPluginTest() { |
151 dom_automation_enabled_ = true; | 153 dom_automation_enabled_ = true; |
152 } | 154 } |
153 }; | 155 }; |
154 | 156 |
155 // http://crbug.com/68303 | 157 // http://crbug.com/68303 |
156 #if defined(OS_MACOSX) | 158 #if defined(OS_MACOSX) |
157 TEST_F(ClickToPlayPluginTest, DISABLED_Flash) { | 159 TEST_F(ClickToPlayPluginTest, DISABLED_Flash) { |
158 #else | 160 #else |
159 TEST_F(ClickToPlayPluginTest, Flash) { | 161 TEST_F(ClickToPlayPluginTest, Flash) { |
160 #endif | 162 #endif |
161 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 163 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
162 ASSERT_TRUE(browser.get()); | 164 ASSERT_TRUE(browser.get()); |
163 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 165 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
164 CONTENT_SETTING_BLOCK)); | 166 CONTENT_SETTING_BLOCK)); |
165 | 167 |
166 GURL url = GetTestUrl("flash-clicktoplay.html", true); | 168 GURL url = GetTestUrl("flash-clicktoplay.html", true); |
167 NavigateToURL(url); | 169 NavigateToURL(url); |
168 | 170 |
169 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 171 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
170 ASSERT_TRUE(tab.get()); | 172 ASSERT_TRUE(tab.get()); |
171 | 173 |
172 ASSERT_TRUE(tab->LoadBlockedPlugins()); | 174 ASSERT_TRUE(tab->LoadBlockedPlugins()); |
173 | 175 |
174 WaitForFinish(action_max_timeout_ms(), true); | 176 WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); |
175 } | 177 } |
176 | 178 |
177 // http://crbug.com/68303 | 179 // http://crbug.com/68303 |
178 #if defined(OS_MACOSX) | 180 #if defined(OS_MACOSX) |
179 TEST_F(ClickToPlayPluginTest, DISABLED_FlashDocument) { | 181 TEST_F(ClickToPlayPluginTest, DISABLED_FlashDocument) { |
180 #else | 182 #else |
181 TEST_F(ClickToPlayPluginTest, FlashDocument) { | 183 TEST_F(ClickToPlayPluginTest, FlashDocument) { |
182 #endif | 184 #endif |
183 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 185 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
184 ASSERT_TRUE(browser.get()); | 186 ASSERT_TRUE(browser.get()); |
185 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 187 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
186 CONTENT_SETTING_BLOCK)); | 188 CONTENT_SETTING_BLOCK)); |
187 | 189 |
188 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 190 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
189 ASSERT_TRUE(tab.get()); | 191 ASSERT_TRUE(tab.get()); |
190 GURL url = GetTestUrl("js-invoker.swf?callback=done", true); | 192 GURL url = GetTestUrl("js-invoker.swf?callback=done", true); |
191 NavigateToURL(url); | 193 NavigateToURL(url); |
192 | 194 |
193 // Inject the callback function into the HTML page generated by the browser. | 195 // Inject the callback function into the HTML page generated by the browser. |
194 ASSERT_TRUE(tab->ExecuteJavaScript("window.done = function() {" | 196 ASSERT_TRUE(tab->ExecuteJavaScript("window.done = function() {" |
195 " window.location = \"done.html\";" | 197 " window.location = \"done.html\";" |
196 "}")); | 198 "}")); |
197 | 199 |
198 ASSERT_TRUE(tab->LoadBlockedPlugins()); | 200 ASSERT_TRUE(tab->LoadBlockedPlugins()); |
199 | 201 |
200 WaitForFinish(action_max_timeout_ms(), true); | 202 WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); |
201 } | 203 } |
202 | 204 |
203 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
204 // Windows only test | 206 // Windows only test |
205 TEST_F(PluginTest, DISABLED_FlashSecurity) { | 207 TEST_F(PluginTest, DISABLED_FlashSecurity) { |
206 TestPlugin("flash.html", action_max_timeout_ms(), false); | 208 TestPlugin("flash.html", TestTimeouts::action_max_timeout_ms(), false); |
207 } | 209 } |
208 #endif // defined(OS_WIN) | 210 #endif // defined(OS_WIN) |
209 | 211 |
210 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
211 // TODO(port) Port the following tests to platforms that have the required | 213 // TODO(port) Port the following tests to platforms that have the required |
212 // plugins. | 214 // plugins. |
213 // Flaky: http://crbug.com/55915 | 215 // Flaky: http://crbug.com/55915 |
214 TEST_F(PluginTest, FLAKY_Quicktime) { | 216 TEST_F(PluginTest, FLAKY_Quicktime) { |
215 TestPlugin("quicktime.html", action_max_timeout_ms(), false); | 217 TestPlugin("quicktime.html", TestTimeouts::action_max_timeout_ms(), false); |
216 } | 218 } |
217 | 219 |
218 // Disabled - http://crbug.com/44662 | 220 // Disabled - http://crbug.com/44662 |
219 TEST_F(PluginTest, DISABLED_MediaPlayerNew) { | 221 TEST_F(PluginTest, DISABLED_MediaPlayerNew) { |
220 TestPlugin("wmp_new.html", action_max_timeout_ms(), false); | 222 TestPlugin("wmp_new.html", TestTimeouts::action_max_timeout_ms(), false); |
221 } | 223 } |
222 | 224 |
223 // http://crbug.com/4809 | 225 // http://crbug.com/4809 |
224 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { | 226 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { |
225 TestPlugin("wmp_old.html", action_max_timeout_ms(), false); | 227 TestPlugin("wmp_old.html", TestTimeouts::action_max_timeout_ms(), false); |
226 } | 228 } |
227 | 229 |
228 // Disabled - http://crbug.com/44673 | 230 // Disabled - http://crbug.com/44673 |
229 TEST_F(PluginTest, DISABLED_Real) { | 231 TEST_F(PluginTest, DISABLED_Real) { |
230 TestPlugin("real.html", action_max_timeout_ms(), false); | 232 TestPlugin("real.html", TestTimeouts::action_max_timeout_ms(), false); |
231 } | 233 } |
232 | 234 |
233 TEST_F(PluginTest, FlashOctetStream) { | 235 TEST_F(PluginTest, FlashOctetStream) { |
234 TestPlugin("flash-octet-stream.html", action_max_timeout_ms(), false); | 236 TestPlugin("flash-octet-stream.html", |
| 237 TestTimeouts::action_max_timeout_ms(), false); |
235 } | 238 } |
236 | 239 |
237 #if defined(OS_WIN) | 240 #if defined(OS_WIN) |
238 // http://crbug.com/53926 | 241 // http://crbug.com/53926 |
239 TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { | 242 TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { |
240 #else | 243 #else |
241 TEST_F(PluginTest, FlashLayoutWhilePainting) { | 244 TEST_F(PluginTest, FlashLayoutWhilePainting) { |
242 #endif | 245 #endif |
243 TestPlugin("flash-layout-while-painting.html", action_max_timeout_ms(), true); | 246 TestPlugin("flash-layout-while-painting.html", |
| 247 TestTimeouts::action_max_timeout_ms(), true); |
244 } | 248 } |
245 | 249 |
246 // http://crbug.com/8690 | 250 // http://crbug.com/8690 |
247 TEST_F(PluginTest, DISABLED_Java) { | 251 TEST_F(PluginTest, DISABLED_Java) { |
248 TestPlugin("Java.html", action_max_timeout_ms(), false); | 252 TestPlugin("Java.html", TestTimeouts::action_max_timeout_ms(), false); |
249 } | 253 } |
250 | 254 |
251 TEST_F(PluginTest, Silverlight) { | 255 TEST_F(PluginTest, Silverlight) { |
252 TestPlugin("silverlight.html", action_max_timeout_ms(), false); | 256 TestPlugin("silverlight.html", TestTimeouts::action_max_timeout_ms(), false); |
253 } | 257 } |
254 | 258 |
255 // This class provides functionality to test the plugin installer download | 259 // This class provides functionality to test the plugin installer download |
256 // file functionality. | 260 // file functionality. |
257 class PluginInstallerDownloadTest | 261 class PluginInstallerDownloadTest |
258 : public PluginDownloadUrlHelper::DownloadDelegate, | 262 : public PluginDownloadUrlHelper::DownloadDelegate, |
259 public testing::Test { | 263 public testing::Test { |
260 public: | 264 public: |
261 // This class provides HTTP request context information for the downloads. | 265 // This class provides HTTP request context information for the downloads. |
262 class UploadRequestContext : public net::URLRequestContext { | 266 class UploadRequestContext : public net::URLRequestContext { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { | 365 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { |
362 MessageLoop loop(MessageLoop::TYPE_IO); | 366 MessageLoop loop(MessageLoop::TYPE_IO); |
363 Start(); | 367 Start(); |
364 loop.Run(); | 368 loop.Run(); |
365 | 369 |
366 EXPECT_TRUE(success()); | 370 EXPECT_TRUE(success()); |
367 EXPECT_TRUE(initial_download_path().BaseName().value() == | 371 EXPECT_TRUE(initial_download_path().BaseName().value() == |
368 final_download_path().BaseName().value()); | 372 final_download_path().BaseName().value()); |
369 } | 373 } |
370 #endif // defined(OS_WIN) | 374 #endif // defined(OS_WIN) |
OLD | NEW |