summaryrefslogtreecommitdiffstats
path: root/chrome/browser/crash_recovery_browsertest.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 16:07:16 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 16:07:16 +0000
commit714786e1b9566ca76388497904d2ebdb7fd111f5 (patch)
tree01acf69cddaa411e91c0e8f1cb1c8ed3c30a0ba0 /chrome/browser/crash_recovery_browsertest.cc
parenta5a00b1dd7a4950de617bb9bb9bc596d1f89965f (diff)
downloadchromium_src-714786e1b9566ca76388497904d2ebdb7fd111f5.zip
chromium_src-714786e1b9566ca76388497904d2ebdb7fd111f5.tar.gz
chromium_src-714786e1b9566ca76388497904d2ebdb7fd111f5.tar.bz2
Revert 43931 - [GTTF] Clean up browser tests:
use more ui_test_utils functions to simplify the code expose more consistent and powerful utilities in ui_test_utils minor style improvements move some tests from DISABLED to FLAKY so we don't lose coverage remove redundant timeouts check more return values TEST=browser_tests BUG=none Review URL: http://codereview.chromium.org/1571002 TBR=phajdan.jr@chromium.org Review URL: http://codereview.chromium.org/1520026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/crash_recovery_browsertest.cc')
-rw-r--r--chrome/browser/crash_recovery_browsertest.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc
index 1ee4cc4..846ddfe 100644
--- a/chrome/browser/crash_recovery_browsertest.cc
+++ b/chrome/browser/crash_recovery_browsertest.cc
@@ -6,7 +6,8 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/notification_type.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
@@ -16,11 +17,40 @@
namespace {
+// Used to block until a navigation completes.
+class RendererCrashObserver : public NotificationObserver {
+ public:
+ RendererCrashObserver() {}
+
+ void WaitForRendererCrash() {
+ registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
+ NotificationService::AllSources());
+ ui_test_utils::RunMessageLoop();
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::TAB_CONTENTS_DISCONNECTED) {
+ registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
+ NotificationService::AllSources());
+ MessageLoopForUI::current()->Quit();
+ } else {
+ NOTREACHED();
+ }
+ }
+
+ private:
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(RendererCrashObserver);
+};
+
void SimulateRendererCrash(Browser* browser) {
browser->OpenURL(GURL(chrome::kAboutCrashURL), GURL(), CURRENT_TAB,
PageTransition::TYPED);
- ui_test_utils::WaitForNotification(
- NotificationType::TAB_CONTENTS_DISCONNECTED);
+ RendererCrashObserver crash_observer;
+ crash_observer.WaitForRendererCrash();
}
} // namespace