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

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

Issue 11094080: Browser Plugin: More robust recovery from guest crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed part of test that is no longer valid 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
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 668
669 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 669 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
670 test_embedder()->web_contents()->GetRenderViewHost()); 670 test_embedder()->web_contents()->GetRenderViewHost());
671 ExecuteSyncJSFunction(rvh, ASCIIToUTF16( 671 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(
672 "document.getElementById('plugin').terminate()")); 672 "document.getElementById('plugin').terminate()"));
673 673
674 // Expect the guest to crash. 674 // Expect the guest to crash.
675 test_guest()->WaitForCrashed(); 675 test_guest()->WaitForCrashed();
676 } 676 }
677 677
678 // This test verifies that the guest is responsive after crashing and going back
679 // to a previous navigation entry.
680 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BackAfterTerminateGuest) {
681 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
682 StartBrowserPluginTest(
683 kEmbedderURL, GetHTMLForGuestWithTitle("P1"), true, "");
684 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
685 test_embedder()->web_contents()->GetRenderViewHost());
686
687 // Navigate to P2 and verify that the navigation occurred.
688 {
689 const string16 expected_title = ASCIIToUTF16("P2");
690 content::TitleWatcher title_watcher(test_guest()->web_contents(),
691 expected_title);
692
693 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(StringPrintf("SetSrc('%s');",
694 GetHTMLForGuestWithTitle("P2").c_str())));
695
696 string16 actual_title = title_watcher.WaitAndGetTitle();
697 EXPECT_EQ(expected_title, actual_title);
698 }
699 // Kill the guest.
700 ExecuteSyncJSFunction(rvh,
701 ASCIIToUTF16("document.getElementById('plugin').terminate()"));
702
703 // Expect the guest to report that it crashed.
704 test_guest()->WaitForCrashed();
705 // Go back and verify that we're back at P1.
706 {
707 const string16 expected_title = ASCIIToUTF16("P1");
708 content::TitleWatcher title_watcher(test_guest()->web_contents(),
709 expected_title);
710
711 ExecuteSyncJSFunction(rvh, ASCIIToUTF16("Back();"));
712
713 string16 actual_title = title_watcher.WaitAndGetTitle();
714 EXPECT_EQ(expected_title, actual_title);
715 }
716 // Send an input event and verify that the guest receives the input.
717 SimulateMouseClick(test_embedder()->web_contents());
718 test_guest()->WaitForInput();
719 }
720
678 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) { 721 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) {
679 const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; 722 const char kEmbedderURL[] = "files/browser_plugin_embedder.html";
680 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); 723 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
681 724
682 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); 725 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest);
683 content::TitleWatcher title_watcher(test_embedder()->web_contents(), 726 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
684 expected_title); 727 expected_title);
685 // Renavigate the guest to |kHTMLForGuest|. 728 // Renavigate the guest to |kHTMLForGuest|.
686 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 729 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
687 test_embedder()->web_contents()->GetRenderViewHost()); 730 test_embedder()->web_contents()->GetRenderViewHost());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0); 827 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0);
785 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 828 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y),
786 WebKit::WebDragOperationEvery, 0); 829 WebKit::WebDragOperationEvery, 0);
787 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0); 830 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0);
788 831
789 string16 actual_title = title_watcher.WaitAndGetTitle(); 832 string16 actual_title = title_watcher.WaitAndGetTitle();
790 EXPECT_EQ(expected_title, actual_title); 833 EXPECT_EQ(expected_title, actual_title);
791 } 834 }
792 835
793 } // namespace content 836 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/browser_plugin/test_browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698