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

Unified Diff: chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc

Issue 242693003: Introduce BookmarkClient interface to abstract embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
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 73babc4d99342c109231b4ec97e8977dfe394464..6d9570743d4f81ebebc6615b3bc42161c08b4012 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 "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/bookmarks/bookmark_test_helpers.h"
+#include "chrome/browser/bookmarks/chrome_bookmark_client.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
@@ -56,14 +57,19 @@ class HistoryMock : public HistoryService {
KeyedService* BuildBookmarkModel(content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
- BookmarkModel* bookmark_model = new BookmarkModel(profile);
- bookmark_model->Load(profile->GetIOTaskRunner());
- return bookmark_model;
+ ChromeBookmarkClient* bookmark_client = new ChromeBookmarkClient(profile);
+ bookmark_client->model()->Load(
+ profile->GetPrefs(),
+ profile->GetPath(),
+ profile->GetIOTaskRunner(),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI));
+ return bookmark_client;
}
KeyedService* BuildBookmarkModelWithoutLoading(
content::BrowserContext* profile) {
- return new BookmarkModel(static_cast<Profile*>(profile));
+ return new ChromeBookmarkClient(static_cast<Profile*>(profile));
}
KeyedService* BuildHistoryService(content::BrowserContext* profile) {
@@ -100,14 +106,16 @@ class SyncBookmarkDataTypeControllerTest : public testing::Test {
void CreateBookmarkModel(BookmarkLoadPolicy bookmark_load_policy) {
if (bookmark_load_policy == LOAD_MODEL) {
- bookmark_model_ = static_cast<BookmarkModel*>(
- BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
- &profile_, BuildBookmarkModel));
+ bookmark_model_ =
+ static_cast<ChromeBookmarkClient*>(
+ BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
+ &profile_, BuildBookmarkModel))->model();
test::WaitForBookmarkModelToLoad(bookmark_model_);
} else {
- bookmark_model_ = static_cast<BookmarkModel*>(
- BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
- &profile_, BuildBookmarkModelWithoutLoading));
+ bookmark_model_ =
+ static_cast<ChromeBookmarkClient*>(
+ BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
+ &profile_, BuildBookmarkModelWithoutLoading))->model();
}
}
@@ -180,7 +188,11 @@ TEST_F(SyncBookmarkDataTypeControllerTest, StartBookmarkModelNotReady) {
base::Unretained(&model_load_callback_)));
EXPECT_EQ(DataTypeController::MODEL_STARTING, bookmark_dtc_->state());
- bookmark_model_->Load(profile_.GetIOTaskRunner());
+ bookmark_model_->Load(profile_.GetPrefs(),
+ profile_.GetPath(),
+ profile_.GetIOTaskRunner(),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI));
test::WaitForBookmarkModelToLoad(bookmark_model_);
EXPECT_EQ(DataTypeController::MODEL_LOADED, bookmark_dtc_->state());

Powered by Google App Engine
This is Rietveld 408576698