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

Unified Diff: chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc

Issue 710453002: [Autofill] Componentize AutofillCCInfoBarDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years 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: chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc
index 3aa5b178449d7503d7cf225f2853ed89f39d2816..5046504332f15b3e3b5ae5b07977db52e60c65fa 100644
--- a/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc
+++ b/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
+#include "components/autofill/core/browser/autofill_cc_infobar_delegate.h"
#include "base/memory/scoped_ptr.h"
#include "base/test/histogram_tester.h"
@@ -50,6 +50,7 @@ class AutofillCCInfobarDelegateTest : public ChromeRenderViewHostTestHarness {
protected:
scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate();
+ ContentAutofillDriver* GetAutofillDriverForMainFrame();
scoped_ptr<TestPersonalDataManager> personal_data_;
};
@@ -68,6 +69,12 @@ void AutofillCCInfobarDelegateTest::SetUp() {
ChromeAutofillClient* autofill_client =
ChromeAutofillClient::FromWebContents(web_contents());
+ // Associate the |ContentAutofillDriverFactory| to the |WebContents|.
+ ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
+ web_contents(), autofill_client,
+ g_browser_process->GetApplicationLocale(),
+ AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
+
personal_data_.reset(new TestPersonalDataManager());
personal_data_->set_database(autofill_client->GetDatabase());
personal_data_->SetPrefService(profile()->GetPrefs());
@@ -78,12 +85,22 @@ void AutofillCCInfobarDelegateTest::TearDown() {
ChromeRenderViewHostTestHarness::TearDown();
}
+ContentAutofillDriver*
+AutofillCCInfobarDelegateTest::GetAutofillDriverForMainFrame() {
+ ContentAutofillDriverFactory* autofill_driver_factory =
+ ContentAutofillDriverFactory::FromWebContents(web_contents());
+
+ return autofill_driver_factory->DriverForFrame(
+ web_contents()->GetMainFrame());
+}
+
scoped_ptr<ConfirmInfoBarDelegate>
AutofillCCInfobarDelegateTest::CreateDelegate() {
base::HistogramTester histogram_tester;
CreditCard credit_card;
- scoped_ptr<ConfirmInfoBarDelegate> delegate(
- AutofillCCInfoBarDelegate::Create(base::Bind(
+ scoped_ptr<ConfirmInfoBarDelegate> delegate(AutofillCCInfoBarDelegate::Create(
+ GetAutofillDriverForMainFrame(),
+ base::Bind(
base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard),
base::Unretained(personal_data_.get()), credit_card)));
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar",

Powered by Google App Engine
This is Rietveld 408576698