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

Unified Diff: content/public/test/mock_render_process_host.cc

Issue 1159183002: Improve process crash handling in RenderViewHost & mock RenderProcessHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile problem in webview_interactive_uitest.cc Created 5 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 | « content/public/test/mock_render_process_host.h ('k') | content/public/test/test_renderer_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/mock_render_process_host.cc
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index b07718a8472630abe7ee74505d2a40f211ed2af8..bde19042322da1775cff4ff860f12e716d4076c3 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -33,6 +33,7 @@ MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context)
: bad_msg_count_(0),
factory_(NULL),
id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
+ has_connection_(false),
browser_context_(browser_context),
prev_routing_id_(0),
fast_shutdown_started_(false),
@@ -60,12 +61,17 @@ MockRenderProcessHost::~MockRenderProcessHost() {
}
void MockRenderProcessHost::SimulateCrash() {
+ has_connection_ = false;
RenderProcessHost::RendererClosedDetails details(
base::TERMINATION_STATUS_PROCESS_CRASHED, 0);
NotificationService::current()->Notify(
NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this),
Details<RenderProcessHost::RendererClosedDetails>(&details));
+ FOR_EACH_OBSERVER(
+ RenderProcessHostObserver, observers_,
+ RenderProcessExited(this, details.status, details.exit_code));
+
// Send every routing ID a FrameHostMsg_RenderProcessGone message. To ensure a
// predictable order for unittests which may assert against the order, we sort
// the listeners by descending routing ID, instead of using the arbitrary
@@ -89,6 +95,7 @@ void MockRenderProcessHost::EnableSendQueue() {
}
bool MockRenderProcessHost::Init() {
+ has_connection_ = true;
return true;
}
@@ -177,7 +184,7 @@ int MockRenderProcessHost::GetID() const {
}
bool MockRenderProcessHost::HasConnection() const {
- return true;
+ return has_connection_;
}
void MockRenderProcessHost::SetIgnoreInputEvents(bool ignore_input_events) {
« no previous file with comments | « content/public/test/mock_render_process_host.h ('k') | content/public/test/test_renderer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698