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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compile Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 void TestingProfile::CreateWebDataService() { 372 void TestingProfile::CreateWebDataService() {
373 WebDataServiceFactory::GetInstance()->SetTestingFactory( 373 WebDataServiceFactory::GetInstance()->SetTestingFactory(
374 this, BuildWebDataService); 374 this, BuildWebDataService);
375 } 375 }
376 376
377 void TestingProfile::BlockUntilBookmarkModelLoaded() { 377 void TestingProfile::BlockUntilBookmarkModelLoaded() {
378 DCHECK(GetBookmarkModel()); 378 DCHECK(GetBookmarkModel());
379 if (GetBookmarkModel()->IsLoaded()) 379 if (GetBookmarkModel()->IsLoaded())
380 return; 380 return;
381 BookmarkLoadObserver observer; 381 MessageLoop::RunLoop run_loop;
382 BookmarkLoadObserver observer(run_loop.AsWeakPtr());
382 GetBookmarkModel()->AddObserver(&observer); 383 GetBookmarkModel()->AddObserver(&observer);
383 MessageLoop::current()->Run(); 384 run_loop.Run();
384 GetBookmarkModel()->RemoveObserver(&observer); 385 GetBookmarkModel()->RemoveObserver(&observer);
385 DCHECK(GetBookmarkModel()->IsLoaded()); 386 DCHECK(GetBookmarkModel()->IsLoaded());
386 } 387 }
387 388
388 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? 389 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
389 void TestingProfile::BlockUntilTopSitesLoaded() { 390 void TestingProfile::BlockUntilTopSitesLoaded() {
390 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( 391 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer(
391 chrome::NOTIFICATION_TOP_SITES_LOADED, 392 chrome::NOTIFICATION_TOP_SITES_LOADED,
392 content::NotificationService::AllSources()); 393 content::NotificationService::AllSources());
393 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) 394 if (!GetHistoryService(Profile::EXPLICIT_ACCESS))
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 713 }
713 714
714 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 715 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
715 return true; 716 return true;
716 } 717 }
717 718
718 base::Callback<ChromeURLDataManagerBackend*(void)> 719 base::Callback<ChromeURLDataManagerBackend*(void)>
719 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 720 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
720 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 721 return base::Callback<ChromeURLDataManagerBackend*(void)>();
721 } 722 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698