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/tab_autofill_manager_delegate.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" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 scoped_ptr<ConfirmInfoBarDelegate> | 91 scoped_ptr<ConfirmInfoBarDelegate> |
92 AutofillCCInfobarDelegateTest::CreateDelegate( | 92 AutofillCCInfobarDelegateTest::CreateDelegate( |
93 MockAutofillMetrics* metric_logger) { | 93 MockAutofillMetrics* metric_logger) { |
94 EXPECT_CALL(*metric_logger, | 94 EXPECT_CALL(*metric_logger, |
95 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); | 95 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN)); |
96 | 96 |
97 CreditCard credit_card; | 97 CreditCard credit_card; |
98 return AutofillCCInfoBarDelegate::Create( | 98 return AutofillCCInfoBarDelegate::Create( |
| 99 web_contents(), |
99 metric_logger, | 100 metric_logger, |
100 base::Bind( | 101 base::Bind( |
101 base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard), | 102 base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard), |
102 base::Unretained(personal_data_.get()), | 103 base::Unretained(personal_data_.get()), |
103 credit_card)); | 104 credit_card)); |
104 } | 105 } |
105 | 106 |
106 // Test that credit card infobar metrics are logged correctly. | 107 // Test that credit card infobar metrics are logged correctly. |
107 TEST_F(AutofillCCInfobarDelegateTest, Metrics) { | 108 TEST_F(AutofillCCInfobarDelegateTest, Metrics) { |
108 MockAutofillMetrics metric_logger; | 109 MockAutofillMetrics metric_logger; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 { | 153 { |
153 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); | 154 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); |
154 ASSERT_TRUE(infobar); | 155 ASSERT_TRUE(infobar); |
155 EXPECT_CALL(metric_logger, | 156 EXPECT_CALL(metric_logger, |
156 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)) | 157 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)) |
157 .Times(1); | 158 .Times(1); |
158 } | 159 } |
159 } | 160 } |
160 | 161 |
161 } // namespace autofill | 162 } // namespace autofill |
OLD | NEW |