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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java

Issue 2859613002: Disable web payments API on blob: and data: schemes. (Closed)
Patch Set: Fix up Android test Created 3 years, 7 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/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4e23257f90e16c0d40cf7bb246e7059be960735d
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDataUrlTest.java
@@ -0,0 +1,39 @@
+// Copyright 2017 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.
+
+package org.chromium.chrome.browser.payments;
+
+import android.support.test.filters.MediumTest;
+
+import org.chromium.base.test.util.Feature;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+/** Web payments test for data URL. */
+public class PaymentRequestDataUrlTest extends PaymentRequestTestBase {
+ public PaymentRequestDataUrlTest() {
+ super("data:text/html,<html><head>"
+ + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, "
+ + "maximum-scale=1\"></head><body><button id=\"buy\" onclick=\"try { "
+ + "(new PaymentRequest([{supportedMethods: ['basic-card']}], "
+ + "{total: {label: 'Total', "
+ + " amount: {currency: 'USD', value: '1.00'}}})).show(); "
+ + "} catch(e) { "
+ + "document.getElementById('result').innerHTML = e; "
+ + "}\">Data URL Test</button><div id='result'></div></body></html>");
+ }
+
+ @Override
+ public void onMainActivityStarted()
+ throws InterruptedException, ExecutionException, TimeoutException {}
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void test() throws InterruptedException, ExecutionException, TimeoutException {
+ openPageAndClickNode("buy");
+ expectResultContains(new String[] {"SecurityError: Failed to construct 'PaymentRequest': "
+ + "Must be in a secure context"});
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698