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

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: fix typo, rebase 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') | no next file with comments »
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 ab719113a90d89c1677cfdcda4af93fc22d025c5..e94fa9abc6be67e409efe01d6106f8022ac1dc3f 100644
--- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host_observer.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
@@ -313,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,
@@ -386,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698