| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Flash plugin in the future? | 133 // Flash plugin in the future? |
| 133 std::string kFlashQuery = | 134 std::string kFlashQuery = |
| 134 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 135 "npswf32.dll" | 136 "npswf32.dll" |
| 136 #elif defined(OS_MACOSX) | 137 #elif defined(OS_MACOSX) |
| 137 "Flash Player.plugin" | 138 "Flash Player.plugin" |
| 138 #elif defined(OS_POSIX) | 139 #elif defined(OS_POSIX) |
| 139 "libflashplayer.so" | 140 "libflashplayer.so" |
| 140 #endif | 141 #endif |
| 141 ; | 142 ; |
| 142 TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false); | 143 TestPlugin("flash.html?" + kFlashQuery, |
| 144 TestTimeouts::action_max_timeout_ms(), false); |
| 143 } | 145 } |
| 144 | 146 |
| 145 class ClickToPlayPluginTest : public PluginTest { | 147 class ClickToPlayPluginTest : public PluginTest { |
| 146 public: | 148 public: |
| 147 ClickToPlayPluginTest() { | 149 ClickToPlayPluginTest() { |
| 148 dom_automation_enabled_ = true; | 150 dom_automation_enabled_ = true; |
| 149 } | 151 } |
| 150 }; | 152 }; |
| 151 | 153 |
| 152 TEST_F(ClickToPlayPluginTest, Flash) { | 154 TEST_F(ClickToPlayPluginTest, Flash) { |
| 153 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 155 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 154 ASSERT_TRUE(browser.get()); | 156 ASSERT_TRUE(browser.get()); |
| 155 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 157 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 156 CONTENT_SETTING_BLOCK)); | 158 CONTENT_SETTING_BLOCK)); |
| 157 | 159 |
| 158 GURL url = GetTestUrl("flash-clicktoplay.html", true); | 160 GURL url = GetTestUrl("flash-clicktoplay.html", true); |
| 159 NavigateToURL(url); | 161 NavigateToURL(url); |
| 160 | 162 |
| 161 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 163 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 162 ASSERT_TRUE(tab.get()); | 164 ASSERT_TRUE(tab.get()); |
| 163 | 165 |
| 164 ASSERT_TRUE(tab->LoadBlockedPlugins()); | 166 ASSERT_TRUE(tab->LoadBlockedPlugins()); |
| 165 | 167 |
| 166 WaitForFinish(action_max_timeout_ms(), true); | 168 WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); |
| 167 } | 169 } |
| 168 | 170 |
| 169 TEST_F(ClickToPlayPluginTest, FlashDocument) { | 171 TEST_F(ClickToPlayPluginTest, FlashDocument) { |
| 170 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 172 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 171 ASSERT_TRUE(browser.get()); | 173 ASSERT_TRUE(browser.get()); |
| 172 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 174 ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 173 CONTENT_SETTING_BLOCK)); | 175 CONTENT_SETTING_BLOCK)); |
| 174 | 176 |
| 175 scoped_refptr<TabProxy> tab(browser->GetTab(0)); | 177 scoped_refptr<TabProxy> tab(browser->GetTab(0)); |
| 176 ASSERT_TRUE(tab.get()); | 178 ASSERT_TRUE(tab.get()); |
| 177 GURL url = GetTestUrl("js-invoker.swf?callback=done", true); | 179 GURL url = GetTestUrl("js-invoker.swf?callback=done", true); |
| 178 NavigateToURL(url); | 180 NavigateToURL(url); |
| 179 | 181 |
| 180 // Inject the callback function into the HTML page generated by the browser. | 182 // Inject the callback function into the HTML page generated by the browser. |
| 181 ASSERT_TRUE(tab->ExecuteJavaScript("window.done = function() {" | 183 ASSERT_TRUE(tab->ExecuteJavaScript("window.done = function() {" |
| 182 " window.location = \"done.html\";" | 184 " window.location = \"done.html\";" |
| 183 "}")); | 185 "}")); |
| 184 | 186 |
| 185 ASSERT_TRUE(tab->LoadBlockedPlugins()); | 187 ASSERT_TRUE(tab->LoadBlockedPlugins()); |
| 186 | 188 |
| 187 WaitForFinish(action_max_timeout_ms(), true); | 189 WaitForFinish(TestTimeouts::action_max_timeout_ms(), true); |
| 188 } | 190 } |
| 189 | 191 |
| 190 #if defined(OS_WIN) | 192 #if defined(OS_WIN) |
| 191 // Windows only test | 193 // Windows only test |
| 192 TEST_F(PluginTest, DISABLED_FlashSecurity) { | 194 TEST_F(PluginTest, DISABLED_FlashSecurity) { |
| 193 TestPlugin("flash.html", action_max_timeout_ms(), false); | 195 TestPlugin("flash.html", TestTimeouts::action_max_timeout_ms(), false); |
| 194 } | 196 } |
| 195 #endif // defined(OS_WIN) | 197 #endif // defined(OS_WIN) |
| 196 | 198 |
| 197 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
| 198 // TODO(port) Port the following tests to platforms that have the required | 200 // TODO(port) Port the following tests to platforms that have the required |
| 199 // plugins. | 201 // plugins. |
| 200 // Flaky: http://crbug.com/55915 | 202 // Flaky: http://crbug.com/55915 |
| 201 TEST_F(PluginTest, FLAKY_Quicktime) { | 203 TEST_F(PluginTest, FLAKY_Quicktime) { |
| 202 TestPlugin("quicktime.html", action_max_timeout_ms(), false); | 204 TestPlugin("quicktime.html", TestTimeouts::action_max_timeout_ms(), false); |
| 203 } | 205 } |
| 204 | 206 |
| 205 // Disabled - http://crbug.com/44662 | 207 // Disabled - http://crbug.com/44662 |
| 206 TEST_F(PluginTest, DISABLED_MediaPlayerNew) { | 208 TEST_F(PluginTest, DISABLED_MediaPlayerNew) { |
| 207 TestPlugin("wmp_new.html", action_max_timeout_ms(), false); | 209 TestPlugin("wmp_new.html", TestTimeouts::action_max_timeout_ms(), false); |
| 208 } | 210 } |
| 209 | 211 |
| 210 // http://crbug.com/4809 | 212 // http://crbug.com/4809 |
| 211 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { | 213 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { |
| 212 TestPlugin("wmp_old.html", action_max_timeout_ms(), false); | 214 TestPlugin("wmp_old.html", TestTimeouts::action_max_timeout_ms(), false); |
| 213 } | 215 } |
| 214 | 216 |
| 215 // Disabled - http://crbug.com/44673 | 217 // Disabled - http://crbug.com/44673 |
| 216 TEST_F(PluginTest, DISABLED_Real) { | 218 TEST_F(PluginTest, DISABLED_Real) { |
| 217 TestPlugin("real.html", action_max_timeout_ms(), false); | 219 TestPlugin("real.html", TestTimeouts::action_max_timeout_ms(), false); |
| 218 } | 220 } |
| 219 | 221 |
| 220 TEST_F(PluginTest, FlashOctetStream) { | 222 TEST_F(PluginTest, FlashOctetStream) { |
| 221 TestPlugin("flash-octet-stream.html", action_max_timeout_ms(), false); | 223 TestPlugin("flash-octet-stream.html", |
| 224 TestTimeouts::action_max_timeout_ms(), false); |
| 222 } | 225 } |
| 223 | 226 |
| 224 #if defined(OS_WIN) | 227 #if defined(OS_WIN) |
| 225 // http://crbug.com/53926 | 228 // http://crbug.com/53926 |
| 226 TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { | 229 TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { |
| 227 #else | 230 #else |
| 228 TEST_F(PluginTest, FlashLayoutWhilePainting) { | 231 TEST_F(PluginTest, FlashLayoutWhilePainting) { |
| 229 #endif | 232 #endif |
| 230 TestPlugin("flash-layout-while-painting.html", action_max_timeout_ms(), true); | 233 TestPlugin("flash-layout-while-painting.html", |
| 234 TestTimeouts::action_max_timeout_ms(), true); |
| 231 } | 235 } |
| 232 | 236 |
| 233 // http://crbug.com/8690 | 237 // http://crbug.com/8690 |
| 234 TEST_F(PluginTest, DISABLED_Java) { | 238 TEST_F(PluginTest, DISABLED_Java) { |
| 235 TestPlugin("Java.html", action_max_timeout_ms(), false); | 239 TestPlugin("Java.html", TestTimeouts::action_max_timeout_ms(), false); |
| 236 } | 240 } |
| 237 | 241 |
| 238 TEST_F(PluginTest, Silverlight) { | 242 TEST_F(PluginTest, Silverlight) { |
| 239 TestPlugin("silverlight.html", action_max_timeout_ms(), false); | 243 TestPlugin("silverlight.html", TestTimeouts::action_max_timeout_ms(), false); |
| 240 } | 244 } |
| 241 | 245 |
| 242 // This class provides functionality to test the plugin installer download | 246 // This class provides functionality to test the plugin installer download |
| 243 // file functionality. | 247 // file functionality. |
| 244 class PluginInstallerDownloadTest | 248 class PluginInstallerDownloadTest |
| 245 : public PluginDownloadUrlHelper::DownloadDelegate, | 249 : public PluginDownloadUrlHelper::DownloadDelegate, |
| 246 public testing::Test { | 250 public testing::Test { |
| 247 public: | 251 public: |
| 248 // This class provides HTTP request context information for the downloads. | 252 // This class provides HTTP request context information for the downloads. |
| 249 class UploadRequestContext : public net::URLRequestContext { | 253 class UploadRequestContext : public net::URLRequestContext { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { | 352 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { |
| 349 MessageLoop loop(MessageLoop::TYPE_IO); | 353 MessageLoop loop(MessageLoop::TYPE_IO); |
| 350 Start(); | 354 Start(); |
| 351 loop.Run(); | 355 loop.Run(); |
| 352 | 356 |
| 353 EXPECT_TRUE(success()); | 357 EXPECT_TRUE(success()); |
| 354 EXPECT_TRUE(initial_download_path().BaseName().value() == | 358 EXPECT_TRUE(initial_download_path().BaseName().value() == |
| 355 final_download_path().BaseName().value()); | 359 final_download_path().BaseName().value()); |
| 356 } | 360 } |
| 357 #endif // defined(OS_WIN) | 361 #endif // defined(OS_WIN) |
| OLD | NEW |