| Index: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
|
| diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
|
| index b94dbc9c66bb32eabdfbffde89b4f41c9ec00850..8993eee8242dbd00ccd627ba5b63d1a0fd686400 100644
|
| --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
|
| +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
|
| @@ -45,6 +45,7 @@
|
| #include "chrome/test/base/testing_browser_process.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "chrome/test/base/testing_profile_manager.h"
|
| +#include "components/history/core/browser/test_history_client.h"
|
| #include "components/keyed_service/content/refcounted_browser_context_keyed_service.h"
|
| #include "components/signin/core/browser/signin_manager.h"
|
| #include "components/sync_driver/data_type_error_handler_mock.h"
|
| @@ -105,21 +106,39 @@ class HistoryBackendMock : public HistoryBackend {
|
|
|
| class HistoryServiceMock : public HistoryService {
|
| public:
|
| - explicit HistoryServiceMock(Profile* profile) : HistoryService(profile) {}
|
| + HistoryServiceMock(history::HistoryClient* client, Profile* profile)
|
| + : HistoryService(client, profile) {}
|
| MOCK_METHOD2(ScheduleDBTask, void(history::HistoryDBTask*,
|
| CancelableRequestConsumerBase*));
|
| MOCK_METHOD0(Shutdown, void());
|
|
|
| void ShutdownBaseService() {
|
| - HistoryService::Shutdown();
|
| + HistoryService::Cleanup();
|
| + }
|
| +};
|
| +
|
| +class HistoryClientMock : public history::TestHistoryClient,
|
| + public KeyedService {
|
| + public:
|
| + explicit HistoryClientMock(Profile* profile) {
|
| + history_service_.reset(new HistoryServiceMock(this, profile));
|
| + }
|
| +
|
| + HistoryServiceMock* history_service() {
|
| + return history_service_.get();
|
| + }
|
| +
|
| + // KeyedService:
|
| + virtual void Shutdown() OVERRIDE {
|
| + history_service_->Cleanup();
|
| }
|
|
|
| private:
|
| - virtual ~HistoryServiceMock() {}
|
| + scoped_ptr<HistoryServiceMock> history_service_;
|
| };
|
|
|
| KeyedService* BuildHistoryService(content::BrowserContext* profile) {
|
| - return new HistoryServiceMock(static_cast<Profile*>(profile));
|
| + return new HistoryClientMock(static_cast<Profile*>(profile));
|
| }
|
|
|
| class TestTypedUrlModelAssociator : public TypedUrlModelAssociator {
|
| @@ -210,9 +229,9 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
|
| invalidation::InvalidationServiceFactory::GetInstance()->SetTestingFactory(
|
| profile_, invalidation::FakeInvalidationService::Build);
|
| history_backend_ = new HistoryBackendMock();
|
| - history_service_ = static_cast<HistoryServiceMock*>(
|
| + history_service_ = static_cast<HistoryClientMock*>(
|
| HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(
|
| - profile_, BuildHistoryService));
|
| + profile_, BuildHistoryService))->history_service();
|
| EXPECT_CALL((*history_service_), ScheduleDBTask(_, _))
|
| .WillRepeatedly(RunTaskOnDBThread(history_thread_.get(),
|
| history_backend_.get()));
|
|
|