summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-02 23:18:26 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-02 23:18:26 +0000
commit8ffad4ed0b910af30b2404fdfd26e44fa73c50c0 (patch)
tree07b7e33da278ac1dd44159321e46217c7bdd494c /content/browser
parentb58d9ddb80eda7b620785fa52933b0161eb5fd1e (diff)
downloadchromium_src-8ffad4ed0b910af30b2404fdfd26e44fa73c50c0.zip
chromium_src-8ffad4ed0b910af30b2404fdfd26e44fa73c50c0.tar.gz
chromium_src-8ffad4ed0b910af30b2404fdfd26e44fa73c50c0.tar.bz2
Introduce RenderProcessHostObserver::RenderProcessExited, use it in a new RenderProcessHostWatcher, and switch browser tests over to that new watcher.
BUG=170921 TEST=no change Review URL: https://codereview.chromium.org/121493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/frame_host/render_frame_host_manager_browsertest.cc17
-rw-r--r--content/browser/loader/resource_dispatcher_host_browsertest.cc8
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc3
-rw-r--r--content/browser/security_exploit_browsertest.cc8
4 files changed, 15 insertions, 21 deletions
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index 576e138..23fec72 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -15,10 +15,6 @@
#include "content/common/content_constants_internal.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
@@ -713,9 +709,8 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
// 2) Post a message containing a MessagePort from opener to the the foo
// window. The foo window will reply via the passed port, causing the opener
// to update its own title.
- WindowedNotificationObserver title_observer(
- NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
- Source<WebContents>(opener_contents));
+ base::string16 expected_title = ASCIIToUTF16("msg-back-via-port");
+ TitleWatcher title_observer(opener_contents, expected_title);
EXPECT_TRUE(ExecuteScriptAndExtractBool(
opener_contents,
"window.domAutomationController.send(postWithPortToFoo());",
@@ -723,7 +718,7 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_TRUE(success);
ASSERT_FALSE(
opener_manager->GetSwappedOutRenderViewHost(orig_site_instance.get()));
- title_observer.Wait();
+ ASSERT_EQ(expected_title, title_observer.WaitAndGetTitle());
// Check message counts.
int opener_received_messages_via_port = 0;
@@ -874,9 +869,9 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
// Navigate the first window to a different site as well. The original
// process should exit, since all of its views are now swapped out.
- WindowedNotificationObserver exit_observer(
- NOTIFICATION_RENDERER_PROCESS_TERMINATED,
- Source<RenderProcessHost>(orig_process));
+ RenderProcessHostWatcher exit_observer(
+ orig_process,
+ RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
NavigateToURL(shell(), https_server.GetURL("files/title1.html"));
exit_observer.Wait();
scoped_refptr<SiteInstance> new_site_instance2(
diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc
index 23a0cca..a2af83b 100644
--- a/content/browser/loader/resource_dispatcher_host_browsertest.cc
+++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc
@@ -9,8 +9,6 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
@@ -304,9 +302,9 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest,
// strip the app on the build bots, this is bad times.
IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, CrossSiteAfterCrash) {
// Cause the renderer to crash.
- WindowedNotificationObserver crash_observer(
- NOTIFICATION_RENDERER_PROCESS_CLOSED,
- NotificationService::AllSources());
+ RenderProcessHostWatcher crash_observer(
+ shell()->web_contents(),
+ RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
NavigateToURL(shell(), GURL(kChromeUICrashURL));
// Wait for browser to notice the renderer crash.
crash_observer.Wait();
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index c841640..9812a04 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1821,6 +1821,9 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) {
NOTIFICATION_RENDERER_PROCESS_CLOSED,
Source<RenderProcessHost>(this),
Details<RendererClosedDetails>(&details));
+ FOR_EACH_OBSERVER(RenderProcessHostObserver,
+ observers_,
+ RenderProcessExited(this, GetHandle(), status, exit_code));
child_process_launcher_.reset();
channel_.reset();
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index fc648f0..62241ac 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -11,8 +11,6 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
@@ -107,9 +105,9 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, SetWebUIProperty) {
EXPECT_EQ(0,
shell()->web_contents()->GetRenderViewHost()->GetEnabledBindings());
- content::WindowedNotificationObserver terminated(
- content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
- content::NotificationService::AllSources());
+ content::RenderProcessHostWatcher terminated(
+ shell()->web_contents(),
+ content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
shell()->web_contents()->GetRenderViewHost()->SetWebUIProperty(
"toolkit", "views");
terminated.Wait();