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

Unified Diff: chrome/test/ui_test_utils.cc

Issue 160206: Fix focus bug when reloading crashed tab (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui_test_utils.cc
===================================================================
--- chrome/test/ui_test_utils.cc (revision 21658)
+++ chrome/test/ui_test_utils.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/json_reader.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/process_util.h"
#include "base/values.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/dom_operation_notification_details.h"
@@ -229,6 +230,30 @@
DISALLOW_COPY_AND_ASSIGN(AppModalDialogObserver);
};
+class CrashedRenderProcessObserver : public NotificationObserver {
+ public:
+ explicit CrashedRenderProcessObserver(RenderProcessHost* rph) {
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
+ Source<RenderProcessHost>(rph));
+ ui_test_utils::RunMessageLoop();
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::RENDERER_PROCESS_CLOSED) {
+ MessageLoopForUI::current()->Quit();
+ } else {
+ NOTREACHED();
+ }
+ }
+
+ private:
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(CrashedRenderProcessObserver);
+};
+
} // namespace
void RunMessageLoop() {
@@ -370,4 +395,10 @@
return observer.WaitForAppModalDialog();
}
+void CrashTab(TabContents* tab) {
+ RenderProcessHost* rph = tab->render_view_host()->process();
+ base::KillProcess(rph->process().handle(), 0, false);
+ CrashedRenderProcessObserver crash_observer(rph);
+}
+
} // namespace ui_test_utils
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698