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

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

Issue 14651029: content: Remove usage of NOTIFICATION_WEB_CONTENTS_DESTROYED from content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | content/browser/web_contents/interstitial_page_impl.h » ('j') | content/shell/shell.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8bb0454f6c214650ca0b57ddb38e8ea64f009c42..741f2cf337b6e1938dece4f396db48bcb8322df5 100644
--- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
@@ -314,6 +314,28 @@ 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,
@@ -387,15 +409,15 @@ 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());
- WindowedNotificationObserver close_observer(
- NOTIFICATION_WEB_CONTENTS_DESTROYED,
- Source<WebContents>(new_shell->web_contents()));
+ scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
+ WebContentsDestroyedObserver close_observer(new_shell->web_contents(),
+ loop_runner->QuitClosure());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell()->web_contents(),
"window.domAutomationController.send(testCloseWindow());",
&success));
EXPECT_TRUE(success);
- close_observer.Wait();
+ loop_runner->Run();
}
// Test that setting the opener to null in a window affects cross-process
« no previous file with comments | « no previous file | content/browser/web_contents/interstitial_page_impl.h » ('j') | content/shell/shell.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698