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

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

Issue 12952005: Delay bookmarks load while the profile is loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address mirandac's comments: add BookmarkModel::StartLoading Created 7 years, 8 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
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/ui_test_utils.h" 5 #include "chrome/test/base/ui_test_utils.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 int type, 411 int type,
412 const content::NotificationSource& source) { 412 const content::NotificationSource& source) {
413 content::NotificationRegistrar registrar; 413 content::NotificationRegistrar registrar;
414 registrar.Add(observer, type, source); 414 registrar.Add(observer, type, source);
415 content::RunMessageLoop(); 415 content::RunMessageLoop();
416 } 416 }
417 417
418 void WaitForBookmarkModelToLoad(BookmarkModel* model) { 418 void WaitForBookmarkModelToLoad(BookmarkModel* model) {
419 if (model->IsLoaded()) 419 if (model->IsLoaded())
420 return; 420 return;
421 model->StartLoading();
421 base::RunLoop run_loop; 422 base::RunLoop run_loop;
422 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); 423 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
423 model->AddObserver(&observer); 424 model->AddObserver(&observer);
424 content::RunThisRunLoop(&run_loop); 425 content::RunThisRunLoop(&run_loop);
425 model->RemoveObserver(&observer); 426 model->RemoveObserver(&observer);
426 ASSERT_TRUE(model->IsLoaded()); 427 ASSERT_TRUE(model->IsLoaded());
427 } 428 }
428 429
429 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { 430 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) {
430 if (service->loaded()) 431 if (service->loaded())
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 void HistoryEnumerator::HistoryQueryComplete( 684 void HistoryEnumerator::HistoryQueryComplete(
684 const base::Closure& quit_task, 685 const base::Closure& quit_task,
685 HistoryService::Handle request_handle, 686 HistoryService::Handle request_handle,
686 history::QueryResults* results) { 687 history::QueryResults* results) {
687 for (size_t i = 0; i < results->size(); ++i) 688 for (size_t i = 0; i < results->size(); ++i)
688 urls_.push_back((*results)[i].url()); 689 urls_.push_back((*results)[i].url());
689 quit_task.Run(); 690 quit_task.Run();
690 } 691 }
691 692
692 } // namespace ui_test_utils 693 } // namespace ui_test_utils
OLDNEW
« chrome/browser/bookmarks/bookmark_model.cc ('K') | « chrome/browser/profiles/profile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698