diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 16:35:49 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 16:35:49 +0000 |
commit | 7f37dd931e8f0512d215ddbc16c4e1e714d39d9d (patch) | |
tree | a25943da348d0e3945e90a75175a82295f66a857 /chrome/test/ui_test_utils.cc | |
parent | d8107dbea736450d8fe5e20f939824bc614dd449 (diff) | |
download | chromium_src-7f37dd931e8f0512d215ddbc16c4e1e714d39d9d.zip chromium_src-7f37dd931e8f0512d215ddbc16c4e1e714d39d9d.tar.gz chromium_src-7f37dd931e8f0512d215ddbc16c4e1e714d39d9d.tar.bz2 |
This CL adds a test to insure we are not regressing on http://crbug.com/19941
We would crash when an SSL error would happen on a page with no navigation entry.
TEST=Run the test.
BUG=http://crbug.com/19941
Review URL: http://codereview.chromium.org/196115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.cc')
-rw-r--r-- | chrome/test/ui_test_utils.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index 543828b..e92f260 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -230,28 +230,25 @@ class AppModalDialogObserver : public NotificationObserver { 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 @@ void WaitForNavigations(NavigationController* controller, 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 @@ AppModalDialog* WaitForAppModalDialog() { 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 |