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

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

Issue 23710022: Convert NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED to CallbackList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up 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 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/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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 const content::NotificationSource& source) { 349 const content::NotificationSource& source) {
350 content::NotificationRegistrar registrar; 350 content::NotificationRegistrar registrar;
351 registrar.Add(observer, type, source); 351 registrar.Add(observer, type, source);
352 content::RunMessageLoop(); 352 content::RunMessageLoop();
353 } 353 }
354 354
355 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { 355 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) {
356 if (service->loaded()) 356 if (service->loaded())
357 return; 357 return;
358 358
359 content::WindowedNotificationObserver observer( 359 base::RunLoop run_loop;
360 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, 360 scoped_ptr<TemplateURLService::Subscription> sub =
361 content::Source<TemplateURLService>(service)); 361 service->RegisterOnLoadedCallback(
362 content::GetQuitTaskForRunLoop(&run_loop));
362 service->Load(); 363 service->Load();
363 observer.Wait(); 364 content::RunThisRunLoop(&run_loop);
Avi (use Gerrit) 2013/10/02 22:27:52 MessageLoopRunner
Cait (Slow) 2013/10/03 15:36:45 Done.
364
365 ASSERT_TRUE(service->loaded()); 365 ASSERT_TRUE(service->loaded());
366 } 366 }
367 367
368 void WaitForHistoryToLoad(HistoryService* history_service) { 368 void WaitForHistoryToLoad(HistoryService* history_service) {
369 content::WindowedNotificationObserver history_loaded_observer( 369 content::WindowedNotificationObserver history_loaded_observer(
370 chrome::NOTIFICATION_HISTORY_LOADED, 370 chrome::NOTIFICATION_HISTORY_LOADED,
371 content::NotificationService::AllSources()); 371 content::NotificationService::AllSources());
372 if (!history_service->BackendLoaded()) 372 if (!history_service->BackendLoaded())
373 history_loaded_observer.Wait(); 373 history_loaded_observer.Wait();
374 } 374 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 void HistoryEnumerator::HistoryQueryComplete( 540 void HistoryEnumerator::HistoryQueryComplete(
541 const base::Closure& quit_task, 541 const base::Closure& quit_task,
542 HistoryService::Handle request_handle, 542 HistoryService::Handle request_handle,
543 history::QueryResults* results) { 543 history::QueryResults* results) {
544 for (size_t i = 0; i < results->size(); ++i) 544 for (size_t i = 0; i < results->size(); ++i)
545 urls_.push_back((*results)[i].url()); 545 urls_.push_back((*results)[i].url());
546 quit_task.Run(); 546 quit_task.Run();
547 } 547 }
548 548
549 } // namespace ui_test_utils 549 } // namespace ui_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698