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

Unified Diff: components/autofill/browser/autocomplete_history_manager_unittest.cc

Issue 12491017: Make WebDataService no longer depend on ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 7 years, 9 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: 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 be8e8755d16ea31b82812b4b115b841b1e01ba43..2d2bb4dbbbcdbf49125b630b21e917a711bddd3f 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();
+ }
+
dhollowa 2013/03/18 18:50:59 nit: remove empty line.
Cait (Slow) 2013/03/18 19:10:35 Done.
+};
dhollowa 2013/03/18 18:50:59 DISALLOW_COPY_AND_ASSIGN
Cait (Slow) 2013/03/18 19:10:35 Done.
+
class MockAutofillManagerDelegate
: public autofill::TestAutofillManagerDelegate {
public:
@@ -73,14 +93,15 @@ class MockAutofillManagerDelegate
class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
protected:
AutocompleteHistoryManagerTest()
- : db_thread_(BrowserThread::DB) {
+ : ui_thread_(BrowserThread::UI, &message_loop_),
+ db_thread_(BrowserThread::DB) {
}
virtual void SetUp() OVERRIDE {
ChromeRenderViewHostTestHarness::SetUp();
web_data_service_ = new MockWebDataService();
WebDataServiceFactory::GetInstance()->SetTestingFactory(
- profile(), MockWebDataService::Build);
+ profile(), MockWebDataServiceWrapper::Build);
autocomplete_manager_.reset(new AutocompleteHistoryManager(web_contents()));
}
@@ -88,8 +109,11 @@ class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
autocomplete_manager_.reset();
web_data_service_ = NULL;
ChromeRenderViewHostTestHarness::TearDown();
+ message_loop_.RunUntilIdle();
+
}
+ content::TestBrowserThread ui_thread_;
content::TestBrowserThread db_thread_;
scoped_refptr<MockWebDataService> web_data_service_;
scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_;
« chrome/browser/webdata/web_data_service_factory.cc ('K') | « chrome/test/base/testing_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698