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

Unified Diff: content/browser/renderer_host/render_view_host_manager_browsertest.cc

Issue 26277010: Create content::WebContentsDestroyedWatcher, use it in many tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_manager_browsertest.cc
diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
index 383ac86a3b0c5deb42656120ddb73d087334a7b5..7213a77be56022c2d06553850b8a9bb824a9a762 100644
--- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
@@ -319,28 +319,6 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
EXPECT_EQ(orig_site_instance, noref_site_instance);
}
-namespace {
-
-class WebContentsDestroyedObserver : public WebContentsObserver {
- public:
- WebContentsDestroyedObserver(WebContents* web_contents,
- const base::Closure& callback)
- : WebContentsObserver(web_contents),
- callback_(callback) {
- }
-
- virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE {
- callback_.Run();
- }
-
- private:
- base::Closure callback_;
-
- DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedObserver);
-};
-
-} // namespace
-
// Test for crbug.com/116192. Targeted links should still work after the
// named target window has swapped processes.
IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
@@ -411,15 +389,13 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
NavigateToURL(new_shell, https_server.GetURL("files/title1.html"));
EXPECT_EQ(new_site_instance,
new_shell->web_contents()->GetSiteInstance());
- scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
- WebContentsDestroyedObserver close_observer(new_shell->web_contents(),
- loop_runner->QuitClosure());
+ WebContentsDestroyedWatcher close_watcher(new_shell->web_contents());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell()->web_contents(),
"window.domAutomationController.send(testCloseWindow());",
&success));
EXPECT_TRUE(success);
- loop_runner->Run();
+ close_watcher.Wait();
}
// Test that setting the opener to null in a window affects cross-process

Powered by Google App Engine
This is Rietveld 408576698