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

Unified Diff: components/autofill/core/browser/autofill_metrics_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: 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_metrics_unittest.cc
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc
index aad875b30c83e91d1b99b7d379bdfecac37a3a52..1801ca1fababa816ca54f210c8c5c2a8183cf006 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -22,6 +22,7 @@
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/test_autofill_driver.h"
+#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/forms_seen_state.h"
@@ -94,8 +95,9 @@ class TestPersonalDataManager : public PersonalDataManager {
CreateTestAutofillProfiles(&web_profiles_);
}
- void SetBrowserContext(content::BrowserContext* context) {
- set_browser_context(context);
+ void SetAutofillWebDataService(
+ scoped_refptr<AutofillWebDataService> webdata) {
+ set_autofill_webdata_service(webdata);
Ilya Sherman 2013/11/14 02:22:02 Ditto here.
blundell 2013/11/14 16:46:30 Done.
}
void SetPrefService(PrefService* pref_service) {
@@ -288,15 +290,16 @@ void AutofillMetricsTest::SetUp() {
PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile(), NULL);
TabAutofillManagerDelegate::CreateForWebContents(web_contents());
+ autofill::TabAutofillManagerDelegate* manager_delegate =
+ autofill::TabAutofillManagerDelegate::FromWebContents(web_contents());
personal_data_.reset(new TestPersonalDataManager());
- personal_data_->SetBrowserContext(profile());
+ personal_data_->SetAutofillWebDataService(
+ manager_delegate->GetAutofillWebDataService());
personal_data_->SetPrefService(profile()->GetPrefs());
autofill_driver_.reset(new TestAutofillDriver(web_contents()));
autofill_manager_.reset(new TestAutofillManager(
- autofill_driver_.get(),
- TabAutofillManagerDelegate::FromWebContents(web_contents()),
- personal_data_.get()));
+ autofill_driver_.get(), manager_delegate, personal_data_.get()));
external_delegate_.reset(new AutofillExternalDelegate(
web_contents(),
@@ -1009,7 +1012,9 @@ TEST_F(AutofillMetricsTest, AutofillIsEnabledAtStartup) {
personal_data_->set_autofill_enabled(true);
EXPECT_CALL(*personal_data_->metric_logger(),
LogIsAutofillEnabledAtStartup(true)).Times(1);
- personal_data_->Init(profile(),
+ autofill::TabAutofillManagerDelegate* manager_delegate =
+ autofill::TabAutofillManagerDelegate::FromWebContents(web_contents());
+ personal_data_->Init(manager_delegate->GetAutofillWebDataService(),
profile()->GetPrefs(),
profile()->IsOffTheRecord());
}
@@ -1019,7 +1024,9 @@ TEST_F(AutofillMetricsTest, AutofillIsDisabledAtStartup) {
personal_data_->set_autofill_enabled(false);
EXPECT_CALL(*personal_data_->metric_logger(),
LogIsAutofillEnabledAtStartup(false)).Times(1);
- personal_data_->Init(profile(),
+ autofill::TabAutofillManagerDelegate* manager_delegate =
+ autofill::TabAutofillManagerDelegate::FromWebContents(web_contents());
+ personal_data_->Init(manager_delegate->GetAutofillWebDataService(),
profile()->GetPrefs(),
profile()->IsOffTheRecord());
}

Powered by Google App Engine
This is Rietveld 408576698