Chromium Code Reviews| Index: chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc |
| diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc |
| index 36fd925e5940840d027187be9b040052339c51c3..d1f6887e795bfaa2256bfe1c8d309f932c6b2bee 100644 |
| --- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc |
| +++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc |
| @@ -13,6 +13,7 @@ |
| #include "base/run_loop.h" |
| #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| +#include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/history/history_service.h" |
| #include "chrome/browser/history/history_service_factory.h" |
| @@ -62,23 +63,26 @@ class HistoryMock : public HistoryService { |
| KeyedService* BuildBookmarkModel(content::BrowserContext* context) { |
| Profile* profile = static_cast<Profile*>(context); |
| ChromeBookmarkClient* bookmark_client = |
| - new ChromeBookmarkClient(profile, false); |
| - bookmark_client->model()->Load( |
| - profile->GetPrefs(), |
| - profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| - profile->GetPath(), |
| - profile->GetIOTaskRunner(), |
| - content::BrowserThread::GetMessageLoopProxyForThread( |
| - content::BrowserThread::UI)); |
| - return bookmark_client; |
| + ChromeBookmarkClientFactory::GetForProfile(profile); |
| + BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client, false); |
| + bookmark_client->Init(bookmark_model); |
| + bookmark_model->Load(profile->GetPrefs(), |
| + profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| + profile->GetPath(), |
| + profile->GetIOTaskRunner(), |
| + content::BrowserThread::GetMessageLoopProxyForThread( |
| + content::BrowserThread::UI)); |
| + return bookmark_model; |
| } |
| KeyedService* BuildBookmarkModelWithoutLoading( |
| content::BrowserContext* context) { |
| Profile* profile = static_cast<Profile*>(context); |
| ChromeBookmarkClient* bookmark_client = |
| - new ChromeBookmarkClient(profile, false); |
| - return bookmark_client; |
| + ChromeBookmarkClientFactory::GetForProfile(profile); |
| + BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client, false); |
| + bookmark_client->Init(bookmark_model); |
| + return bookmark_model; |
| } |
| KeyedService* BuildHistoryService(content::BrowserContext* profile) { |
| @@ -115,16 +119,14 @@ class SyncBookmarkDataTypeControllerTest : public testing::Test { |
| void CreateBookmarkModel(BookmarkLoadPolicy bookmark_load_policy) { |
| if (bookmark_load_policy == LOAD_MODEL) { |
| - bookmark_model_ = |
| - static_cast<ChromeBookmarkClient*>( |
| - BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| - &profile_, BuildBookmarkModel))->model(); |
| + bookmark_model_ = static_cast<BookmarkModel*>( |
| + BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
|
tfarina
2014/06/04 16:09:19
This code is now almost the same as TestingProfile
|
| + &profile_, BuildBookmarkModel)); |
| test::WaitForBookmarkModelToLoad(bookmark_model_); |
| } else { |
| - bookmark_model_ = |
| - static_cast<ChromeBookmarkClient*>( |
| - BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| - &profile_, BuildBookmarkModelWithoutLoading))->model(); |
| + bookmark_model_ = static_cast<BookmarkModel*>( |
| + BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( |
| + &profile_, BuildBookmarkModelWithoutLoading)); |
| } |
| } |