| <!doctype html> |
| <!-- |
| Tests that attempts to use the Payment Request API are denied while in the VR |
| Browser. |
| --> |
| <html> |
| <head> |
| <link rel="stylesheet" type="text/css" href="../resources/webxr_e2e.css"> |
| </head> |
| <body> |
| <script src="../../../../../../third_party/blink/web_tests/resources/testharness.js"></script> |
| <script src="../resources/webxr_e2e.js"></script> |
| <script> |
| var t = async_test("Payment Request API disabled while in VR Browser"); |
| |
| // Arbitrary but valid data to pass to PaymentRequest to trigger the |
| // native Payment Request UI. |
| var methods = [ |
| { |
| supportedMethods: "basic-card", |
| data: { |
| supportedNetworks: [ |
| "visa", |
| "mastercard", |
| ], |
| supportedTypes: [ |
| "debit", |
| "credit", |
| ], |
| }, |
| }, |
| ]; |
| |
| var details = { |
| id: "Super VR Store", |
| displayItems: [ |
| { |
| label: "Sub-total", |
| amount: { |
| currency: "USD", |
| value: "10.00", |
| }, |
| }, |
| { |
| label: "Sales Tax", |
| amount: { |
| currency: "USD", |
| value: "1.00", |
| }, |
| }, |
| ], |
| total: { |
| label: "Total", |
| amount: { |
| currency: "USD", |
| value: "11.00", |
| }, |
| }, |
| }; |
| |
| var request = new PaymentRequest(methods, details); |
| |
| function stepRequestPayment() { |
| request.show().then(() => { |
| t.step(() => { |
| assert_unreached("Payment request was shown and accepted"); |
| }); |
| }, (err) => { |
| t.step(() => { |
| assert_true(err instanceof DOMException, |
| "Payment request denied, but not for expected reason"); |
| }); |
| t.done(); |
| }); |
| } |
| </script> |
| </body> |
| </html> |