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

Unified Diff: chrome/browser/crash_recovery_browsertest.cc

Issue 7489019: Fix up various browser tests not to use WaitForNavigation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix nits Created 9 years, 4 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/browser/browser_focus_uitest.cc ('k') | chrome/browser/geolocation/geolocation_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/browser_focus_uitest.cc ('k') | chrome/browser/geolocation/geolocation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698