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..7a3fe1f054f3ae45dc0d615b7021be8606e665ea 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" |
@@ -10,6 +10,9 @@ |
#include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
#include "chrome/test/base/chrome_render_view_host_test_harness.h" |
#include "chrome/test/base/testing_profile.h" |
+#include "components/autofill/content/browser/content_autofill_driver.h" |
+#include "components/autofill/content/browser/content_autofill_driver_factory.h" |
+#include "components/autofill/core/browser/autofill_manager.h" |
#include "components/autofill/core/browser/autofill_test_utils.h" |
#include "components/autofill/core/browser/personal_data_manager.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -50,6 +53,7 @@ class AutofillCCInfobarDelegateTest : public ChromeRenderViewHostTestHarness { |
protected: |
scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate(); |
+ ContentAutofillDriver* GetAutofillDriverForMainFrame(); |
scoped_ptr<TestPersonalDataManager> personal_data_; |
}; |
Peter Kasting
2014/12/23 21:20:34
Nit: While here: DISALLOW_COPY_AND_ASSIGN()
Pritam Nikam
2014/12/24 11:16:57
Done.
|
@@ -68,6 +72,11 @@ void AutofillCCInfobarDelegateTest::SetUp() { |
ChromeAutofillClient* autofill_client = |
ChromeAutofillClient::FromWebContents(web_contents()); |
+ // Associate the |ContentAutofillDriverFactory| to the |WebContents|. |
Peter Kasting
2014/12/23 21:20:34
Nit: Only use ||s for variable names, not type nam
Pritam Nikam
2014/12/24 11:16:57
Done.
|
+ ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( |
+ web_contents(), autofill_client, "en-US", |
+ AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); |
+ |
personal_data_.reset(new TestPersonalDataManager()); |
personal_data_->set_database(autofill_client->GetDatabase()); |
personal_data_->SetPrefService(profile()->GetPrefs()); |
@@ -78,12 +87,22 @@ void AutofillCCInfobarDelegateTest::TearDown() { |
ChromeRenderViewHostTestHarness::TearDown(); |
} |
+ContentAutofillDriver* |
+AutofillCCInfobarDelegateTest::GetAutofillDriverForMainFrame() { |
+ ContentAutofillDriverFactory* autofill_driver_factory = |
+ ContentAutofillDriverFactory::FromWebContents(web_contents()); |
+ |
Peter Kasting
2014/12/23 21:20:34
Nit: Blank here is unnecessary
Pritam Nikam
2014/12/24 11:16:57
Done.
|
+ 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", |