OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 5 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 8 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
9 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" | 9 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "components/autofill/core/browser/autofill_metrics.h" | 12 #include "components/autofill/core/browser/autofill_metrics.h" |
13 #include "components/autofill/core/browser/autofill_test_utils.h" | 13 #include "components/autofill/core/browser/autofill_test_utils.h" |
14 #include "components/autofill/core/browser/personal_data_manager.h" | 14 #include "components/autofill/core/browser/personal_data_manager.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using testing::_; | 18 using testing::_; |
19 | 19 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 scoped_ptr<TestPersonalDataManager> personal_data_; | 64 scoped_ptr<TestPersonalDataManager> personal_data_; |
65 }; | 65 }; |
66 | 66 |
67 AutofillCCInfobarDelegateTest::~AutofillCCInfobarDelegateTest() {} | 67 AutofillCCInfobarDelegateTest::~AutofillCCInfobarDelegateTest() {} |
68 | 68 |
69 void AutofillCCInfobarDelegateTest::SetUp() { | 69 void AutofillCCInfobarDelegateTest::SetUp() { |
70 ChromeRenderViewHostTestHarness::SetUp(); | 70 ChromeRenderViewHostTestHarness::SetUp(); |
71 | 71 |
72 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. | 72 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. |
73 autofill::test::DisableSystemServices(profile()->GetPrefs()); | 73 test::DisableSystemServices(profile()->GetPrefs()); |
74 | 74 |
75 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile(), NULL); | 75 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile(), NULL); |
76 | 76 |
77 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); | 77 ChromeAutofillClient::CreateForWebContents(web_contents()); |
78 autofill::TabAutofillManagerDelegate* manager_delegate = | 78 ChromeAutofillClient* autofill_client = |
79 autofill::TabAutofillManagerDelegate::FromWebContents(web_contents()); | 79 ChromeAutofillClient::FromWebContents(web_contents()); |
80 | 80 |
81 personal_data_.reset(new TestPersonalDataManager()); | 81 personal_data_.reset(new TestPersonalDataManager()); |
82 personal_data_->set_database(manager_delegate->GetDatabase()); | 82 personal_data_->set_database(autofill_client->GetDatabase()); |
83 personal_data_->SetPrefService(profile()->GetPrefs()); | 83 personal_data_->SetPrefService(profile()->GetPrefs()); |
84 } | 84 } |
85 | 85 |
86 void AutofillCCInfobarDelegateTest::TearDown() { | 86 void AutofillCCInfobarDelegateTest::TearDown() { |
87 personal_data_.reset(); | 87 personal_data_.reset(); |
88 ChromeRenderViewHostTestHarness::TearDown(); | 88 ChromeRenderViewHostTestHarness::TearDown(); |
89 } | 89 } |
90 | 90 |
91 scoped_ptr<ConfirmInfoBarDelegate> | 91 scoped_ptr<ConfirmInfoBarDelegate> |
92 AutofillCCInfobarDelegateTest::CreateDelegate( | 92 AutofillCCInfobarDelegateTest::CreateDelegate( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 { | 152 { |
153 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); | 153 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); |
154 ASSERT_TRUE(infobar); | 154 ASSERT_TRUE(infobar); |
155 EXPECT_CALL(metric_logger, | 155 EXPECT_CALL(metric_logger, |
156 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)) | 156 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)) |
157 .Times(1); | 157 .Times(1); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 } // namespace autofill | 161 } // namespace autofill |
OLD | NEW |