OLD | NEW |
(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 package org.chromium.chrome.browser.payments; |
| 6 |
| 7 import android.support.test.filters.MediumTest; |
| 8 |
| 9 import org.chromium.base.test.util.Feature; |
| 10 |
| 11 import java.util.concurrent.ExecutionException; |
| 12 import java.util.concurrent.TimeoutException; |
| 13 |
| 14 /** Web payments test for data URL. */ |
| 15 public class PaymentRequestDataUrlTest extends PaymentRequestTestBase { |
| 16 public PaymentRequestDataUrlTest() { |
| 17 super("data:text/html,<html><head>" |
| 18 + "<meta name=\"viewport\" content=\"width=device-width, initial
-scale=1, " |
| 19 + "maximum-scale=1\"></head><body><button id=\"buy\" onclick=\"t
ry { " |
| 20 + "(new PaymentRequest([{supportedMethods: ['basic-card']}], " |
| 21 + "{total: {label: 'Total', " |
| 22 + " amount: {currency: 'USD', value: '1.00'}}})).show(); " |
| 23 + "} catch(e) { " |
| 24 + "document.getElementById('result').innerHTML = e; " |
| 25 + "}\">Data URL Test</button><div id='result'></div></body></htm
l>"); |
| 26 } |
| 27 |
| 28 @Override |
| 29 public void onMainActivityStarted() |
| 30 throws InterruptedException, ExecutionException, TimeoutException {} |
| 31 |
| 32 @MediumTest |
| 33 @Feature({"Payments"}) |
| 34 public void test() throws InterruptedException, ExecutionException, TimeoutE
xception { |
| 35 openPageAndClickNode("buy"); |
| 36 expectResultContains(new String[] {"SecurityError: Failed to construct '
PaymentRequest': " |
| 37 + "Must be in a secure context"}); |
| 38 } |
| 39 } |
OLD | NEW |