Index: chrome/browser/crash_recovery_browsertest.cc |
diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc |
index 3c8d4f28a3d1f046a2beae46d1f936028b0c7684..8a26e5b695d6ee84b76050d8bd61a4e7c580cf73 100644 |
--- a/chrome/browser/crash_recovery_browsertest.cc |
+++ b/chrome/browser/crash_recovery_browsertest.cc |
@@ -4,6 +4,7 @@ |
#include "base/file_path.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/ui_test_utils.h" |
@@ -15,12 +16,12 @@ |
namespace { |
void SimulateRendererCrash(Browser* browser) { |
+ ui_test_utils::WindowedNotificationObserver observer( |
+ content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, |
+ NotificationService::AllSources()); |
browser->OpenURL(GURL(chrome::kChromeUICrashURL), GURL(), CURRENT_TAB, |
PageTransition::TYPED); |
- LOG(ERROR) << "SimulateRendererCrash, before WaitForNotification"; |
- ui_test_utils::WaitForNotification( |
- content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED); |
- LOG(ERROR) << "SimulateRendererCrash, after WaitForNotification"; |
+ observer.Wait(); |
} |
} // namespace |
@@ -42,10 +43,12 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { |
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
&title_before_crash)); |
SimulateRendererCrash(browser()); |
+ ui_test_utils::WindowedNotificationObserver observer( |
+ content::NOTIFICATION_LOAD_STOP, |
+ Source<NavigationController>( |
+ &browser()->GetSelectedTabContentsWrapper()->controller())); |
browser()->Reload(CURRENT_TAB); |
- LOG(ERROR) << "Before WaitForNavigationInCurrentTab"; |
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
- LOG(ERROR) << "After WaitForNavigationInCurrentTab"; |
+ observer.Wait(); |
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
&title_after_crash)); |
EXPECT_NE(title_before_crash, title_after_crash); |
@@ -69,10 +72,12 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { |
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
&title_before_crash)); |
SimulateRendererCrash(browser()); |
+ ui_test_utils::WindowedNotificationObserver observer( |
+ content::NOTIFICATION_LOAD_STOP, |
+ Source<NavigationController>( |
+ &browser()->GetSelectedTabContentsWrapper()->controller())); |
browser()->Reload(CURRENT_TAB); |
- LOG(ERROR) << "Before WaitForNavigationInCurrentTab"; |
- ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
- LOG(ERROR) << "After WaitForNavigationInCurrentTab"; |
+ observer.Wait(); |
ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), |
&title_after_crash)); |
EXPECT_EQ(title_before_crash, title_after_crash); |