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

Side by Side 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: Modified AutofillCCInfoBarDelegate unit-tests. Created 6 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 unified diff | Download patch
OLDNEW
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 "components/autofill/content/browser/autofill_cc_infobar_delegate.h"
Ilya Sherman 2014/11/19 21:22:46 Can this entire test file be moved into the compon
droger 2014/11/20 13:18:07 This file has a still a lot of //chrome dependency
Pritam Nikam 2014/11/21 08:26:25 I'll be doing this in seperate CL. As it has depen
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/chrome_autofill_client.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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 metric_logger, 99 web_contents(), metric_logger,
100 base::Bind( 100 base::Bind(
101 base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard), 101 base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard),
102 base::Unretained(personal_data_.get()), 102 base::Unretained(personal_data_.get()), credit_card));
103 credit_card));
104 } 103 }
105 104
106 // Test that credit card infobar metrics are logged correctly. 105 // Test that credit card infobar metrics are logged correctly.
107 TEST_F(AutofillCCInfobarDelegateTest, Metrics) { 106 TEST_F(AutofillCCInfobarDelegateTest, Metrics) {
108 MockAutofillMetrics metric_logger; 107 MockAutofillMetrics metric_logger;
109 ::testing::InSequence dummy; 108 ::testing::InSequence dummy;
110 109
111 // Accept the infobar. 110 // Accept the infobar.
112 { 111 {
113 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); 112 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 151 {
153 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger)); 152 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
154 ASSERT_TRUE(infobar); 153 ASSERT_TRUE(infobar);
155 EXPECT_CALL(metric_logger, 154 EXPECT_CALL(metric_logger,
156 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)) 155 LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED))
157 .Times(1); 156 .Times(1);
158 } 157 }
159 } 158 }
160 159
161 } // namespace autofill 160 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698