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

Unified Diff: chrome/test/ui_test_utils.cc

Issue 196115: This CL adds a test to insure we are not regressing on http://crbug.com/19941... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 26154)
+++ chrome/test/ui_test_utils.cc (working copy)
@@ -230,28 +230,25 @@
DISALLOW_COPY_AND_ASSIGN(AppModalDialogObserver);
};
-class CrashedRenderProcessObserver : public NotificationObserver {
+template <class T>
+class SimpleNotificationObserver : public NotificationObserver {
public:
- explicit CrashedRenderProcessObserver(RenderProcessHost* rph) {
- registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
- Source<RenderProcessHost>(rph));
+ SimpleNotificationObserver(NotificationType notification_type,
+ T* source) {
+ registrar_.Add(this, notification_type, Source<T>(source));
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();
- }
+ MessageLoopForUI::current()->Quit();
}
private:
NotificationRegistrar registrar_;
- DISALLOW_COPY_AND_ASSIGN(CrashedRenderProcessObserver);
+ DISALLOW_COPY_AND_ASSIGN(SimpleNotificationObserver);
};
} // namespace
@@ -308,6 +305,16 @@
NavigationNotificationObserver observer(controller, number_of_navigations);
}
+void WaitForNewTab(Browser* browser) {
+ SimpleNotificationObserver<Browser>
+ new_tab_observer(NotificationType::TAB_ADDED, browser);
+}
+
+void WaitForLoadStop(NavigationController* controller) {
+ SimpleNotificationObserver<NavigationController>
+ new_tab_observer(NotificationType::LOAD_STOP, controller);
+}
+
void NavigateToURL(Browser* browser, const GURL& url) {
NavigateToURLBlockUntilNavigationsComplete(browser, url, 1);
}
@@ -408,7 +415,8 @@
void CrashTab(TabContents* tab) {
RenderProcessHost* rph = tab->render_view_host()->process();
base::KillProcess(rph->process().handle(), 0, false);
- CrashedRenderProcessObserver crash_observer(rph);
+ SimpleNotificationObserver<RenderProcessHost>
+ crash_observer(NotificationType::RENDERER_PROCESS_CLOSED, 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