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

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

Issue 2772103002: [Payments] Desktop: never return false in incognito mode for canMakePayment (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 <vector> 5 #include <vector>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" 9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
10 #include "components/autofill/core/browser/autofill_test_utils.h" 10 #include "components/autofill/core/browser/autofill_test_utils.h"
(...skipping 21 matching lines...) Expand all
32 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, 32 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
33 CanMakePayment_Supported) { 33 CanMakePayment_Supported) {
34 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. 34 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa.
35 AddCreditCard(card); 35 AddCreditCard(card);
36 36
37 CallCanMakePayment(); 37 CallCanMakePayment();
38 38
39 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); 39 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
40 } 40 }
41 41
42 // Visa is required, and user has a visa instrument, and user is in incognito
43 // mode.
44 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
45 CanMakePayment_Supported_Incognito) {
46 SetIncognitoForTesting();
47
48 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa.
49 AddCreditCard(card);
50
51 CallCanMakePayment();
52
53 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
54 }
55
42 // Visa is required, and user doesn't have a visa instrument. 56 // Visa is required, and user doesn't have a visa instrument.
43 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, 57 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
44 CanMakePayment_NotSupported) { 58 CanMakePayment_NotSupported) {
45 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. 59 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex.
46 AddCreditCard(card); 60 AddCreditCard(card);
47 61
48 CallCanMakePayment(); 62 CallCanMakePayment();
49 63
50 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")}); 64 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")});
51 } 65 }
52 66
67 // Visa is required, and user doesn't have a visa instrument and the user is in
68 // incognito mode.
69 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
70 CanMakePayment_NotSupported_Incognito) {
71 SetIncognitoForTesting();
72
73 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex.
74 AddCreditCard(card);
75
76 CallCanMakePayment();
77
78 // Returns true because the user is in incognito mode, even though it should
79 // return false in a normal profile.
80 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
81 }
82
53 } // namespace payments 83 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698