Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/plugin_browsertest.cc

Issue 10389111: Convert the remaining plugin_tests from ui_tests to browser_tests. Also remove the remaining refere… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Don't run if the test data isn't there (since it's not public) Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/simple.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/path_service.h" 6 #include "base/path_service.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/test/net/url_request_mock_http_job.h" 13 #include "content/test/net/url_request_mock_http_job.h"
14 #include "webkit/plugins/plugin_switches.h"
15
16 #if defined(OS_WIN)
17 #include "base/win/registry.h"
18 #endif
14 19
15 using content::BrowserThread; 20 using content::BrowserThread;
16 21
17 namespace { 22 namespace {
18 23
19 void SetUrlRequestMock(const FilePath& path) { 24 void SetUrlRequestMock(const FilePath& path) {
20 URLRequestMockHTTPJob::AddUrlHandler(path); 25 URLRequestMockHTTPJob::AddUrlHandler(path);
21 } 26 }
22 27
23 } 28 }
24 29
25 class PluginTest : public InProcessBrowserTest { 30 class PluginTest : public InProcessBrowserTest {
26 protected: 31 protected:
27 PluginTest() {} 32 PluginTest() {}
28 33
29 virtual void SetUpCommandLine(CommandLine* command_line) { 34 virtual void SetUpCommandLine(CommandLine* command_line) {
30 // Some NPAPI tests schedule garbage collection to force object tear-down. 35 // Some NPAPI tests schedule garbage collection to force object tear-down.
31 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc"); 36 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
32 // For OpenPopupWindowWithPlugin. 37 // For OpenPopupWindowWithPlugin.
33 command_line->AppendSwitch(switches::kDisablePopupBlocking); 38 command_line->AppendSwitch(switches::kDisablePopupBlocking);
34 #if defined(OS_MACOSX) 39 #if defined(OS_WIN)
40 const testing::TestInfo* const test_info =
41 testing::UnitTest::GetInstance()->current_test_info();
42 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
43 // The installer adds our process names to the registry key below. Since
44 // the installer might not have run on this machine, add it manually.
45 base::win::RegKey regkey;
46 if (regkey.Open(HKEY_LOCAL_MACHINE,
47 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList",
48 KEY_WRITE) == ERROR_SUCCESS) {
49 regkey.CreateKey(L"BROWSER_TESTS.EXE", KEY_READ);
50 }
51 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) {
52 // When testing the old WMP plugin, we need to force Chrome to not load
53 // the new plugin.
54 command_line->AppendSwitch(switches::kUseOldWMPPlugin);
55 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) {
56 command_line->AppendSwitchASCII(switches::kTestSandbox,
57 "security_tests.dll");
58 }
59 #elif defined(OS_MACOSX)
35 FilePath plugin_dir; 60 FilePath plugin_dir;
36 PathService::Get(base::DIR_MODULE, &plugin_dir); 61 PathService::Get(base::DIR_MODULE, &plugin_dir);
37 plugin_dir = plugin_dir.AppendASCII("plugins"); 62 plugin_dir = plugin_dir.AppendASCII("plugins");
38 // The plugins directory isn't read by default on the Mac, so it needs to be 63 // The plugins directory isn't read by default on the Mac, so it needs to be
39 // explicitly registered. 64 // explicitly registered.
40 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir); 65 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir);
41 #endif 66 #endif
67
68 // TODO(jam): since these plugin tests are running under Chrome, we need to
69 // tell it to disable its security features for old plugins. Once this is
70 // running under content_browsertests, these flags won't be needed.
71 // http://crbug.com/90448
72 // switches::kAllowOutdatedPlugins
73 command_line->AppendSwitch("allow-outdated-plugins");
74 // switches::kAlwaysAuthorizePlugins
75 command_line->AppendSwitch("always-authorize-plugins");
42 } 76 }
43 77
44 virtual void SetUpOnMainThread() OVERRIDE { 78 virtual void SetUpOnMainThread() OVERRIDE {
45 FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath()); 79 FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath());
46 BrowserThread::PostTask( 80 BrowserThread::PostTask(
47 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); 81 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
48 } 82 }
49 83
50 void LoadAndWait(const GURL& url, const char* title) { 84 void LoadAndWait(const GURL& url) {
51 string16 expected_title(ASCIIToUTF16(title)); 85 string16 expected_title(ASCIIToUTF16("OK"));
52 ui_test_utils::TitleWatcher title_watcher( 86 ui_test_utils::TitleWatcher title_watcher(
53 browser()->GetSelectedWebContents(), expected_title); 87 browser()->GetSelectedWebContents(), expected_title);
54 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 88 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
89 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found"));
55 ui_test_utils::NavigateToURL(browser(), url); 90 ui_test_utils::NavigateToURL(browser(), url);
56 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 91 string16 title = title_watcher.WaitAndGetTitle();
92 if (title == ASCIIToUTF16("plugin_not_found")) {
93 const testing::TestInfo* const test_info =
94 testing::UnitTest::GetInstance()->current_test_info();
95 LOG(INFO) << "PluginTest." << test_info->name() <<
96 " not running because plugin not installed.";
97 } else {
98 EXPECT_EQ(expected_title, title);
99 }
57 } 100 }
58 101
59 GURL GetURL(const char* filename) { 102 GURL GetURL(const char* filename) {
60 return ui_test_utils::GetTestUrl( 103 return ui_test_utils::GetTestUrl(
61 FilePath().AppendASCII("npapi"), FilePath().AppendASCII(filename)); 104 FilePath().AppendASCII("npapi"), FilePath().AppendASCII(filename));
62 } 105 }
63 106
64 void NavigateAway() { 107 void NavigateAway() {
65 GURL url = ui_test_utils::GetTestUrl( 108 GURL url = ui_test_utils::GetTestUrl(
66 FilePath(), FilePath().AppendASCII("simple.html")); 109 FilePath(), FilePath().AppendASCII("simple.html"));
67 LoadAndWait(url, "simple.html"); 110 LoadAndWait(url);
111 }
112
113 void TestPlugin(const char* filename) {
114 FilePath path = ui_test_utils::GetTestFilePath(
115 FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename));
116 if (!file_util::PathExists(path)) {
117 const testing::TestInfo* const test_info =
118 testing::UnitTest::GetInstance()->current_test_info();
119 LOG(INFO) << "PluginTest." << test_info->name() <<
120 " not running because test data wasn't found.";
121 return;
122 }
123
124 GURL url = ui_test_utils::GetTestUrl(
125 FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename));
126 LoadAndWait(url);
68 } 127 }
69 }; 128 };
70 129
71 // Make sure that navigating away from a plugin referenced by JS doesn't 130 // Make sure that navigating away from a plugin referenced by JS doesn't
72 // crash. 131 // crash.
73 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) { 132 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) {
74 LoadAndWait(GetURL("layout_test_plugin.html"), "Layout Test Plugin Test"); 133 LoadAndWait(GetURL("layout_test_plugin.html"));
75 NavigateAway(); 134 NavigateAway();
76 } 135 }
77 136
78 // Tests if a plugin executing a self deleting script using NPN_GetURL 137 // Tests if a plugin executing a self deleting script using NPN_GetURL
79 // works without crashing or hanging 138 // works without crashing or hanging
80 // Flaky: http://crbug.com/59327 139 // Flaky: http://crbug.com/59327
81 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) { 140 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) {
82 LoadAndWait(GetURL("self_delete_plugin_geturl.html"), "OK"); 141 LoadAndWait(GetURL("self_delete_plugin_geturl.html"));
83 } 142 }
84 143
85 // Tests if a plugin executing a self deleting script using Invoke 144 // Tests if a plugin executing a self deleting script using Invoke
86 // works without crashing or hanging 145 // works without crashing or hanging
87 // Flaky. See http://crbug.com/30702 146 // Flaky. See http://crbug.com/30702
88 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) { 147 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) {
89 LoadAndWait(GetURL("self_delete_plugin_invoke.html"), "OK"); 148 LoadAndWait(GetURL("self_delete_plugin_invoke.html"));
90 } 149 }
91 150
92 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) { 151 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) {
93 ui_test_utils::NavigateToURL( 152 ui_test_utils::NavigateToURL(
94 browser(), GetURL("npobject_released_on_destruction.html")); 153 browser(), GetURL("npobject_released_on_destruction.html"));
95 NavigateAway(); 154 NavigateAway();
96 } 155 }
97 156
98 // Test that a dialog is properly created when a plugin throws an 157 // Test that a dialog is properly created when a plugin throws an
99 // exception. Should be run for in and out of process plugins, but 158 // exception. Should be run for in and out of process plugins, but
100 // the more interesting case is out of process, where we must route 159 // the more interesting case is out of process, where we must route
101 // the exception to the correct renderer. 160 // the exception to the correct renderer.
102 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) { 161 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) {
103 LoadAndWait(GetURL("npobject_set_exception.html"), "OK"); 162 LoadAndWait(GetURL("npobject_set_exception.html"));
104 } 163 }
105 164
106 #if defined(OS_WIN) 165 #if defined(OS_WIN)
107 // Tests if a plugin executing a self deleting script in the context of 166 // Tests if a plugin executing a self deleting script in the context of
108 // a synchronous mouseup works correctly. 167 // a synchronous mouseup works correctly.
109 // This was never ported to Mac. The only thing remaining is to make 168 // This was never ported to Mac. The only thing remaining is to make
110 // ui_test_utils::SimulateMouseClick get to Mac plugins, currently it doesn't 169 // ui_test_utils::SimulateMouseClick get to Mac plugins, currently it doesn't
111 // work. 170 // work.
112 IN_PROC_BROWSER_TEST_F(PluginTest, 171 IN_PROC_BROWSER_TEST_F(PluginTest,
113 SelfDeletePluginInvokeInSynchronousMouseUp) { 172 SelfDeletePluginInvokeInSynchronousMouseUp) {
114 ui_test_utils::NavigateToURL( 173 ui_test_utils::NavigateToURL(
115 browser(), GetURL("execute_script_delete_in_mouse_up.html")); 174 browser(), GetURL("execute_script_delete_in_mouse_up.html"));
116 175
117 string16 expected_title(ASCIIToUTF16("OK")); 176 string16 expected_title(ASCIIToUTF16("OK"));
118 ui_test_utils::TitleWatcher title_watcher( 177 ui_test_utils::TitleWatcher title_watcher(
119 browser()->GetSelectedWebContents(), expected_title); 178 browser()->GetSelectedWebContents(), expected_title);
120 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 179 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
121 ui_test_utils::SimulateMouseClick(browser()->GetSelectedWebContents()); 180 ui_test_utils::SimulateMouseClick(browser()->GetSelectedWebContents());
122 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 181 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
123 } 182 }
124 #endif 183 #endif
125 184
126 // Flaky, http://crbug.com/60071. 185 // Flaky, http://crbug.com/60071.
127 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) { 186 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) {
128 GURL url(URLRequestMockHTTPJob::GetMockUrl( 187 GURL url(URLRequestMockHTTPJob::GetMockUrl(
129 FilePath().AppendASCII("npapi"). 188 FilePath().AppendASCII("npapi").
130 AppendASCII("plugin_url_request_404.html"))); 189 AppendASCII("plugin_url_request_404.html")));
131 LoadAndWait(url, "OK"); 190 LoadAndWait(url);
132 } 191 }
133 192
134 // Tests if a plugin executing a self deleting script using Invoke with 193 // Tests if a plugin executing a self deleting script using Invoke with
135 // a modal dialog showing works without crashing or hanging 194 // a modal dialog showing works without crashing or hanging
136 // Disabled, flakily exceeds timeout, http://crbug.com/46257. 195 // Disabled, flakily exceeds timeout, http://crbug.com/46257.
137 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) { 196 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) {
138 // Navigate asynchronously because if we waitd until it completes, there's a 197 // Navigate asynchronously because if we waitd until it completes, there's a
139 // race condition where the alert can come up before we start watching for it. 198 // race condition where the alert can come up before we start watching for it.
140 ui_test_utils::NavigateToURLWithDisposition( 199 ui_test_utils::NavigateToURLWithDisposition(
141 browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB, 200 browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB,
142 0); 201 0);
143 202
144 string16 expected_title(ASCIIToUTF16("OK")); 203 string16 expected_title(ASCIIToUTF16("OK"));
145 ui_test_utils::TitleWatcher title_watcher( 204 ui_test_utils::TitleWatcher title_watcher(
146 browser()->GetSelectedWebContents(), expected_title); 205 browser()->GetSelectedWebContents(), expected_title);
147 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 206 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
148 207
149 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 208 ui_test_utils::WaitForAppModalDialogAndCloseIt();
150 209
151 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 210 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
152 } 211 }
153 212
154 // Test passing arguments to a plugin. 213 // Test passing arguments to a plugin.
155 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) { 214 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) {
156 LoadAndWait(GetURL("arguments.html"), "OK"); 215 LoadAndWait(GetURL("arguments.html"));
157 } 216 }
158 217
159 // Test invoking many plugins within a single page. 218 // Test invoking many plugins within a single page.
160 IN_PROC_BROWSER_TEST_F(PluginTest, ManyPlugins) { 219 IN_PROC_BROWSER_TEST_F(PluginTest, ManyPlugins) {
161 LoadAndWait(GetURL("many_plugins.html"), "OK"); 220 LoadAndWait(GetURL("many_plugins.html"));
162 } 221 }
163 222
164 // Test various calls to GetURL from a plugin. 223 // Test various calls to GetURL from a plugin.
165 IN_PROC_BROWSER_TEST_F(PluginTest, GetURL) { 224 IN_PROC_BROWSER_TEST_F(PluginTest, GetURL) {
166 LoadAndWait(GetURL("geturl.html"), "OK"); 225 LoadAndWait(GetURL("geturl.html"));
167 } 226 }
168 227
169 // Test various calls to GetURL for javascript URLs with 228 // Test various calls to GetURL for javascript URLs with
170 // non NULL targets from a plugin. 229 // non NULL targets from a plugin.
171 IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL) { 230 IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL) {
172 LoadAndWait(GetURL("get_javascript_url.html"), "OK"); 231 LoadAndWait(GetURL("get_javascript_url.html"));
173 } 232 }
174 233
175 // Test that calling GetURL with a javascript URL and target=_self 234 // Test that calling GetURL with a javascript URL and target=_self
176 // works properly when the plugin is embedded in a subframe. 235 // works properly when the plugin is embedded in a subframe.
177 IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL2) { 236 IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL2) {
178 LoadAndWait(GetURL("get_javascript_url2.html"), "OK"); 237 LoadAndWait(GetURL("get_javascript_url2.html"));
179 } 238 }
180 239
181 // Test is flaky on linux/cros/win builders. http://crbug.com/71904 240 // Test is flaky on linux/cros/win builders. http://crbug.com/71904
182 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRedirectNotification) { 241 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRedirectNotification) {
183 LoadAndWait(GetURL("geturl_redirect_notify.html"), "OK"); 242 LoadAndWait(GetURL("geturl_redirect_notify.html"));
184 } 243 }
185 244
186 // Tests that identity is preserved for NPObjects passed from a plugin 245 // Tests that identity is preserved for NPObjects passed from a plugin
187 // into JavaScript. 246 // into JavaScript.
188 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectIdentity) { 247 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectIdentity) {
189 LoadAndWait(GetURL("npobject_identity.html"), "OK"); 248 LoadAndWait(GetURL("npobject_identity.html"));
190 } 249 }
191 250
192 // Tests that if an NPObject is proxies back to its original process, the 251 // Tests that if an NPObject is proxies back to its original process, the
193 // original pointer is returned and not a proxy. If this fails the plugin 252 // original pointer is returned and not a proxy. If this fails the plugin
194 // will crash. 253 // will crash.
195 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectProxy) { 254 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectProxy) {
196 LoadAndWait(GetURL("npobject_proxy.html"), "OK"); 255 LoadAndWait(GetURL("npobject_proxy.html"));
197 } 256 }
198 257
199 #if defined(OS_WIN) || defined(OS_MACOSX) 258 #if defined(OS_WIN) || defined(OS_MACOSX)
200 // Tests if a plugin executing a self deleting script in the context of 259 // Tests if a plugin executing a self deleting script in the context of
201 // a synchronous paint event works correctly 260 // a synchronous paint event works correctly
202 // http://crbug.com/44960 261 // http://crbug.com/44960
203 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeInSynchronousPaint) { 262 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeInSynchronousPaint) {
204 LoadAndWait(GetURL("execute_script_delete_in_paint.html"), "OK"); 263 LoadAndWait(GetURL("execute_script_delete_in_paint.html"));
205 } 264 }
206 #endif 265 #endif
207 266
208 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNewStream) { 267 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNewStream) {
209 LoadAndWait(GetURL("self_delete_plugin_stream.html"), "OK"); 268 LoadAndWait(GetURL("self_delete_plugin_stream.html"));
210 } 269 }
211 270
212 // This test asserts on Mac in plugin_host in the NPNVWindowNPObject case. 271 // This test asserts on Mac in plugin_host in the NPNVWindowNPObject case.
213 #if !(defined(OS_MACOSX) && !defined(NDEBUG)) 272 #if !(defined(OS_MACOSX) && !defined(NDEBUG))
214 // If this test flakes use http://crbug.com/95558. 273 // If this test flakes use http://crbug.com/95558.
215 IN_PROC_BROWSER_TEST_F(PluginTest, DeletePluginInDeallocate) { 274 IN_PROC_BROWSER_TEST_F(PluginTest, DeletePluginInDeallocate) {
216 LoadAndWait(GetURL("plugin_delete_in_deallocate.html"), "OK"); 275 LoadAndWait(GetURL("plugin_delete_in_deallocate.html"));
217 } 276 }
218 #endif 277 #endif
219 278
220 #if defined(OS_WIN) 279 #if defined(OS_WIN)
221 280
222 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyPluginWindowRect) { 281 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyPluginWindowRect) {
223 LoadAndWait(GetURL("verify_plugin_window_rect.html"), "OK"); 282 LoadAndWait(GetURL("verify_plugin_window_rect.html"));
224 } 283 }
225 284
226 // Tests that creating a new instance of a plugin while another one is handling 285 // Tests that creating a new instance of a plugin while another one is handling
227 // a paint message doesn't cause deadlock. 286 // a paint message doesn't cause deadlock.
228 IN_PROC_BROWSER_TEST_F(PluginTest, CreateInstanceInPaint) { 287 IN_PROC_BROWSER_TEST_F(PluginTest, CreateInstanceInPaint) {
229 LoadAndWait(GetURL("create_instance_in_paint.html"), "OK"); 288 LoadAndWait(GetURL("create_instance_in_paint.html"));
230 } 289 }
231 290
232 // Tests that putting up an alert in response to a paint doesn't deadlock. 291 // Tests that putting up an alert in response to a paint doesn't deadlock.
233 IN_PROC_BROWSER_TEST_F(PluginTest, AlertInWindowMessage) { 292 IN_PROC_BROWSER_TEST_F(PluginTest, AlertInWindowMessage) {
234 ui_test_utils::NavigateToURL( 293 ui_test_utils::NavigateToURL(
235 browser(), GetURL("alert_in_window_message.html")); 294 browser(), GetURL("alert_in_window_message.html"));
236 295
237 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 296 ui_test_utils::WaitForAppModalDialogAndCloseIt();
238 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 297 ui_test_utils::WaitForAppModalDialogAndCloseIt();
239 } 298 }
240 299
241 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) { 300 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) {
242 LoadAndWait(GetURL("npobject_lifetime_test.html"), "OK"); 301 LoadAndWait(GetURL("npobject_lifetime_test.html"));
243 } 302 }
244 303
245 // Tests that we don't crash or assert if NPP_New fails 304 // Tests that we don't crash or assert if NPP_New fails
246 IN_PROC_BROWSER_TEST_F(PluginTest, NewFails) { 305 IN_PROC_BROWSER_TEST_F(PluginTest, NewFails) {
247 LoadAndWait(GetURL("new_fails.html"), "OK"); 306 LoadAndWait(GetURL("new_fails.html"));
248 } 307 }
249 308
250 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNPNEvaluate) { 309 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNPNEvaluate) {
251 LoadAndWait(GetURL("execute_script_delete_in_npn_evaluate.html"), "OK"); 310 LoadAndWait(GetURL("execute_script_delete_in_npn_evaluate.html"));
252 } 311 }
253 312
254 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeleteCreatePluginInNPNEvaluate) { 313 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeleteCreatePluginInNPNEvaluate) {
255 LoadAndWait(GetURL("npn_plugin_delete_create_in_evaluate.html"), "OK"); 314 LoadAndWait(GetURL("npn_plugin_delete_create_in_evaluate.html"));
256 } 315 }
257 316
258 #endif // OS_WIN 317 #endif // OS_WIN
259 318
260 // If this flakes, reopen http://crbug.com/17645 319 // If this flakes, reopen http://crbug.com/17645
261 // As of 6 July 2011, this test is flaky on Windows (perhaps due to timing out). 320 // As of 6 July 2011, this test is flaky on Windows (perhaps due to timing out).
262 #if !defined(OS_MACOSX) 321 #if !defined(OS_MACOSX)
263 // Disabled on Mac because the plugin side isn't implemented yet, see 322 // Disabled on Mac because the plugin side isn't implemented yet, see
264 // "TODO(port)" in plugin_javascript_open_popup.cc. 323 // "TODO(port)" in plugin_javascript_open_popup.cc.
265 IN_PROC_BROWSER_TEST_F(PluginTest, OpenPopupWindowWithPlugin) { 324 IN_PROC_BROWSER_TEST_F(PluginTest, OpenPopupWindowWithPlugin) {
266 LoadAndWait(GetURL("get_javascript_open_popup_with_plugin.html"), "OK"); 325 LoadAndWait(GetURL("get_javascript_open_popup_with_plugin.html"));
267 } 326 }
268 #endif 327 #endif
269 328
270 // Test checking the privacy mode is off. 329 // Test checking the privacy mode is off.
271 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateDisabled) { 330 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateDisabled) {
272 LoadAndWait(GetURL("private.html"), "OK"); 331 LoadAndWait(GetURL("private.html"));
273 } 332 }
274 333
275 IN_PROC_BROWSER_TEST_F(PluginTest, ScheduleTimer) { 334 IN_PROC_BROWSER_TEST_F(PluginTest, ScheduleTimer) {
276 LoadAndWait(GetURL("schedule_timer.html"), "OK"); 335 LoadAndWait(GetURL("schedule_timer.html"));
277 } 336 }
278 337
279 IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) { 338 IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) {
280 LoadAndWait(GetURL("plugin_thread_async_call.html"), "OK"); 339 LoadAndWait(GetURL("plugin_thread_async_call.html"));
281 } 340 }
282 341
283 // Test checking the privacy mode is on. 342 // Test checking the privacy mode is on.
284 // If this flakes on Linux, use http://crbug.com/104380 343 // If this flakes on Linux, use http://crbug.com/104380
285 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) { 344 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) {
286 LoadAndWait(GetURL("private.html"), "OK"); 345 LoadAndWait(GetURL("private.html"));
287 } 346 }
288 347
289 #if defined(OS_WIN) || defined(OS_MACOSX) 348 #if defined(OS_WIN) || defined(OS_MACOSX)
290 // Test a browser hang due to special case of multiple 349 // Test a browser hang due to special case of multiple
291 // plugin instances indulged in sync calls across renderer. 350 // plugin instances indulged in sync calls across renderer.
292 IN_PROC_BROWSER_TEST_F(PluginTest, MultipleInstancesSyncCalls) { 351 IN_PROC_BROWSER_TEST_F(PluginTest, MultipleInstancesSyncCalls) {
293 LoadAndWait(GetURL("multiple_instances_sync_calls.html"), "OK"); 352 LoadAndWait(GetURL("multiple_instances_sync_calls.html"));
294 } 353 }
295 #endif 354 #endif
296 355
297 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequestFailWrite) { 356 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequestFailWrite) {
298 GURL url(URLRequestMockHTTPJob::GetMockUrl( 357 GURL url(URLRequestMockHTTPJob::GetMockUrl(
299 FilePath().AppendASCII("npapi"). 358 FilePath().AppendASCII("npapi").
300 AppendASCII("plugin_url_request_fail_write.html"))); 359 AppendASCII("plugin_url_request_fail_write.html")));
301 LoadAndWait(url, "OK"); 360 LoadAndWait(url);
302 } 361 }
303 362
304 #if defined(OS_WIN) 363 #if defined(OS_WIN)
305 IN_PROC_BROWSER_TEST_F(PluginTest, EnsureScriptingWorksInDestroy) { 364 IN_PROC_BROWSER_TEST_F(PluginTest, EnsureScriptingWorksInDestroy) {
306 LoadAndWait(GetURL("ensure_scripting_works_in_destroy.html"), "OK"); 365 LoadAndWait(GetURL("ensure_scripting_works_in_destroy.html"));
307 } 366 }
308 367
309 // This test uses a Windows Event to signal to the plugin that it should crash 368 // This test uses a Windows Event to signal to the plugin that it should crash
310 // on NP_Initialize. 369 // on NP_Initialize.
311 IN_PROC_BROWSER_TEST_F(PluginTest, NoHangIfInitCrashes) { 370 IN_PROC_BROWSER_TEST_F(PluginTest, NoHangIfInitCrashes) {
312 HANDLE crash_event = CreateEvent(NULL, TRUE, FALSE, L"TestPluginCrashOnInit"); 371 HANDLE crash_event = CreateEvent(NULL, TRUE, FALSE, L"TestPluginCrashOnInit");
313 SetEvent(crash_event); 372 SetEvent(crash_event);
314 LoadAndWait(GetURL("no_hang_if_init_crashes.html"), "OK"); 373 LoadAndWait(GetURL("no_hang_if_init_crashes.html"));
315 CloseHandle(crash_event); 374 CloseHandle(crash_event);
316 } 375 }
317 #endif 376 #endif
318 377
319 // If this flakes on Mac, use http://crbug.com/111508 378 // If this flakes on Mac, use http://crbug.com/111508
320 IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) { 379 IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) {
321 GURL url(URLRequestMockHTTPJob::GetMockUrl( 380 GURL url(URLRequestMockHTTPJob::GetMockUrl(
322 FilePath().AppendASCII("npapi"). 381 FilePath().AppendASCII("npapi").
323 AppendASCII("plugin_url_request_referrer_test.html"))); 382 AppendASCII("plugin_url_request_referrer_test.html")));
324 LoadAndWait(url, "OK"); 383 LoadAndWait(url);
325 } 384 }
326 385
327 #if defined(OS_MACOSX) 386 #if defined(OS_MACOSX)
328 IN_PROC_BROWSER_TEST_F(PluginTest, PluginConvertPointTest) { 387 IN_PROC_BROWSER_TEST_F(PluginTest, PluginConvertPointTest) {
329 gfx::NativeWindow window = NULL; 388 gfx::NativeWindow window = NULL;
330 gfx::Rect bounds(50, 50, 400, 400); 389 gfx::Rect bounds(50, 50, 400, 400);
331 ui_test_utils::GetNativeWindow(browser(), &window); 390 ui_test_utils::GetNativeWindow(browser(), &window);
332 ui_test_utils::SetWindowBounds(window, bounds); 391 ui_test_utils::SetWindowBounds(window, bounds);
333 392
334 ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html")); 393 ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html"));
335 394
336 string16 expected_title(ASCIIToUTF16("OK")); 395 string16 expected_title(ASCIIToUTF16("OK"));
337 ui_test_utils::TitleWatcher title_watcher( 396 ui_test_utils::TitleWatcher title_watcher(
338 browser()->GetSelectedWebContents(), expected_title); 397 browser()->GetSelectedWebContents(), expected_title);
339 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 398 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
340 // TODO(stuartmorgan): When the automation system supports sending clicks, 399 // TODO(stuartmorgan): When the automation system supports sending clicks,
341 // change the test to trigger on mouse-down rather than window focus. 400 // change the test to trigger on mouse-down rather than window focus.
342 static_cast<content::WebContentsDelegate*>(browser())-> 401 static_cast<content::WebContentsDelegate*>(browser())->
343 ActivateContents(browser()->GetSelectedWebContents()); 402 ActivateContents(browser()->GetSelectedWebContents());
344 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 403 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
345 } 404 }
346 #endif 405 #endif
406
407 IN_PROC_BROWSER_TEST_F(PluginTest, Flash) {
408 TestPlugin("flash.html");
409 }
410
411 #if defined(OS_WIN)
412 // Windows only test
413 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_FlashSecurity) {
414 TestPlugin("flash.html");
415 }
416 #endif // defined(OS_WIN)
417
418 #if defined(OS_WIN)
419 // TODO(port) Port the following tests to platforms that have the required
420 // plugins.
421 // Flaky: http://crbug.com/55915
422 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Quicktime) {
423 TestPlugin("quicktime.html");
424 }
425
426 // Disabled - http://crbug.com/44662
427 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_MediaPlayerNew) {
428 TestPlugin("wmp_new.html");
429 }
430
431 // http://crbug.com/4809
432 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_MediaPlayerOld) {
433 TestPlugin("wmp_old.html");
434 }
435
436 // Disabled - http://crbug.com/44673
437 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Real) {
438 TestPlugin("real.html");
439 }
440
441 IN_PROC_BROWSER_TEST_F(PluginTest, FlashOctetStream) {
442 TestPlugin("flash-octet-stream.html");
443 }
444
445 #if defined(OS_WIN)
446 // http://crbug.com/53926
447 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_FlashLayoutWhilePainting) {
448 #else
449 IN_PROC_BROWSER_TEST_F(PluginTest, FlashLayoutWhilePainting) {
450 #endif
451 TestPlugin("flash-layout-while-painting.html");
452 }
453
454 // http://crbug.com/8690
455 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) {
456 TestPlugin("Java.html");
457 }
458
459 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) {
460 TestPlugin("silverlight.html");
461 }
462 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « chrome/test/data/simple.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698