| OLD | NEW |
| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 ASSERT_TRUE(model->loaded()); | 364 ASSERT_TRUE(model->loaded()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void WaitForBookmarkModelToLoad(Profile* profile) { | 367 void WaitForBookmarkModelToLoad(Profile* profile) { |
| 368 WaitForBookmarkModelToLoad(BookmarkModelFactory::GetForProfile(profile)); | 368 WaitForBookmarkModelToLoad(BookmarkModelFactory::GetForProfile(profile)); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { | 371 void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { |
| 372 if (service->loaded()) | 372 if (service->loaded()) |
| 373 return; | 373 return; |
| 374 |
| 375 content::WindowedNotificationObserver observer( |
| 376 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
| 377 content::Source<TemplateURLService>(service)); |
| 374 service->Load(); | 378 service->Load(); |
| 375 TemplateURLServiceTestUtil::BlockTillServiceProcessesRequests(); | 379 observer.Wait(); |
| 380 |
| 376 ASSERT_TRUE(service->loaded()); | 381 ASSERT_TRUE(service->loaded()); |
| 377 } | 382 } |
| 378 | 383 |
| 379 void WaitForHistoryToLoad(HistoryService* history_service) { | 384 void WaitForHistoryToLoad(HistoryService* history_service) { |
| 380 content::WindowedNotificationObserver history_loaded_observer( | 385 content::WindowedNotificationObserver history_loaded_observer( |
| 381 chrome::NOTIFICATION_HISTORY_LOADED, | 386 chrome::NOTIFICATION_HISTORY_LOADED, |
| 382 content::NotificationService::AllSources()); | 387 content::NotificationService::AllSources()); |
| 383 if (!history_service->BackendLoaded()) | 388 if (!history_service->BackendLoaded()) |
| 384 history_loaded_observer.Wait(); | 389 history_loaded_observer.Wait(); |
| 385 } | 390 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 void HistoryEnumerator::HistoryQueryComplete( | 556 void HistoryEnumerator::HistoryQueryComplete( |
| 552 const base::Closure& quit_task, | 557 const base::Closure& quit_task, |
| 553 HistoryService::Handle request_handle, | 558 HistoryService::Handle request_handle, |
| 554 history::QueryResults* results) { | 559 history::QueryResults* results) { |
| 555 for (size_t i = 0; i < results->size(); ++i) | 560 for (size_t i = 0; i < results->size(); ++i) |
| 556 urls_.push_back((*results)[i].url()); | 561 urls_.push_back((*results)[i].url()); |
| 557 quit_task.Run(); | 562 quit_task.Run(); |
| 558 } | 563 } |
| 559 | 564 |
| 560 } // namespace ui_test_utils | 565 } // namespace ui_test_utils |
| OLD | NEW |