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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 11235048: Test suite that monitors the disposition of JS-created windows based on what (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style nits Created 8 years, 2 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/click_modifier/window_open.html ('k') | content/browser/plugin_browsertest.cc » ('j') | 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/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Override the hang timeout for guest to be very small. 327 // Override the hang timeout for guest to be very small.
328 content::BrowserPluginGuest::set_factory_for_testing( 328 content::BrowserPluginGuest::set_factory_for_testing(
329 TestShortHangTimeoutGuestFactory::GetInstance()); 329 TestShortHangTimeoutGuestFactory::GetInstance());
330 const char kEmbedderURL[] = "files/browser_plugin_embedder_crash.html"; 330 const char kEmbedderURL[] = "files/browser_plugin_embedder_crash.html";
331 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestInfiniteLoop, true, ""); 331 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestInfiniteLoop, true, "");
332 332
333 ExecuteSyncJSFunction(test_guest()->web_contents()->GetRenderViewHost(), 333 ExecuteSyncJSFunction(test_guest()->web_contents()->GetRenderViewHost(),
334 ASCIIToUTF16("StartInfiniteLoop();")); 334 ASCIIToUTF16("StartInfiniteLoop();"));
335 335
336 // Send a mouse event to the guest. 336 // Send a mouse event to the guest.
337 SimulateMouseClick(test_embedder()->web_contents()); 337 SimulateMouseClick(test_embedder()->web_contents(), 0,
338 WebKit::WebMouseEvent::ButtonLeft);
338 339
339 // Expect the guest to crash. 340 // Expect the guest to crash.
340 test_guest()->WaitForCrashed(); 341 test_guest()->WaitForCrashed();
341 } 342 }
342 343
343 // This test ensures that if guest isn't there and we resize the guest (from 344 // This test ensures that if guest isn't there and we resize the guest (from
344 // js), it remembers the size correctly. 345 // js), it remembers the size correctly.
345 // 346 //
346 // Initially we load an embedder with a guest without a src attribute (which has 347 // Initially we load an embedder with a guest without a src attribute (which has
347 // dimension 640x480), resize it to 100x200, and then we set the source to a 348 // dimension 640x480), resize it to 100x200, and then we set the source to a
348 // sample guest. In the end we verify that the correct size has been set. 349 // sample guest. In the end we verify that the correct size has been set.
349 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, NavigateAfterResize) { 350 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, NavigateAfterResize) {
350 const gfx::Size nxt_size = gfx::Size(100, 200); 351 const gfx::Size nxt_size = gfx::Size(100, 200);
351 const std::string embedder_code = 352 const std::string embedder_code =
352 StringPrintf("SetSize(%d, %d);", nxt_size.width(), nxt_size.height()); 353 StringPrintf("SetSize(%d, %d);", nxt_size.width(), nxt_size.height());
353 const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; 354 const char kEmbedderURL[] = "files/browser_plugin_embedder.html";
354 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, embedder_code); 355 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, embedder_code);
355 356
356 // Wait for the guest to receive a damage buffer of size 100x200. 357 // Wait for the guest to receive a damage buffer of size 100x200.
357 // This means the guest will be painted properly at that size. 358 // This means the guest will be painted properly at that size.
358 test_guest()->WaitForDamageBufferWithSize(nxt_size); 359 test_guest()->WaitForDamageBufferWithSize(nxt_size);
359 } 360 }
360 361
361 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { 362 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) {
362 const char kEmbedderURL[] = "files/browser_plugin_focus.html"; 363 const char kEmbedderURL[] = "files/browser_plugin_focus.html";
363 const char* kGuestURL = "files/browser_plugin_focus_child.html"; 364 const char* kGuestURL = "files/browser_plugin_focus_child.html";
364 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); 365 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, "");
365 366
366 SimulateMouseClick(test_embedder()->web_contents()); 367 SimulateMouseClick(test_embedder()->web_contents(), 0,
368 WebKit::WebMouseEvent::ButtonLeft);
367 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); 369 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents());
368 // Wait until we focus into the guest. 370 // Wait until we focus into the guest.
369 test_guest()->WaitForFocus(); 371 test_guest()->WaitForFocus();
370 372
371 // TODO(fsamuel): A third Tab key press should not be necessary. 373 // TODO(fsamuel): A third Tab key press should not be necessary.
372 // The browser plugin will take keyboard focus but it will not 374 // The browser plugin will take keyboard focus but it will not
373 // focus an initial element. The initial element is dependent 375 // focus an initial element. The initial element is dependent
374 // upon tab direction which WebKit does not propagate to the plugin. 376 // upon tab direction which WebKit does not propagate to the plugin.
375 // See http://crbug.com/147644. 377 // See http://crbug.com/147644.
376 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); 378 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents());
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 const string16 expected_title = ASCIIToUTF16("P1"); 709 const string16 expected_title = ASCIIToUTF16("P1");
708 content::TitleWatcher title_watcher(test_guest()->web_contents(), 710 content::TitleWatcher title_watcher(test_guest()->web_contents(),
709 expected_title); 711 expected_title);
710 712
711 ExecuteSyncJSFunction(rvh, ASCIIToUTF16("Back();")); 713 ExecuteSyncJSFunction(rvh, ASCIIToUTF16("Back();"));
712 714
713 string16 actual_title = title_watcher.WaitAndGetTitle(); 715 string16 actual_title = title_watcher.WaitAndGetTitle();
714 EXPECT_EQ(expected_title, actual_title); 716 EXPECT_EQ(expected_title, actual_title);
715 } 717 }
716 // Send an input event and verify that the guest receives the input. 718 // Send an input event and verify that the guest receives the input.
717 SimulateMouseClick(test_embedder()->web_contents()); 719 SimulateMouseClick(test_embedder()->web_contents(), 0,
720 WebKit::WebMouseEvent::ButtonLeft);
718 test_guest()->WaitForInput(); 721 test_guest()->WaitForInput();
719 } 722 }
720 723
721 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) { 724 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) {
722 const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; 725 const char kEmbedderURL[] = "files/browser_plugin_embedder.html";
723 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); 726 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
724 727
725 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); 728 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest);
726 content::TitleWatcher title_watcher(test_embedder()->web_contents(), 729 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
727 expected_title); 730 expected_title);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 ASCIIToUTF16(StringPrintf("PostMessage('%s', true);", kTesting))); 919 ASCIIToUTF16(StringPrintf("PostMessage('%s', true);", kTesting)));
917 920
918 // The title will be updated to "iframe" at the last stage of the 921 // The title will be updated to "iframe" at the last stage of the
919 // process described above. 922 // process described above.
920 actual_title = iframe_watcher.WaitAndGetTitle(); 923 actual_title = iframe_watcher.WaitAndGetTitle();
921 EXPECT_EQ(ASCIIToUTF16("iframe"), actual_title); 924 EXPECT_EQ(ASCIIToUTF16("iframe"), actual_title);
922 } 925 }
923 } 926 }
924 927
925 } // namespace content 928 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/data/click_modifier/window_open.html ('k') | content/browser/plugin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698