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

Unified Diff: chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)
Patch Set: Fix typo 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc
index bc9b96d5a7a9e47303ca660e3d5bc798b3f0a999..cb4e07299d5955c077d89a0a446acf1f64efd3bf 100644
--- a/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc
+++ b/chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc
@@ -38,21 +38,35 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
CallCanMakePayment();
- ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
+ ExpectBodyContains({"true"});
+}
+
+// Pages without a valid SSL cerificate always get "false" from
+// .canMakePayment().
+IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
+ CanMakePayment_InvalidSSL) {
+ SetInvalidSsl();
+
+ const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa.
+ AddCreditCard(card);
+
+ CallCanMakePayment();
+
+ ExpectBodyContains({"false"});
}
// Visa is required, user has a visa instrument, and user is in incognito
// mode.
IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
CanMakePayment_Supported_InIncognitoMode) {
- SetIncognitoForTesting();
+ SetIncognito();
const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa.
AddCreditCard(card);
CallCanMakePayment();
- ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
+ ExpectBodyContains({"true"});
}
// Visa is required, and user doesn't have a visa instrument.
@@ -63,14 +77,14 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
CallCanMakePayment();
- ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")});
+ ExpectBodyContains({"false"});
}
// Visa is required, user doesn't have a visa instrument and the user is in
// incognito mode. In this case canMakePayment always returns true.
IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
CanMakePayment_NotSupported_InIncognitoMode) {
- SetIncognitoForTesting();
+ SetIncognito();
const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex.
AddCreditCard(card);
@@ -79,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest,
// Returns true because the user is in incognito mode, even though it should
// return false in a normal profile.
- ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")});
+ ExpectBodyContains({"true"});
}
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698