| 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();
|
|
|