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

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: jar, phajdan feedback 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 void TestingProfile::CreateWebDataService() { 371 void TestingProfile::CreateWebDataService() {
372 WebDataServiceFactory::GetInstance()->SetTestingFactory( 372 WebDataServiceFactory::GetInstance()->SetTestingFactory(
373 this, BuildWebDataService); 373 this, BuildWebDataService);
374 } 374 }
375 375
376 void TestingProfile::BlockUntilBookmarkModelLoaded() { 376 void TestingProfile::BlockUntilBookmarkModelLoaded() {
377 DCHECK(GetBookmarkModel()); 377 DCHECK(GetBookmarkModel());
378 if (GetBookmarkModel()->IsLoaded()) 378 if (GetBookmarkModel()->IsLoaded())
379 return; 379 return;
380 BookmarkLoadObserver observer; 380 MessageLoop::RunID run_id = MessageLoop::current()->GetRunID();
381 BookmarkLoadObserver observer(run_id);
381 GetBookmarkModel()->AddObserver(&observer); 382 GetBookmarkModel()->AddObserver(&observer);
382 MessageLoop::current()->Run(); 383 MessageLoop::current()->RunWithID(run_id);
383 GetBookmarkModel()->RemoveObserver(&observer); 384 GetBookmarkModel()->RemoveObserver(&observer);
384 DCHECK(GetBookmarkModel()->IsLoaded()); 385 DCHECK(GetBookmarkModel()->IsLoaded());
385 } 386 }
386 387
387 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? 388 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
388 void TestingProfile::BlockUntilTopSitesLoaded() { 389 void TestingProfile::BlockUntilTopSitesLoaded() {
389 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( 390 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer(
390 chrome::NOTIFICATION_TOP_SITES_LOADED, 391 chrome::NOTIFICATION_TOP_SITES_LOADED,
391 content::NotificationService::AllSources()); 392 content::NotificationService::AllSources());
392 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) 393 if (!GetHistoryService(Profile::EXPLICIT_ACCESS))
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 710 }
710 711
711 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 712 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
712 return true; 713 return true;
713 } 714 }
714 715
715 base::Callback<ChromeURLDataManagerBackend*(void)> 716 base::Callback<ChromeURLDataManagerBackend*(void)>
716 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 717 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
717 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 718 return base::Callback<ChromeURLDataManagerBackend*(void)>();
718 } 719 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698