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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc

Issue 2917213003: [Payments] Record SelectedPaymentMethod metric on Desktop. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h"
7 #include "base/test/histogram_tester.h"
8 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
9 #include "components/autofill/core/browser/autofill_profile.h"
10 #include "components/autofill/core/browser/autofill_test_utils.h"
11 #include "components/autofill/core/browser/credit_card.h"
12 #include "components/payments/core/journey_logger.h"
13
14 namespace payments {
15
16 class PaymentRequestJourneyLoggerSelectedPaymentInstrumentTest
17 : public PaymentRequestBrowserTestBase {
18 protected:
19 PaymentRequestJourneyLoggerSelectedPaymentInstrumentTest()
20 : PaymentRequestBrowserTestBase(
21 "/payment_request_no_shipping_test.html") {}
22
23 private:
24 DISALLOW_COPY_AND_ASSIGN(
25 PaymentRequestJourneyLoggerSelectedPaymentInstrumentTest);
26 };
27
28 // Tests that the SelectedPaymentInstrument metrics is correctly logged when the
29 // Payment Request is completed with a credit card.
30 IN_PROC_BROWSER_TEST_F(PaymentRequestJourneyLoggerSelectedPaymentInstrumentTest,
31 TestSelectedPaymentMethod) {
32 base::HistogramTester histogram_tester;
33
34 // Setup a credit card with an associated billing address.
35 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile();
36 AddAutofillProfile(billing_address);
37 autofill::CreditCard card = autofill::test::GetCreditCard();
38 card.set_billing_address_id(billing_address.guid());
39 AddCreditCard(card); // Visa.
40
41 // Complete the Payment Request.
42 InvokePaymentRequestUI();
43 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
44 PayWithCreditCardAndWait(base::ASCIIToUTF16("123"));
45
46 // Expect a credit card as the selected payment instrument in the metrics.
47 histogram_tester.ExpectBucketCount(
48 "PaymentRequest.SelectedPaymentMethod",
49 JourneyLogger::SELECTED_PAYMENT_METHOD_CREDIT_CARD, 1);
50 }
51
52 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698