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

Unified Diff: chrome/test/base/in_process_browser_test.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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
Index: chrome/test/base/in_process_browser_test.cc
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index a68576836f27598a4d15af3db40b8de7de3119d3..2c6a9ae89521533a5cedadba3efeda84f561c320 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -22,6 +22,8 @@
#include "chrome/browser/net/net_error_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/search/instant_service.h"
+#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
@@ -414,6 +416,22 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
// browser.
content::RunAllPendingInMessageLoop();
+ if (browser_) {
+ // InstantService prerenders an Instant NTP on the first browser creation.
+ // Since many tests listen for load notifications, the NTP load can confuse
+ // them unless we first wait for the NTP contents to finish loading before
+ // running the test.
+ InstantService* instant_service = InstantServiceFactory::GetForProfile(
+ browser_->profile());
+ if (instant_service && instant_service->GetNTPContents() &&
+ instant_service->GetNTPContents()->IsLoading()) {
+ content::WindowedNotificationObserver observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::NotificationService::AllSources());
+ observer.Wait();
+ }
+ }
+
SetUpOnMainThread();
#if defined(OS_MACOSX)
autorelease_pool_->Recycle();

Powered by Google App Engine
This is Rietveld 408576698