Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / browser / plugin_browsertest.cc
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/file_util.h"
7 #include "base/path_service.h"
8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/loader/resource_dispatcher_host_impl.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/resource_dispatcher_host_delegate.h"
13 #include "content/public/common/content_switches.h"
14 #include "content/public/test/browser_test_utils.h"
15 #include "content/public/test/content_browser_test.h"
16 #include "content/public/test/content_browser_test_utils.h"
17 #include "content/public/test/test_utils.h"
18 #include "content/shell/browser/shell.h"
19 #include "content/shell/common/shell_switches.h"
20 #include "content/test/net/url_request_mock_http_job.h"
21 #include "net/test/embedded_test_server/embedded_test_server.h"
22 #include "net/url_request/url_request.h"
23 #include "ui/gfx/rect.h"
24
25 #if defined(OS_WIN)
26 #include "base/win/registry.h"
27 #endif
28
29 // TODO(jschuh): Finish plugins on Win64. crbug.com/180861
30 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
31 #define MAYBE(x) DISABLED_##x
32 #else
33 #define MAYBE(x) x
34 #endif
35
36 using base::ASCIIToUTF16;
37
38 namespace content {
39 namespace {
40
41 void SetUrlRequestMock(const base::FilePath& path) {
42   URLRequestMockHTTPJob::AddUrlHandler(path);
43 }
44
45 }
46
47 class PluginTest : public ContentBrowserTest {
48  protected:
49   PluginTest() {}
50
51   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
52     // Some NPAPI tests schedule garbage collection to force object tear-down.
53     command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
54
55 #if defined(OS_WIN)
56     const testing::TestInfo* const test_info =
57         testing::UnitTest::GetInstance()->current_test_info();
58     if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
59       // The installer adds our process names to the registry key below.  Since
60       // the installer might not have run on this machine, add it manually.
61       base::win::RegKey regkey;
62       if (regkey.Open(HKEY_LOCAL_MACHINE,
63                       L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList",
64                       KEY_WRITE) == ERROR_SUCCESS) {
65         regkey.CreateKey(L"BROWSER_TESTS.EXE", KEY_READ);
66       }
67     }
68 #elif defined(OS_MACOSX)
69     base::FilePath plugin_dir;
70     PathService::Get(base::DIR_MODULE, &plugin_dir);
71     plugin_dir = plugin_dir.AppendASCII("plugins");
72     // The plugins directory isn't read by default on the Mac, so it needs to be
73     // explicitly registered.
74     command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir);
75 #endif
76   }
77
78   virtual void SetUpOnMainThread() OVERRIDE {
79     base::FilePath path = GetTestFilePath("", "");
80     BrowserThread::PostTask(
81         BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
82   }
83
84   static void LoadAndWaitInWindow(Shell* window, const GURL& url) {
85     base::string16 expected_title(ASCIIToUTF16("OK"));
86     TitleWatcher title_watcher(window->web_contents(), expected_title);
87     title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
88     title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found"));
89     NavigateToURL(window, url);
90     base::string16 title = title_watcher.WaitAndGetTitle();
91     if (title == ASCIIToUTF16("plugin_not_found")) {
92       const testing::TestInfo* const test_info =
93           testing::UnitTest::GetInstance()->current_test_info();
94       VLOG(0) << "PluginTest." << test_info->name()
95               << " not running because plugin not installed.";
96     } else {
97       EXPECT_EQ(expected_title, title);
98     }
99   }
100
101   void LoadAndWait(const GURL& url) {
102     LoadAndWaitInWindow(shell(), url);
103   }
104
105   GURL GetURL(const char* filename) {
106     return GetTestUrl("npapi", filename);
107   }
108
109   void NavigateAway() {
110     GURL url = GetTestUrl("", "simple_page.html");
111     LoadAndWait(url);
112   }
113
114   void TestPlugin(const char* filename) {
115     base::FilePath path = GetTestFilePath("plugin", filename);
116     if (!base::PathExists(path)) {
117       const testing::TestInfo* const test_info =
118           testing::UnitTest::GetInstance()->current_test_info();
119       VLOG(0) << "PluginTest." << test_info->name()
120               << " not running because test data wasn't found.";
121       return;
122     }
123
124     GURL url = GetTestUrl("plugin", filename);
125     LoadAndWait(url);
126   }
127 };
128
129 // Make sure that navigating away from a plugin referenced by JS doesn't
130 // crash.
131 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) {
132   LoadAndWait(GetURL("layout_test_plugin.html"));
133   NavigateAway();
134 }
135
136 // Tests if a plugin executing a self deleting script using NPN_GetURL
137 // works without crashing or hanging
138 // Flaky: http://crbug.com/59327
139 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginGetUrl)) {
140   LoadAndWait(GetURL("self_delete_plugin_geturl.html"));
141 }
142
143 // Tests if a plugin executing a self deleting script using Invoke
144 // works without crashing or hanging
145 // Flaky. See http://crbug.com/30702
146 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvoke)) {
147   LoadAndWait(GetURL("self_delete_plugin_invoke.html"));
148 }
149
150 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NPObjectReleasedOnDestruction)) {
151   NavigateToURL(shell(), GetURL("npobject_released_on_destruction.html"));
152   NavigateAway();
153 }
154
155 // Test that a dialog is properly created when a plugin throws an
156 // exception.  Should be run for in and out of process plugins, but
157 // the more interesting case is out of process, where we must route
158 // the exception to the correct renderer.
159 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NPObjectSetException)) {
160   LoadAndWait(GetURL("npobject_set_exception.html"));
161 }
162
163 #if defined(OS_WIN)
164 // Tests if a plugin executing a self deleting script in the context of
165 // a synchronous mouseup works correctly.
166 // This was never ported to Mac. The only thing remaining is to make
167 // SimulateMouseClick get to Mac plugins, currently it doesn't work.
168 IN_PROC_BROWSER_TEST_F(PluginTest,
169                        MAYBE(SelfDeletePluginInvokeInSynchronousMouseUp)) {
170   NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html"));
171
172   base::string16 expected_title(ASCIIToUTF16("OK"));
173   TitleWatcher title_watcher(shell()->web_contents(), expected_title);
174   title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
175   SimulateMouseClick(shell()->web_contents(), 0,
176       blink::WebMouseEvent::ButtonLeft);
177   EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
178 }
179 #endif
180
181 // Flaky, http://crbug.com/302274.
182 #if defined(OS_MACOSX)
183 #define MAYBE_GetURLRequest404Response DISABLED_GetURLRequest404Response
184 #else
185 #define MAYBE_GetURLRequest404Response MAYBE(GetURLRequest404Response)
186 #endif
187
188 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE_GetURLRequest404Response) {
189   GURL url(URLRequestMockHTTPJob::GetMockUrl(
190       base::FilePath().AppendASCII("npapi").
191                        AppendASCII("plugin_url_request_404.html")));
192   LoadAndWait(url);
193 }
194
195 // Tests if a plugin executing a self deleting script using Invoke with
196 // a modal dialog showing works without crashing or hanging
197 // Disabled, flakily exceeds timeout, http://crbug.com/46257.
198 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvokeAlert)) {
199   // Navigate asynchronously because if we waitd until it completes, there's a
200   // race condition where the alert can come up before we start watching for it.
201   shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html"));
202
203   base::string16 expected_title(ASCIIToUTF16("OK"));
204   TitleWatcher title_watcher(shell()->web_contents(), expected_title);
205   title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
206
207   WaitForAppModalDialog(shell());
208
209   EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
210 }
211
212 // Test passing arguments to a plugin.
213 // crbug.com/306318
214 #if !defined(OS_LINUX)
215 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(Arguments)) {
216   LoadAndWait(GetURL("arguments.html"));
217 }
218 #endif
219
220 // Test invoking many plugins within a single page.
221 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(ManyPlugins)) {
222   LoadAndWait(GetURL("many_plugins.html"));
223 }
224
225 #if !defined(OS_MACOSX)  // http://crbug.com/402164
226 // Test various calls to GetURL from a plugin.
227 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(GetURL)) {
228   LoadAndWait(GetURL("geturl.html"));
229 }
230 #endif
231
232 // Test various calls to GetURL for javascript URLs with
233 // non NULL targets from a plugin.
234 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(GetJavaScriptURL)) {
235   LoadAndWait(GetURL("get_javascript_url.html"));
236 }
237
238 // Test that calling GetURL with a javascript URL and target=_self
239 // works properly when the plugin is embedded in a subframe.
240 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(GetJavaScriptURL2)) {
241   LoadAndWait(GetURL("get_javascript_url2.html"));
242 }
243
244 // Test is flaky on linux/cros/win builders.  http://crbug.com/71904
245 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRedirectNotification) {
246   LoadAndWait(GetURL("geturl_redirect_notify.html"));
247 }
248
249 // Tests that identity is preserved for NPObjects passed from a plugin
250 // into JavaScript.
251 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NPObjectIdentity)) {
252   LoadAndWait(GetURL("npobject_identity.html"));
253 }
254
255 // Tests that if an NPObject is proxies back to its original process, the
256 // original pointer is returned and not a proxy.  If this fails the plugin
257 // will crash.
258 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NPObjectProxy)) {
259   LoadAndWait(GetURL("npobject_proxy.html"));
260 }
261
262 #if defined(OS_WIN) || defined(OS_MACOSX)
263 // Tests if a plugin executing a self deleting script in the context of
264 // a synchronous paint event works correctly
265 // http://crbug.com/44960
266 IN_PROC_BROWSER_TEST_F(PluginTest,
267                        MAYBE(SelfDeletePluginInvokeInSynchronousPaint)) {
268   LoadAndWait(GetURL("execute_script_delete_in_paint.html"));
269 }
270 #endif
271
272 // Tests that if a plugin executes a self resizing script in the context of a
273 // synchronous paint, the plugin doesn't use deallocated memory.
274 // http://crbug.com/139462
275 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(ResizeDuringPaint)) {
276   LoadAndWait(GetURL("resize_during_paint.html"));
277 }
278
279 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInNewStream)) {
280   LoadAndWait(GetURL("self_delete_plugin_stream.html"));
281 }
282
283 // On Mac this test asserts in plugin_host: http://crbug.com/95558
284 // On all platforms it flakes in ~URLRequestContext: http://crbug.com/310336
285 #if !defined(NDEBUG)
286 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_DeletePluginInDeallocate) {
287   LoadAndWait(GetURL("plugin_delete_in_deallocate.html"));
288 }
289 #endif
290
291 #if defined(OS_WIN)
292
293 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(VerifyPluginWindowRect)) {
294   LoadAndWait(GetURL("verify_plugin_window_rect.html"));
295 }
296
297 // Tests that creating a new instance of a plugin while another one is handling
298 // a paint message doesn't cause deadlock.
299 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(CreateInstanceInPaint)) {
300   LoadAndWait(GetURL("create_instance_in_paint.html"));
301 }
302
303 // Tests that putting up an alert in response to a paint doesn't deadlock.
304 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_AlertInWindowMessage) {
305   NavigateToURL(shell(), GetURL("alert_in_window_message.html"));
306
307   WaitForAppModalDialog(shell());
308   WaitForAppModalDialog(shell());
309 }
310
311 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(VerifyNPObjectLifetimeTest)) {
312   LoadAndWait(GetURL("npobject_lifetime_test.html"));
313 }
314
315 // Tests that we don't crash or assert if NPP_New fails
316 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NewFails)) {
317   LoadAndWait(GetURL("new_fails.html"));
318 }
319
320 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInNPNEvaluate)) {
321   LoadAndWait(GetURL("execute_script_delete_in_npn_evaluate.html"));
322 }
323
324 IN_PROC_BROWSER_TEST_F(PluginTest,
325                        MAYBE(SelfDeleteCreatePluginInNPNEvaluate)) {
326   LoadAndWait(GetURL("npn_plugin_delete_create_in_evaluate.html"));
327 }
328
329 #endif  // OS_WIN
330
331 // If this flakes, reopen http://crbug.com/17645
332 // As of 6 July 2011, this test is flaky on Windows (perhaps due to timing out).
333 #if !defined(OS_MACOSX) && !defined(OS_LINUX)
334 // Disabled on Mac because the plugin side isn't implemented yet, see
335 // "TODO(port)" in plugin_javascript_open_popup.cc.
336 // Disabled on Linux because we don't support NPAPI any more.
337 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(OpenPopupWindowWithPlugin)) {
338   LoadAndWait(GetURL("get_javascript_open_popup_with_plugin.html"));
339 }
340 #endif
341
342 // Test checking the privacy mode is off.
343 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PrivateDisabled)) {
344   LoadAndWait(GetURL("private.html"));
345 }
346
347 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(ScheduleTimer)) {
348   LoadAndWait(GetURL("schedule_timer.html"));
349 }
350
351 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PluginThreadAsyncCall)) {
352   LoadAndWait(GetURL("plugin_thread_async_call.html"));
353 }
354
355 IN_PROC_BROWSER_TEST_F(PluginTest, PluginSingleRangeRequest) {
356   LoadAndWait(GetURL("plugin_single_range_request.html"));
357 }
358
359 #if !defined(OS_WIN) // http://crbug.com/396373
360 // Test checking the privacy mode is on.
361 // If this flakes on Linux, use http://crbug.com/104380
362 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PrivateEnabled)) {
363   GURL url = GetURL("private.html");
364   url = GURL(url.spec() + "?private");
365   LoadAndWaitInWindow(CreateOffTheRecordBrowser(), url);
366 }
367 #endif
368
369 // These used to run on Windows: http://crbug.com/396373
370 #if defined(OS_MACOSX)
371 // Test a browser hang due to special case of multiple
372 // plugin instances indulged in sync calls across renderer.
373 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(MultipleInstancesSyncCalls)) {
374   LoadAndWait(GetURL("multiple_instances_sync_calls.html"));
375 }
376
377 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(GetURLRequestFailWrite)) {
378   GURL url(URLRequestMockHTTPJob::GetMockUrl(
379       base::FilePath().AppendASCII("npapi").
380                        AppendASCII("plugin_url_request_fail_write.html")));
381   LoadAndWait(url);
382 }
383 #endif
384
385 #if defined(OS_WIN)
386 // Flaky on Windows x86.  http://crbug.com/388245
387 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_EnsureScriptingWorksInDestroy) {
388   LoadAndWait(GetURL("ensure_scripting_works_in_destroy.html"));
389 }
390
391 // This test uses a Windows Event to signal to the plugin that it should crash
392 // on NP_Initialize.
393 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(NoHangIfInitCrashes)) {
394   HANDLE crash_event = CreateEvent(NULL, TRUE, FALSE, L"TestPluginCrashOnInit");
395   SetEvent(crash_event);
396   LoadAndWait(GetURL("no_hang_if_init_crashes.html"));
397   CloseHandle(crash_event);
398 }
399 #endif
400
401 // If this flakes on Mac, use http://crbug.com/111508
402 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(PluginReferrerTest)) {
403   GURL url(URLRequestMockHTTPJob::GetMockUrl(
404       base::FilePath().AppendASCII("npapi").
405                        AppendASCII("plugin_url_request_referrer_test.html")));
406   LoadAndWait(url);
407 }
408
409 #if defined(OS_MACOSX)
410 // Test is flaky, see http://crbug.com/134515.
411 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) {
412   gfx::Rect bounds(50, 50, 400, 400);
413   SetWindowBounds(shell()->window(), bounds);
414
415   NavigateToURL(shell(), GetURL("convert_point.html"));
416
417   base::string16 expected_title(ASCIIToUTF16("OK"));
418   TitleWatcher title_watcher(shell()->web_contents(), expected_title);
419   title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
420   // TODO(stuartmorgan): When the automation system supports sending clicks,
421   // change the test to trigger on mouse-down rather than window focus.
422
423   // TODO: is this code still needed? It was here when it used to run in
424   // browser_tests.
425   //static_cast<WebContentsDelegate*>(shell())->
426   //    ActivateContents(shell()->web_contents());
427   EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
428 }
429 #endif
430
431 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(Flash)) {
432   TestPlugin("flash.html");
433 }
434
435 #if defined(OS_WIN)
436 // Windows only test
437 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_FlashSecurity) {
438   TestPlugin("flash.html");
439 }
440 #endif  // defined(OS_WIN)
441
442 #if defined(OS_WIN)
443 // TODO(port) Port the following tests to platforms that have the required
444 // plugins.
445 // Flaky: http://crbug.com/55915
446 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Quicktime) {
447   TestPlugin("quicktime.html");
448 }
449
450 // Disabled - http://crbug.com/44662
451 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(MediaPlayerNew)) {
452   TestPlugin("wmp_new.html");
453 }
454
455 // Disabled - http://crbug.com/44673
456 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(Real)) {
457   TestPlugin("real.html");
458 }
459
460 // http://crbug.com/320041
461 #if (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || \
462     (defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN))
463 #define MAYBE_FlashOctetStream DISABLED_FlashOctetStream
464 #else
465 #define MAYBE_FlashOctetStream FlashOctetStream
466 #endif
467 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE_FlashOctetStream) {
468   TestPlugin("flash-octet-stream.html");
469 }
470
471 #if defined(OS_WIN)
472 // http://crbug.com/53926
473 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_FlashLayoutWhilePainting) {
474 #else
475 IN_PROC_BROWSER_TEST_F(PluginTest, FlashLayoutWhilePainting) {
476 #endif
477   TestPlugin("flash-layout-while-painting.html");
478 }
479
480 // http://crbug.com/8690
481 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) {
482   TestPlugin("Java.html");
483 }
484
485 // Flaky: http://crbug.com/55915
486 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Silverlight) {
487   TestPlugin("silverlight.html");
488 }
489 #endif  // defined(OS_WIN)
490
491 class TestResourceDispatcherHostDelegate
492     : public ResourceDispatcherHostDelegate {
493  public:
494   TestResourceDispatcherHostDelegate() : found_cookie_(false) {}
495
496   bool found_cookie() { return found_cookie_; }
497
498   void WaitForPluginRequest() {
499     if (found_cookie_)
500       return;
501
502     runner_ = new MessageLoopRunner;
503     runner_->Run();
504   }
505
506  private:
507   // ResourceDispatcherHostDelegate implementation:
508   virtual void OnResponseStarted(
509       net::URLRequest* request,
510       ResourceContext* resource_context,
511       ResourceResponse* response,
512       IPC::Sender* sender) OVERRIDE {
513     // The URL below comes from plugin_geturl_test.cc.
514     if (!EndsWith(request->url().spec(),
515                  "npapi/plugin_ref_target_page.html",
516                  true)) {
517       return;
518     }
519     net::HttpRequestHeaders headers;
520     bool found_cookie = false;
521     if (request->GetFullRequestHeaders(&headers) &&
522         headers.ToString().find("Cookie: blah") != std::string::npos) {
523       found_cookie = true;
524     }
525     BrowserThread::PostTask(
526         BrowserThread::UI,
527         FROM_HERE,
528         base::Bind(&TestResourceDispatcherHostDelegate::GotCookie,
529                    base::Unretained(this), found_cookie));
530   }
531
532   void GotCookie(bool found_cookie) {
533     found_cookie_ = found_cookie;
534     if (runner_)
535       runner_->QuitClosure().Run();
536   }
537
538   scoped_refptr<MessageLoopRunner> runner_;
539   bool found_cookie_;
540
541   DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcherHostDelegate);
542 };
543
544 // Ensure that cookies get sent with plugin requests.
545 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(Cookies)) {
546   // Create a new browser just to ensure that the plugin process' child_id is
547   // not equal to its type (PROCESS_TYPE_PLUGIN), as that was the error which
548   // caused this bug.
549   NavigateToURL(CreateBrowser(), GURL("about:blank"));
550
551   ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
552   GURL url(embedded_test_server()->GetURL("/npapi/cookies.html"));
553
554   TestResourceDispatcherHostDelegate test_delegate;
555   ResourceDispatcherHostDelegate* old_delegate =
556       ResourceDispatcherHostImpl::Get()->delegate();
557   ResourceDispatcherHostImpl::Get()->SetDelegate(&test_delegate);
558   LoadAndWait(url);
559   test_delegate.WaitForPluginRequest();
560   ASSERT_TRUE(test_delegate.found_cookie());
561   ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate);
562 }
563
564 }  // namespace content