| Index: components/autofill/browser/autocomplete_history_manager_unittest.cc
|
| diff --git a/components/autofill/browser/autocomplete_history_manager_unittest.cc b/components/autofill/browser/autocomplete_history_manager_unittest.cc
|
| index 634c8c9fd65c10e9634652c640ae65608f75589c..d01d658158e32449fb669bd84a516a5118d54a1b 100644
|
| --- a/components/autofill/browser/autocomplete_history_manager_unittest.cc
|
| +++ b/components/autofill/browser/autocomplete_history_manager_unittest.cc
|
| @@ -36,14 +36,15 @@ class MockWebDataService : public WebDataService {
|
| current_mock_web_data_service_ = this;
|
| }
|
|
|
| - static scoped_refptr<RefcountedProfileKeyedService> Build(Profile* profile) {
|
| + MOCK_METHOD1(AddFormFields, void(const std::vector<FormFieldData>&));
|
| +
|
| + static scoped_refptr<MockWebDataService> GetCurrent() {
|
| + if (!current_mock_web_data_service_) {
|
| + return new MockWebDataService();
|
| + }
|
| return current_mock_web_data_service_;
|
| }
|
|
|
| - virtual void ShutdownOnUIThread() OVERRIDE {}
|
| -
|
| - MOCK_METHOD1(AddFormFields, void(const std::vector<FormFieldData>&));
|
| -
|
| protected:
|
| virtual ~MockWebDataService() {}
|
|
|
| @@ -55,6 +56,25 @@ class MockWebDataService : public WebDataService {
|
|
|
| MockWebDataService* MockWebDataService::current_mock_web_data_service_ = NULL;
|
|
|
| +class MockWebDataServiceWrapper : public WebDataServiceWrapper {
|
| + public:
|
| + static ProfileKeyedService* Build(Profile* profile) {
|
| + return new MockWebDataServiceWrapper();
|
| + }
|
| +
|
| + MockWebDataServiceWrapper() {
|
| + }
|
| +
|
| + void Shutdown() OVERRIDE {}
|
| +
|
| + ~MockWebDataServiceWrapper() {}
|
| +
|
| + scoped_refptr<WebDataService> GetWebData() OVERRIDE {
|
| + return MockWebDataService::GetCurrent();
|
| + }
|
| +
|
| +};
|
| +
|
| class MockAutofillManagerDelegate
|
| : public autofill::TestAutofillManagerDelegate {
|
| public:
|
| @@ -80,7 +100,7 @@ class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
|
| ChromeRenderViewHostTestHarness::SetUp();
|
| web_data_service_ = new MockWebDataService();
|
| WebDataServiceFactory::GetInstance()->SetTestingFactory(
|
| - profile(), MockWebDataService::Build);
|
| + profile(), MockWebDataServiceWrapper::Build);
|
| autocomplete_manager_.reset(new AutocompleteHistoryManager(web_contents()));
|
| }
|
|
|
| @@ -88,6 +108,7 @@ class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
|
| autocomplete_manager_.reset();
|
| web_data_service_ = NULL;
|
| ChromeRenderViewHostTestHarness::TearDown();
|
| +
|
| }
|
|
|
| content::TestBrowserThread db_thread_;
|
|
|