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

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

Issue 10806056: Move plugin_browsertests.cc from browser_tests to content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to mac+win fixes Created 8 years, 4 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
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/file_util.h"
6 #include "base/path_service.h" 7 #include "base/path_service.h"
7 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
13 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
14 #include "content/public/test/browser_test_utils.h" 11 #include "content/public/test/browser_test_utils.h"
12 #include "content/shell/shell.h"
13 #include "content/shell/shell_switches.h"
14 #include "content/test/content_browser_test.h"
15 #include "content/test/content_browser_test_utils.h"
15 #include "content/test/net/url_request_mock_http_job.h" 16 #include "content/test/net/url_request_mock_http_job.h"
17 #include "ui/gfx/rect.h"
16 #include "webkit/plugins/plugin_switches.h" 18 #include "webkit/plugins/plugin_switches.h"
17 19
18 #if defined(OS_WIN) 20 #if defined(OS_WIN)
19 #include "base/win/registry.h" 21 #include "base/win/registry.h"
20 #endif 22 #endif
21 23
22 using content::BrowserThread;
23
24 namespace { 24 namespace {
25 25
26 void SetUrlRequestMock(const FilePath& path) { 26 void SetUrlRequestMock(const FilePath& path) {
27 URLRequestMockHTTPJob::AddUrlHandler(path); 27 URLRequestMockHTTPJob::AddUrlHandler(path);
28 } 28 }
29 29
30 } 30 }
31 31
32 class PluginTest : public InProcessBrowserTest { 32 namespace content {
33
34 class PluginTest : public ContentBrowserTest {
33 protected: 35 protected:
34 PluginTest() {} 36 PluginTest() {}
35 37
36 virtual void SetUpCommandLine(CommandLine* command_line) { 38 virtual void SetUpCommandLine(CommandLine* command_line) {
37 // Some NPAPI tests schedule garbage collection to force object tear-down. 39 // Some NPAPI tests schedule garbage collection to force object tear-down.
38 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc"); 40 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
39 // For OpenPopupWindowWithPlugin. 41
40 command_line->AppendSwitch(switches::kDisablePopupBlocking);
41 #if defined(OS_WIN)
42 const testing::TestInfo* const test_info = 42 const testing::TestInfo* const test_info =
43 testing::UnitTest::GetInstance()->current_test_info(); 43 testing::UnitTest::GetInstance()->current_test_info();
44 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { 44 if (strcmp(test_info->name(), "PrivateEnabled") == 0) {
45 command_line->AppendSwitch(switches::kOffTheRecord);
46 }
47 #if defined(OS_WIN)
48 else if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
45 // The installer adds our process names to the registry key below. Since 49 // The installer adds our process names to the registry key below. Since
46 // the installer might not have run on this machine, add it manually. 50 // the installer might not have run on this machine, add it manually.
47 base::win::RegKey regkey; 51 base::win::RegKey regkey;
48 if (regkey.Open(HKEY_LOCAL_MACHINE, 52 if (regkey.Open(HKEY_LOCAL_MACHINE,
49 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList", 53 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList",
50 KEY_WRITE) == ERROR_SUCCESS) { 54 KEY_WRITE) == ERROR_SUCCESS) {
51 regkey.CreateKey(L"BROWSER_TESTS.EXE", KEY_READ); 55 regkey.CreateKey(L"BROWSER_TESTS.EXE", KEY_READ);
52 } 56 }
53 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) { 57 } else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) {
54 // When testing the old WMP plugin, we need to force Chrome to not load 58 // When testing the old WMP plugin, we need to force Chrome to not load
55 // the new plugin. 59 // the new plugin.
56 command_line->AppendSwitch(switches::kUseOldWMPPlugin); 60 command_line->AppendSwitch(switches::kUseOldWMPPlugin);
57 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) { 61 } else if (strcmp(test_info->name(), "FlashSecurity") == 0) {
58 command_line->AppendSwitchASCII(switches::kTestSandbox, 62 command_line->AppendSwitchASCII(switches::kTestSandbox,
59 "security_tests.dll"); 63 "security_tests.dll");
60 } 64 }
61 #elif defined(OS_MACOSX) 65 #elif defined(OS_MACOSX)
62 FilePath plugin_dir; 66 FilePath plugin_dir;
63 PathService::Get(base::DIR_MODULE, &plugin_dir); 67 PathService::Get(base::DIR_MODULE, &plugin_dir);
64 plugin_dir = plugin_dir.AppendASCII("plugins"); 68 plugin_dir = plugin_dir.AppendASCII("plugins");
65 // The plugins directory isn't read by default on the Mac, so it needs to be 69 // The plugins directory isn't read by default on the Mac, so it needs to be
66 // explicitly registered. 70 // explicitly registered.
67 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir); 71 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir);
68 #endif 72 #endif
69
70 // TODO(jam): since these plugin tests are running under Chrome, we need to
71 // tell it to disable its security features for old plugins. Once this is
72 // running under content_browsertests, these flags won't be needed.
73 // http://crbug.com/90448
74 // switches::kAllowOutdatedPlugins
75 command_line->AppendSwitch("allow-outdated-plugins");
76 // switches::kAlwaysAuthorizePlugins
77 command_line->AppendSwitch("always-authorize-plugins");
78 } 73 }
79 74
80 virtual void SetUpOnMainThread() OVERRIDE { 75 virtual void SetUpOnMainThread() OVERRIDE {
81 FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath()); 76 FilePath path = GetTestFilePath("", "");
82 BrowserThread::PostTask( 77 BrowserThread::PostTask(
83 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); 78 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
84 } 79 }
85 80
86 void LoadAndWait(const GURL& url) { 81 void LoadAndWait(const GURL& url) {
87 string16 expected_title(ASCIIToUTF16("OK")); 82 string16 expected_title(ASCIIToUTF16("OK"));
88 content::TitleWatcher title_watcher( 83 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
89 chrome::GetActiveWebContents(browser()), expected_title);
90 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 84 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
91 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found")); 85 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found"));
92 ui_test_utils::NavigateToURL(browser(), url); 86 NavigateToURL(shell(), url);
93 string16 title = title_watcher.WaitAndGetTitle(); 87 string16 title = title_watcher.WaitAndGetTitle();
94 if (title == ASCIIToUTF16("plugin_not_found")) { 88 if (title == ASCIIToUTF16("plugin_not_found")) {
95 const testing::TestInfo* const test_info = 89 const testing::TestInfo* const test_info =
96 testing::UnitTest::GetInstance()->current_test_info(); 90 testing::UnitTest::GetInstance()->current_test_info();
97 LOG(INFO) << "PluginTest." << test_info->name() << 91 LOG(INFO) << "PluginTest." << test_info->name() <<
98 " not running because plugin not installed."; 92 " not running because plugin not installed.";
99 } else { 93 } else {
100 EXPECT_EQ(expected_title, title); 94 EXPECT_EQ(expected_title, title);
101 } 95 }
102 } 96 }
103 97
104 GURL GetURL(const char* filename) { 98 GURL GetURL(const char* filename) {
105 return ui_test_utils::GetTestUrl( 99 return GetTestUrl("npapi", filename);
106 FilePath().AppendASCII("npapi"), FilePath().AppendASCII(filename));
107 } 100 }
108 101
109 void NavigateAway() { 102 void NavigateAway() {
110 GURL url = ui_test_utils::GetTestUrl( 103 GURL url = GetTestUrl(".", "simple_page.html");
111 FilePath(), FilePath().AppendASCII("simple.html"));
112 LoadAndWait(url); 104 LoadAndWait(url);
113 } 105 }
114 106
115 void TestPlugin(const char* filename) { 107 void TestPlugin(const char* filename) {
116 FilePath path = ui_test_utils::GetTestFilePath( 108 FilePath path = GetTestFilePath("plugin", filename);
117 FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename));
118 if (!file_util::PathExists(path)) { 109 if (!file_util::PathExists(path)) {
119 const testing::TestInfo* const test_info = 110 const testing::TestInfo* const test_info =
120 testing::UnitTest::GetInstance()->current_test_info(); 111 testing::UnitTest::GetInstance()->current_test_info();
121 LOG(INFO) << "PluginTest." << test_info->name() << 112 LOG(INFO) << "PluginTest." << test_info->name() <<
122 " not running because test data wasn't found."; 113 " not running because test data wasn't found.";
123 return; 114 return;
124 } 115 }
125 116
126 GURL url = ui_test_utils::GetTestUrl( 117 GURL url = GetTestUrl("plugin", filename);
127 FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename));
128 LoadAndWait(url); 118 LoadAndWait(url);
129 } 119 }
130 }; 120 };
131 121
132 // Make sure that navigating away from a plugin referenced by JS doesn't 122 // Make sure that navigating away from a plugin referenced by JS doesn't
133 // crash. 123 // crash.
134 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) { 124 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) {
135 LoadAndWait(GetURL("layout_test_plugin.html")); 125 LoadAndWait(GetURL("layout_test_plugin.html"));
136 NavigateAway(); 126 NavigateAway();
137 } 127 }
138 128
139 // Tests if a plugin executing a self deleting script using NPN_GetURL 129 // Tests if a plugin executing a self deleting script using NPN_GetURL
140 // works without crashing or hanging 130 // works without crashing or hanging
141 // Flaky: http://crbug.com/59327 131 // Flaky: http://crbug.com/59327
142 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) { 132 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) {
143 LoadAndWait(GetURL("self_delete_plugin_geturl.html")); 133 LoadAndWait(GetURL("self_delete_plugin_geturl.html"));
144 } 134 }
145 135
146 // Tests if a plugin executing a self deleting script using Invoke 136 // Tests if a plugin executing a self deleting script using Invoke
147 // works without crashing or hanging 137 // works without crashing or hanging
148 // Flaky. See http://crbug.com/30702 138 // Flaky. See http://crbug.com/30702
149 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) { 139 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) {
150 LoadAndWait(GetURL("self_delete_plugin_invoke.html")); 140 LoadAndWait(GetURL("self_delete_plugin_invoke.html"));
151 } 141 }
152 142
153 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) { 143 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) {
154 ui_test_utils::NavigateToURL( 144 NavigateToURL(shell(), GetURL("npobject_released_on_destruction.html"));
155 browser(), GetURL("npobject_released_on_destruction.html"));
156 NavigateAway(); 145 NavigateAway();
157 } 146 }
158 147
159 // Test that a dialog is properly created when a plugin throws an 148 // Test that a dialog is properly created when a plugin throws an
160 // exception. Should be run for in and out of process plugins, but 149 // exception. Should be run for in and out of process plugins, but
161 // the more interesting case is out of process, where we must route 150 // the more interesting case is out of process, where we must route
162 // the exception to the correct renderer. 151 // the exception to the correct renderer.
163 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) { 152 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) {
164 LoadAndWait(GetURL("npobject_set_exception.html")); 153 LoadAndWait(GetURL("npobject_set_exception.html"));
165 } 154 }
166 155
167 #if defined(OS_WIN) 156 #if defined(OS_WIN)
168 // Tests if a plugin executing a self deleting script in the context of 157 // Tests if a plugin executing a self deleting script in the context of
169 // a synchronous mouseup works correctly. 158 // a synchronous mouseup works correctly.
170 // This was never ported to Mac. The only thing remaining is to make 159 // This was never ported to Mac. The only thing remaining is to make
171 // SimulateMouseClick get to Mac plugins, currently it doesn't work. 160 // SimulateMouseClick get to Mac plugins, currently it doesn't work.
172 IN_PROC_BROWSER_TEST_F(PluginTest, 161 IN_PROC_BROWSER_TEST_F(PluginTest,
173 SelfDeletePluginInvokeInSynchronousMouseUp) { 162 SelfDeletePluginInvokeInSynchronousMouseUp) {
174 ui_test_utils::NavigateToURL( 163 NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html"));
175 browser(), GetURL("execute_script_delete_in_mouse_up.html"));
176 164
177 string16 expected_title(ASCIIToUTF16("OK")); 165 string16 expected_title(ASCIIToUTF16("OK"));
178 content::TitleWatcher title_watcher( 166 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
179 chrome::GetActiveWebContents(browser()), expected_title);
180 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 167 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
181 SimulateMouseClick(chrome::GetActiveWebContents(browser())); 168 SimulateMouseClick(shell()->web_contents());
182 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 169 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
183 } 170 }
184 #endif 171 #endif
185 172
186 // Flaky, http://crbug.com/60071. 173 // Flaky, http://crbug.com/60071.
187 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) { 174 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) {
188 GURL url(URLRequestMockHTTPJob::GetMockUrl( 175 GURL url(URLRequestMockHTTPJob::GetMockUrl(
189 FilePath().AppendASCII("npapi"). 176 FilePath().AppendASCII("npapi").
190 AppendASCII("plugin_url_request_404.html"))); 177 AppendASCII("plugin_url_request_404.html")));
191 LoadAndWait(url); 178 LoadAndWait(url);
192 } 179 }
193 180
194 // Tests if a plugin executing a self deleting script using Invoke with 181 // Tests if a plugin executing a self deleting script using Invoke with
195 // a modal dialog showing works without crashing or hanging 182 // a modal dialog showing works without crashing or hanging
196 // Disabled, flakily exceeds timeout, http://crbug.com/46257. 183 // Disabled, flakily exceeds timeout, http://crbug.com/46257.
197 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) { 184 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) {
198 // Navigate asynchronously because if we waitd until it completes, there's a 185 // Navigate asynchronously because if we waitd until it completes, there's a
199 // race condition where the alert can come up before we start watching for it. 186 // race condition where the alert can come up before we start watching for it.
200 ui_test_utils::NavigateToURLWithDisposition( 187 shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html"));
201 browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB,
202 0);
203 188
204 string16 expected_title(ASCIIToUTF16("OK")); 189 string16 expected_title(ASCIIToUTF16("OK"));
205 content::TitleWatcher title_watcher( 190 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
206 chrome::GetActiveWebContents(browser()), expected_title);
207 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 191 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
208 192
209 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 193 WaitForAppModalDialog(shell());
210 194
211 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 195 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
212 } 196 }
213 197
214 // Test passing arguments to a plugin. 198 // Test passing arguments to a plugin.
215 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) { 199 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) {
216 LoadAndWait(GetURL("arguments.html")); 200 LoadAndWait(GetURL("arguments.html"));
217 } 201 }
218 202
219 // Test invoking many plugins within a single page. 203 // Test invoking many plugins within a single page.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 LoadAndWait(GetURL("create_instance_in_paint.html")); 273 LoadAndWait(GetURL("create_instance_in_paint.html"));
290 } 274 }
291 275
292 // Tests that putting up an alert in response to a paint doesn't deadlock. 276 // Tests that putting up an alert in response to a paint doesn't deadlock.
293 #if defined(OS_WIN) 277 #if defined(OS_WIN)
294 #define MAYBE_AlertInWindowMessage DISABLED_AlertInWindowMessage 278 #define MAYBE_AlertInWindowMessage DISABLED_AlertInWindowMessage
295 #else 279 #else
296 #define MAYBE_AlertInWindowMessage AlertInWindowMessage 280 #define MAYBE_AlertInWindowMessage AlertInWindowMessage
297 #endif 281 #endif
298 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE_AlertInWindowMessage) { 282 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE_AlertInWindowMessage) {
299 ui_test_utils::NavigateToURL( 283 NavigateToURL(shell(), GetURL("alert_in_window_message.html"));
300 browser(), GetURL("alert_in_window_message.html"));
301 284
302 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 285 WaitForAppModalDialog(shell());
303 ui_test_utils::WaitForAppModalDialogAndCloseIt(); 286 WaitForAppModalDialog(shell());
304 } 287 }
305 288
306 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) { 289 IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) {
307 LoadAndWait(GetURL("npobject_lifetime_test.html")); 290 LoadAndWait(GetURL("npobject_lifetime_test.html"));
308 } 291 }
309 292
310 // Tests that we don't crash or assert if NPP_New fails 293 // Tests that we don't crash or assert if NPP_New fails
311 IN_PROC_BROWSER_TEST_F(PluginTest, NewFails) { 294 IN_PROC_BROWSER_TEST_F(PluginTest, NewFails) {
312 LoadAndWait(GetURL("new_fails.html")); 295 LoadAndWait(GetURL("new_fails.html"));
313 } 296 }
(...skipping 27 matching lines...) Expand all
341 LoadAndWait(GetURL("schedule_timer.html")); 324 LoadAndWait(GetURL("schedule_timer.html"));
342 } 325 }
343 326
344 IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) { 327 IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) {
345 LoadAndWait(GetURL("plugin_thread_async_call.html")); 328 LoadAndWait(GetURL("plugin_thread_async_call.html"));
346 } 329 }
347 330
348 // Test checking the privacy mode is on. 331 // Test checking the privacy mode is on.
349 // If this flakes on Linux, use http://crbug.com/104380 332 // If this flakes on Linux, use http://crbug.com/104380
350 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) { 333 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) {
351 LoadAndWait(GetURL("private.html")); 334 GURL url = GetURL("private.html");
335 url = GURL(url.spec() + "?private");
336 LoadAndWait(url);
352 } 337 }
353 338
354 #if defined(OS_WIN) || defined(OS_MACOSX) 339 #if defined(OS_WIN) || defined(OS_MACOSX)
355 // Test a browser hang due to special case of multiple 340 // Test a browser hang due to special case of multiple
356 // plugin instances indulged in sync calls across renderer. 341 // plugin instances indulged in sync calls across renderer.
357 IN_PROC_BROWSER_TEST_F(PluginTest, MultipleInstancesSyncCalls) { 342 IN_PROC_BROWSER_TEST_F(PluginTest, MultipleInstancesSyncCalls) {
358 LoadAndWait(GetURL("multiple_instances_sync_calls.html")); 343 LoadAndWait(GetURL("multiple_instances_sync_calls.html"));
359 } 344 }
360 #endif 345 #endif
361 346
(...skipping 23 matching lines...) Expand all
385 IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) { 370 IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) {
386 GURL url(URLRequestMockHTTPJob::GetMockUrl( 371 GURL url(URLRequestMockHTTPJob::GetMockUrl(
387 FilePath().AppendASCII("npapi"). 372 FilePath().AppendASCII("npapi").
388 AppendASCII("plugin_url_request_referrer_test.html"))); 373 AppendASCII("plugin_url_request_referrer_test.html")));
389 LoadAndWait(url); 374 LoadAndWait(url);
390 } 375 }
391 376
392 #if defined(OS_MACOSX) 377 #if defined(OS_MACOSX)
393 // Test is flaky, see http://crbug.com/134515. 378 // Test is flaky, see http://crbug.com/134515.
394 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) { 379 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) {
395 gfx::NativeWindow window = NULL;
396 gfx::Rect bounds(50, 50, 400, 400); 380 gfx::Rect bounds(50, 50, 400, 400);
397 ui_test_utils::GetNativeWindow(browser(), &window); 381 SetWindowBounds(shell()->window(), bounds);
398 ui_test_utils::SetWindowBounds(window, bounds);
399 382
400 ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html")); 383 NavigateToURL(shell(), GetURL("convert_point.html"));
401 384
402 string16 expected_title(ASCIIToUTF16("OK")); 385 string16 expected_title(ASCIIToUTF16("OK"));
403 content::TitleWatcher title_watcher( 386 TitleWatcher title_watcher(shell()->web_contents(), expected_title);
404 chrome::GetActiveWebContents(browser()), expected_title);
405 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 387 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
406 // TODO(stuartmorgan): When the automation system supports sending clicks, 388 // TODO(stuartmorgan): When the automation system supports sending clicks,
407 // change the test to trigger on mouse-down rather than window focus. 389 // change the test to trigger on mouse-down rather than window focus.
408 static_cast<content::WebContentsDelegate*>(browser())-> 390
409 ActivateContents(chrome::GetActiveWebContents(browser())); 391 // TODO: is this code still needed? It was here when it used to run in
392 // browser_tests.
393 //static_cast<WebContentsDelegate*>(shell())->
394 // ActivateContents(shell()->web_contents());
410 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 395 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
411 } 396 }
412 #endif 397 #endif
413 398
414 IN_PROC_BROWSER_TEST_F(PluginTest, Flash) { 399 IN_PROC_BROWSER_TEST_F(PluginTest, Flash) {
415 TestPlugin("flash.html"); 400 TestPlugin("flash.html");
416 } 401 }
417 402
418 #if defined(OS_WIN) 403 #if defined(OS_WIN)
419 // Windows only test 404 // Windows only test
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 445
461 // http://crbug.com/8690 446 // http://crbug.com/8690
462 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) { 447 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) {
463 TestPlugin("Java.html"); 448 TestPlugin("Java.html");
464 } 449 }
465 450
466 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) { 451 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) {
467 TestPlugin("silverlight.html"); 452 TestPlugin("silverlight.html");
468 } 453 }
469 #endif // defined(OS_WIN) 454 #endif // defined(OS_WIN)
455
456 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698