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

Unified Diff: chrome/browser/ui/autofill/autocheckout_bubble_controller_unittest.cc

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 years, 4 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: chrome/browser/ui/autofill/autocheckout_bubble_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autocheckout_bubble_controller_unittest.cc b/chrome/browser/ui/autofill/autocheckout_bubble_controller_unittest.cc
deleted file mode 100644
index bfc07e6251bf87573fe08868912df85d4eab2489..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/autofill/autocheckout_bubble_controller_unittest.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/autofill/autocheckout_bubble_controller.h"
-#include "components/autofill/core/browser/autofill_metrics.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-namespace autofill {
-namespace {
-
-class TestAutofillMetrics : public AutofillMetrics {
- public:
- TestAutofillMetrics()
- : metric_(NUM_BUBBLE_METRICS) {}
- virtual ~TestAutofillMetrics() {}
- virtual void LogAutocheckoutBubbleMetric(BubbleMetric metric) const OVERRIDE {
- metric_ = metric;
- }
-
- AutofillMetrics::BubbleMetric metric() const { return metric_; }
-
- private:
- mutable AutofillMetrics::BubbleMetric metric_;
-
- DISALLOW_COPY_AND_ASSIGN(TestAutofillMetrics);
-};
-
-class TestCallback {
- public:
- TestCallback() : accepted_count_(0), dismissed_count_(0) {}
- ~TestCallback() {}
-
- void Run(AutocheckoutBubbleState state) {
- if (state == AUTOCHECKOUT_BUBBLE_ACCEPTED)
- accepted_count_++;
- else
- dismissed_count_++;
- }
-
- int accepted_count() const {
- return accepted_count_;
- }
-
- int dismissed_count() const {
- return dismissed_count_;
- }
-
- base::Callback<void(AutocheckoutBubbleState)> GetCallback() {
- return base::Bind(&TestCallback::Run, base::Unretained(this));
- }
-
- private:
- int accepted_count_;
- int dismissed_count_;
-};
-
-class TestAutocheckoutBubbleController :
- public autofill::AutocheckoutBubbleController {
- public:
- explicit TestAutocheckoutBubbleController(
- const base::Callback<void(AutocheckoutBubbleState)>& callback)
- : AutocheckoutBubbleController(gfx::RectF(),
- gfx::NativeWindow(),
- true /* is_google_user */,
- callback) {
- set_metric_logger(new TestAutofillMetrics);
- }
- virtual ~TestAutocheckoutBubbleController() {}
-
- const TestAutofillMetrics* get_metric_logger() const {
- return static_cast<TestAutofillMetrics*>(const_cast<AutofillMetrics*>(
- AutocheckoutBubbleController::metric_logger()));
- }
-};
-
-} // namespace
-
-TEST(AutocheckoutBubbleControllerTest, BubbleCreationAndDestructionMetrics) {
- // Test bubble created metric.
- TestCallback callback;
- TestAutocheckoutBubbleController controller(callback.GetCallback());
-
- controller.BubbleCreated();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_CREATED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(0, callback.accepted_count());
- EXPECT_EQ(0, callback.dismissed_count());
-
- // If neither BubbleAccepted or BubbleCanceled was called the bubble was
- // ignored.
- controller.BubbleDestroyed();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_IGNORED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(0, callback.accepted_count());
- EXPECT_EQ(1, callback.dismissed_count());
-}
-
-TEST(AutocheckoutBubbleControllerTest, BubbleAcceptedMetric) {
- // Test bubble accepted metric.
- TestCallback callback;
- TestAutocheckoutBubbleController controller(callback.GetCallback());
-
- controller.BubbleAccepted();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_ACCEPTED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(1, callback.accepted_count());
- EXPECT_EQ(0, callback.dismissed_count());
-
- // Test that after a bubble is accepted it is not considered ignored.
- controller.BubbleDestroyed();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_ACCEPTED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(1, callback.accepted_count());
- EXPECT_EQ(0, callback.dismissed_count());
-}
-
-TEST(AutocheckoutBubbleControllerTest, BubbleCanceledMetric) {
- // Test bubble dismissed metric.
- TestCallback callback;
- TestAutocheckoutBubbleController controller(callback.GetCallback());
-
- controller.BubbleCanceled();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_DISMISSED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(0, callback.accepted_count());
- EXPECT_EQ(1, callback.dismissed_count());
-
- // Test that after a bubble is dismissed it is not considered ignored.
- controller.BubbleDestroyed();
-
- EXPECT_EQ(AutofillMetrics::BUBBLE_DISMISSED,
- controller.get_metric_logger()->metric());
- EXPECT_EQ(0, callback.accepted_count());
- EXPECT_EQ(1, callback.dismissed_count());
-}
-
-} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698