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

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 71683003: Have AutofillManagerDelegate supply the AutofillWebDataService to core code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 7 years, 1 month 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/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 8ffc6054ded84219a80750f3973beec78254b131..3b0f7c0cce6802c307bf880b61a425b24eae7e80 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -35,6 +35,7 @@
#include "components/autofill/core/browser/test_autofill_driver.h"
#include "components/autofill/core/browser/test_autofill_external_delegate.h"
#include "components/autofill/core/browser/test_autofill_manager_delegate.h"
+#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/autofill/core/common/autofill_messages.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/form_data.h"
@@ -75,13 +76,8 @@ class TestPersonalDataManager : public PersonalDataManager {
CreateTestCreditCards(&credit_cards_);
}
- void SetBrowserContext(content::BrowserContext* context) {
- set_browser_context(context);
- }
-
- void SetPrefService(PrefService* pref_service) {
- set_pref_service(pref_service);
- }
+ using PersonalDataManager::set_database;
+ using PersonalDataManager::set_pref_service;
// Factory method for keyed service. PersonalDataManager is NULL for testing.
static BrowserContextKeyedService* Build(content::BrowserContext* profile) {
@@ -637,16 +633,15 @@ class AutofillManagerTest : public ChromeRenderViewHostTestHarness {
autofill::PersonalDataManagerFactory::GetInstance()->SetTestingFactory(
profile(), TestPersonalDataManager::Build);
-
autofill::TabAutofillManagerDelegate::CreateForWebContents(web_contents());
- personal_data_.SetBrowserContext(profile());
- personal_data_.SetPrefService(profile()->GetPrefs());
+ autofill::TabAutofillManagerDelegate* manager_delegate =
+ autofill::TabAutofillManagerDelegate::FromWebContents(web_contents());
+ personal_data_.set_database(manager_delegate->GetDatabase());
+ personal_data_.set_pref_service(profile()->GetPrefs());
autofill_driver_.reset(new MockAutofillDriver(web_contents()));
autofill_manager_.reset(new TestAutofillManager(
- autofill_driver_.get(),
- autofill::TabAutofillManagerDelegate::FromWebContents(web_contents()),
- &personal_data_));
+ autofill_driver_.get(), manager_delegate, &personal_data_));
external_delegate_.reset(new TestAutofillExternalDelegate(
web_contents(),
@@ -664,9 +659,9 @@ class AutofillManagerTest : public ChromeRenderViewHostTestHarness {
autofill_driver_.reset();
ChromeRenderViewHostTestHarness::TearDown();
- // Remove the BrowserContext so TestPersonalDataManager does not need to
- // care about removing self as an observer in destruction.
- personal_data_.SetBrowserContext(NULL);
+ // Remove the AutofillWebDataService so TestPersonalDataManager does not
+ // need to care about removing self as an observer in destruction.
+ personal_data_.set_database(scoped_refptr<AutofillWebDataService>(NULL));
}
void GetAutofillSuggestions(int query_id,

Powered by Google App Engine
This is Rietveld 408576698