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

Unified Diff: components/autofill/core/browser/autofill_metrics_unittest.cc

Issue 177923004: Moved CCInfobarDelegate tests out of AutofillMetricsTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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: components/autofill/core/browser/autofill_metrics_unittest.cc
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc
index 0b996571baabb1c6fa44d6678eafb01b57ba8471..b4b64dfbe240b1b1189c242fae5384dc940e91c9 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -11,7 +11,6 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
-#include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -242,9 +241,6 @@ class AutofillMetricsTest : public ChromeRenderViewHostTestHarness {
virtual void TearDown() OVERRIDE;
protected:
- scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate(
- MockAutofillMetrics* metric_logger);
-
scoped_ptr<TestAutofillDriver> autofill_driver_;
scoped_ptr<TestAutofillManager> autofill_manager_;
scoped_ptr<TestPersonalDataManager> personal_data_;
@@ -291,19 +287,6 @@ void AutofillMetricsTest::TearDown() {
ChromeRenderViewHostTestHarness::TearDown();
}
-scoped_ptr<ConfirmInfoBarDelegate> AutofillMetricsTest::CreateDelegate(
- MockAutofillMetrics* metric_logger) {
- EXPECT_CALL(*metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN));
-
- CreditCard credit_card;
- return AutofillCCInfoBarDelegate::Create(
- metric_logger,
- base::Bind(
- base::IgnoreResult(&TestPersonalDataManager::SaveImportedCreditCard),
- base::Unretained(personal_data_.get()), credit_card));
-}
-
// Test that we log quality metrics appropriately.
TEST_F(AutofillMetricsTest, QualityMetrics) {
// Set up our form data.
@@ -722,54 +705,6 @@ TEST_F(AutofillMetricsTest, AutofillIsEnabledAtPageLoad) {
autofill::NO_SPECIAL_FORMS_SEEN);
}
-// Test that credit card infobar metrics are logged correctly.
-TEST_F(AutofillMetricsTest, CreditCardInfoBar) {
- testing::NiceMock<MockAutofillMetrics> metric_logger;
- ::testing::InSequence dummy;
-
- // Accept the infobar.
- {
- scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
- ASSERT_TRUE(infobar);
- EXPECT_CALL(*personal_data_, SaveImportedCreditCard(_));
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_ACCEPTED)).Times(1);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)).Times(0);
- EXPECT_TRUE(infobar->Accept());
- }
-
- // Cancel the infobar.
- {
- scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
- ASSERT_TRUE(infobar);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED)).Times(1);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)).Times(0);
- EXPECT_TRUE(infobar->Cancel());
- }
-
- // Dismiss the infobar.
- {
- scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
- ASSERT_TRUE(infobar);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED)).Times(1);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)).Times(0);
- infobar->InfoBarDismissed();
- }
-
- // Ignore the infobar.
- {
- scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(&metric_logger));
- ASSERT_TRUE(infobar);
- EXPECT_CALL(metric_logger,
- LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_IGNORED)).Times(1);
- }
-}
-
// Verify that we correctly log user happiness metrics dealing with form loading
// and form submission.
TEST_F(AutofillMetricsTest, UserHappinessFormLoadAndSubmission) {

Powered by Google App Engine
This is Rietveld 408576698