[Payment Request] Update payment-request imported tests
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 23:04:45 +0000 (23:04 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 23:04:45 +0000 (23:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177786

Reviewed by Zalan Bujtas.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentAddress/w3c-import.log: Added.
* web-platform-tests/payment-request/algorithms-manual.https.html: Added.
* web-platform-tests/payment-request/change-shipping-option-manual.https.html: Added.
* web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html:
* web-platform-tests/payment-request/payment-request-constructor.https-expected.txt:
* web-platform-tests/payment-request/payment-request-constructor.https.html:
* web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html:
* web-platform-tests/payment-request/payment-response/complete-method-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/helpers.js:
(async.runManualTest):
* web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html: Added.
* web-platform-tests/payment-request/rejects_if_not_active.https.html: Added.
* web-platform-tests/payment-request/shipping-address-changed-manual.https.html: Added.
* web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html: Added.
* web-platform-tests/payment-request/user-abort-algorithm-manual.https.html: Added.
* web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html: Added.
* web-platform-tests/payment-request/w3c-import.log:

LayoutTests:

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log
LayoutTests/platform/mac-wk2/TestExpectations

index e62eb15..d0efb5d 100644 (file)
@@ -1,3 +1,12 @@
+2017-10-02  Andy Estes  <aestes@apple.com>
+
+        [Payment Request] Update payment-request imported tests
+        https://bugs.webkit.org/show_bug.cgi?id=177786
+
+        Reviewed by Zalan Bujtas.
+
+        * platform/mac-wk2/TestExpectations:
+
 2017-10-02  Matt Lewis  <jlewis3@apple.com>
 
         Additional rebaselining of js/dom/global-constructors-attributes.html.
index 172597d..1ddc938 100644 (file)
@@ -1,3 +1,36 @@
+2017-10-02  Andy Estes  <aestes@apple.com>
+
+        [Payment Request] Update payment-request imported tests
+        https://bugs.webkit.org/show_bug.cgi?id=177786
+
+        Reviewed by Zalan Bujtas.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentAddress/w3c-import.log: Added.
+        * web-platform-tests/payment-request/algorithms-manual.https.html: Added.
+        * web-platform-tests/payment-request/change-shipping-option-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html:
+        * web-platform-tests/payment-request/payment-request-constructor.https-expected.txt:
+        * web-platform-tests/payment-request/payment-request-constructor.https.html:
+        * web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html:
+        * web-platform-tests/payment-request/payment-response/complete-method-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/helpers.js:
+        (async.runManualTest):
+        * web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html: Added.
+        * web-platform-tests/payment-request/rejects_if_not_active.https.html: Added.
+        * web-platform-tests/payment-request/shipping-address-changed-manual.https.html: Added.
+        * web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html: Added.
+        * web-platform-tests/payment-request/user-abort-algorithm-manual.https.html: Added.
+        * web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html: Added.
+        * web-platform-tests/payment-request/w3c-import.log:
+
 2017-10-01  Sam Weinig  <sam@webkit.org>
 
         Add missing results from r222690.
index a5fb3fe..06c0542 100644 (file)
@@ -38,7 +38,7 @@
     "web-platform-tests/apng": "skip", 
     "web-platform-tests/app-uri": "skip", 
     "web-platform-tests/assumptions": "skip", 
-    "web-platform-tests/audio-output": "skip",
+    "web-platform-tests/audio-output": "skip", 
     "web-platform-tests/auxclick": "skip", 
     "web-platform-tests/battery-status": "skip", 
     "web-platform-tests/beacon": "import", 
     "web-platform-tests/browser-payment-api": "skip", 
     "web-platform-tests/clear-site-data": "skip", 
     "web-platform-tests/clipboard": "skip", 
-    "web-platform-tests/clipboard-apis": "skip",
+    "web-platform-tests/clipboard-apis": "skip", 
     "web-platform-tests/common": "import", 
     "web-platform-tests/compat": "skip", 
     "web-platform-tests/console": "skip", 
     "web-platform-tests/content-security-policy": "skip", 
     "web-platform-tests/cookies": "skip", 
-    "web-platform-tests/core-aam": "skip",
+    "web-platform-tests/core-aam": "skip", 
     "web-platform-tests/cors": "import", 
     "web-platform-tests/credential-management": "skip", 
     "web-platform-tests/css": "skip", 
-    "web-platform-tests/css-backgrounds": "skip",
-    "web-platform-tests/css-cascade": "skip",
-    "web-platform-tests/css-fonts": "skip",
-    "web-platform-tests/css-scoping": "skip",
+    "web-platform-tests/css-backgrounds": "skip", 
+    "web-platform-tests/css-cascade": "skip", 
     "web-platform-tests/css-font-display": "skip", 
     "web-platform-tests/css-font-loading": "skip", 
+    "web-platform-tests/css-fonts": "skip", 
     "web-platform-tests/css-paint-api": "skip", 
+    "web-platform-tests/css-scoping": "skip", 
     "web-platform-tests/css-timing": "skip", 
     "web-platform-tests/css-typed-om": "skip", 
     "web-platform-tests/css-values": "skip", 
     "web-platform-tests/encrypted-media/Google": "skip", 
     "web-platform-tests/eventsource": "import", 
     "web-platform-tests/ext-xhtml-pubid": "skip", 
-    "web-platform-tests/feature-policy": "skip",
+    "web-platform-tests/feature-policy": "skip", 
     "web-platform-tests/fetch": "import", 
     "web-platform-tests/fullscreen": "skip", 
     "web-platform-tests/gamepad": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-canvas-element/size.attributes.parse.whitespace.html": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-04.html": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-iframe-element": "import", 
-    "web-platform-tests/html/semantics/embedded-content/the-img-element/decode": "skip",
+    "web-platform-tests/html/semantics/embedded-content/the-img-element/decode": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-image-data": "skip", 
     "web-platform-tests/html/semantics/embedded-content/the-object-element/object-events.html": "skip", 
     "web-platform-tests/html/semantics/forms/the-textarea-element": "import", 
     "web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html": "skip", 
     "web-platform-tests/html/semantics/interactive-elements/the-summary-element": "skip", 
-    "web-platform-tests/html/semantics/links/following-hyperlinks": "skip",
+    "web-platform-tests/html/semantics/links/following-hyperlinks": "skip", 
     "web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements": "skip", 
     "web-platform-tests/html/semantics/scripting-1/the-script-element/module": "skip", 
     "web-platform-tests/html/semantics/scripting-1/the-script-element/script-for-event.xhtml": "skip", 
     "web-platform-tests/innerText": "import", 
     "web-platform-tests/input-events": "skip", 
     "web-platform-tests/interfaces": "skip", 
-    "web-platform-tests/intersection-observer": "skip",
+    "web-platform-tests/intersection-observer": "skip", 
     "web-platform-tests/js": "skip", 
     "web-platform-tests/keyboard-lock": "skip", 
     "web-platform-tests/longtask-timing": "skip", 
     "web-platform-tests/orientation-event": "skip", 
     "web-platform-tests/orientation-sensor": "skip", 
     "web-platform-tests/page-visibility": "skip", 
-    "web-platform-tests/paint-timing": "skip",
-    "web-platform-tests/payment-handler": "skip",
-    "web-platform-tests/payment-method-basic-card": "skip",
-    "web-platform-tests/payment-method-id": "skip",
+    "web-platform-tests/paint-timing": "skip", 
+    "web-platform-tests/payment-handler": "skip", 
+    "web-platform-tests/payment-method-basic-card": "skip", 
+    "web-platform-tests/payment-method-id": "skip", 
     "web-platform-tests/payment-request": "import", 
-    "web-platform-tests/payment-request/PaymentRequestUpdateEvent": "skip",
+    "web-platform-tests/payment-request/PaymentRequestUpdateEvent": "skip", 
     "web-platform-tests/performance-timeline": "skip", 
     "web-platform-tests/pointerevents": "skip", 
     "web-platform-tests/pointerlock": "skip", 
     "web-platform-tests/webvtt": "skip", 
     "web-platform-tests/workers": "skip", 
     "web-platform-tests/x-frame-options": "skip"
-}
+}
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html
new file mode 100644 (file)
index 0000000..328adec
--- /dev/null
@@ -0,0 +1,92 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://www.w3.org/TR/payment-request/#paymentaddress-interface">
+<title>
+  PaymentResponse.prototype.shippingAddress
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../payment-response/helpers.js"></script>
+<script>
+const options = { requestShipping: true };
+function runManualTest(button, expected = {}) {
+  button.disabled = true;
+  promise_test(async () => {
+    const { response } = await getPaymentRequestResponse(options);
+    await response.complete();
+    assert_idl_attribute(response, "shippingAddress");
+    const { shippingAddress: addr } = response;
+    assert_true(
+      addr instanceof PaymentAddress,
+      "Expect instance of PaymentAddress"
+    );
+    // An [ISO3166] alpha-2 code. The canonical form is upper case.
+    const { country } = addr;
+    assert_equals(country.length, 2, "Expected length is 2");
+    assert_true(/^[A-Z]{2}$/.test(country), "Canonical form is upper case");
+    assert_true(
+      addr.addressLine instanceof Array,
+      "Expected addressLine to be an array"
+    );
+    assert_throws(
+      new TypeError(),
+      () => {
+        addr.addressLine.push("this must throw");
+      },
+      "Array must be frozen"
+    );
+    for (let [attr, expectedValue] of Object.entries(expected)) {
+      assert_idl_attribute(addr, attr);
+      const msg = `Expected paymentAddress.${attr} to equal ${expectedValue}.`;
+      //.toString() flattens array addressLine,
+      //.toLowerCase() because case can't be enforced for some attributes
+      const actualValue = addr[attr].toString().toLowerCase();
+      expectedValue = expectedValue.toString().toLowerCase();
+      assert_equals(actualValue, expectedValue, msg);
+    }
+    // Check toJSON result
+    for (let [prop, jsonValue] of Object.entries(addr.toJSON())) {
+      const actualValue = jsonValue.toString().toLowerCase();
+      const expectedValue = expected[prop].toString().toLowerCase();
+      const msg = `Expected JSON ${prop} to be ${expectedValue}`;
+      assert_equals(actualValue, expectedValue, msg);
+    }
+  }, button.textContent.trim());
+  done();
+}
+</script>
+<h2>PaymentAddress interface</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When prompted, please enter addresses as follows...
+</p>
+<ol>
+  <li>
+    <button onclick="
+    const expectedAddress = {
+      country: 'AF',
+      addressLine: '1 wpt street',
+      region: '',
+      city: 'Kabul',
+      dependentLocality: '',
+      postalCode: '1001',
+      sortingCode: '',
+      languageCode: '',
+      organization: '',
+      recipient: 'web platform test',
+      phone: '+9312345678910',
+    };
+    runManualTest(this, expectedAddress);">
+      If the requestShipping member is true, then shippingAddress's PaymentAddress must match the expected values.
+    </button>
+    "web platform test" as recipient, at address "1 wpt street" in "Kabul, Afghanistan", zip/postal code 1001.
+    Set the organization to "w3c". Set the phone number to "+9312345678910"
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log
new file mode 100644 (file)
index 0000000..8ccdd39
--- /dev/null
@@ -0,0 +1,17 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html
new file mode 100644 (file)
index 0000000..2e4140a
--- /dev/null
@@ -0,0 +1,166 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#algorithms">
+<title>
+  Payment Request algorithms
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({
+  explicit_done: true,
+  explicit_timeout: true,
+});
+const methods = [
+  {
+    supportedMethods: "basic-card",
+  },
+];
+const shippingOptions = {
+  shippingOptions: [
+    {
+      id: "fail",
+      label: "Option 1",
+      amount: {
+        currency: "USD",
+        value: "5.00",
+      },
+      selected: true,
+    },
+    {
+      id: "pass",
+      label: "Option 2",
+      amount: {
+        currency: "USD",
+        value: "5.00",
+      },
+    },
+  ],
+};
+
+const detailsNoShippingOptions = {
+  total: {
+    label: "Total due",
+    amount: {
+      currency: "USD",
+      value: "1.0",
+    },
+  },
+};
+
+const detailsWithShippingOptions = Object.assign(
+  {
+    total: {
+      label: "Total due",
+      amount: {
+        currency: "USD",
+        value: "1.0",
+      },
+    },
+  },
+  shippingOptions
+);
+
+const options = {
+  requestShipping: true,
+};
+
+function testFireEvent(button, details, eventName, expectRequestProps) {
+  button.disabled = true;
+  promise_test(async t => {
+    new PaymentRequest(methods, detailsNoShippingOptions, options);
+    const request = new PaymentRequest(methods, details, options);
+    const handlerPromise = new Promise(resolve => {
+      request[`on${eventName}`] = event => {
+        // "prevent immediate propagation" flag is set.
+        // This listener below won't fire!
+        event.updateWith(details);
+        resolve(event);
+      };
+    });
+    // This listener should never fire because the
+    // the event handler caused "prevent immediate propagation" to be set.
+    request.addEventListener(
+      eventName,
+      t.unreached_func("Second event listener should never fire")
+    );
+    const response = await request.show();
+    const event = await handlerPromise;
+    assert_true(
+      event instanceof window.PaymentRequestUpdateEvent,
+      "Expected instances of PaymentRequestUpdateEvent"
+    );
+    await response.complete("success");
+  }, button.textContent.trim());
+}
+
+async function runAbortTest(button) {
+  button.disabled = true;
+  const { textContent: testName } = button;
+  promise_test(async t => {
+    const request = new PaymentRequest(methods, detailsNoShippingOptions);
+    // Await the user to abort
+    await promise_rejects(t, "AbortError", request.show());
+    // [[state]] is now closed
+    await promise_rejects(t, "InvalidStateError", request.show());
+  }, testName.trim());
+}
+</script>
+<h2>
+  Tests for "algorithms" section
+</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<section>
+  <h3 id="abort-algo">
+    User aborts the payment request algorithm
+  </h3>
+  <link rel="help" href="https://w3c.github.io/payment-request/#user-aborts-the-payment-request-algorithm">
+  <p>
+    When presented with the payment sheet, abort the payment request (e.g., by hitting the esc key or pressing a UA provided button).
+  </p>
+  <ol>
+    <li>
+      <button onclick="runAbortTest(this);">
+      If the user aborts, the UA must run the user aborts the payment request algorithm.
+    </button>
+    </li>
+  </ol>
+</section>
+
+<section>
+  <h3 id="shipping-address-changed-algo">Shipping address changed algorithm</h3>
+  <link rel="help" href="https://www.w3.org/TR/payment-request/#shipping-address-changed-algorithm">
+  <p>
+    When prompted, please change or enter a new shipping address and then select Pay.
+  </p>
+  <ol>
+    <li>
+      <button onclick="testFireEvent(this, detailsWithShippingOptions, 'shippingaddresschange', {});">
+      The shipping address changed algorithm runs when the user provides a new shipping address.
+    </button>
+    </li>
+  </ol>
+</section>
+
+<section>
+  <h3 id="shipping-option-changed-algo">Shipping option changed algorithm</h3>
+  <link rel="help" href="https://w3c.github.io/payment-request/#shipping-option-changed-algorithm">
+  <p>
+    Finally, when prompted, please select "shipping option 2" and then select Pay.
+  </p>
+  <ol>
+    <li>
+      <button onclick="testFireEvent(this, detailsWithShippingOptions, 'shippingoptionchange', {}, 'pass'); done();">
+      The shipping option changed algorithm runs when the user chooses a new shipping option.
+    </button>
+    </li>
+  </ol>
+</section>
+
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html
new file mode 100644 (file)
index 0000000..8ef52e3
--- /dev/null
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<!--  Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<meta charset="utf-8">
+<title>Test for PaymentRequest shippingOption attribute</title>
+<link rel="help" href="https://w3c.github.io/payment-request/#shippingoption-attribute">
+<link rel="help" href="https://w3c.github.io/payment-request/#onshippingoptionchange-attribute">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const validMethod = Object.freeze({ supportedMethods: "basic-card" });
+const validMethods = Object.freeze([validMethod]);
+const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
+const validTotal = Object.freeze({
+  label: "label",
+  amount: validAmount,
+});
+const validDetails = Object.freeze({ total: validTotal });
+
+const validShippingOption1 = Object.freeze({
+  id: "valid-1",
+  label: "PICK ME!",
+  amount: validAmount,
+  selected: false,
+});
+
+const validShippingOption2 = Object.freeze({
+  id: "initially-selected",
+  label: "Valid shipping option 2",
+  amount: validAmount,
+  selected: true,
+});
+
+const requestShipping = Object.freeze({
+  requestShipping: true,
+});
+
+function testShippingOptionChanged() {
+  promise_test(async t => {
+    const detailsWithShippingOptions = Object.assign({}, validDetails, {
+      shippingOptions: [validShippingOption1, validShippingOption2],
+    });
+    const request = new PaymentRequest(
+      validMethods,
+      detailsWithShippingOptions,
+      requestShipping
+    );
+    assert_equals(
+      request.shippingOption,
+      "initially-selected",
+      "Must be 'initially-selected', as the selected member is true"
+    );
+    const listenerPromise = new Promise(resolve => {
+      request.addEventListener("shippingoptionchange", () => {
+        resolve(request.shippingOption);
+      });
+    });
+    const handlerPromise = new Promise(resolve => {
+      request.onshippingoptionchange = () => {
+        resolve(request.shippingOption);
+      };
+    });
+    request.show().catch(err => err);
+
+    const results = await Promise.all([listenerPromise, handlerPromise]);
+    assert_true(
+      results.every(result => result === "valid-1"),
+      "Expected valid-1 as the shippingOption"
+    );
+    await request.abort();
+  });
+  done();
+}
+</script>
+
+<h2>PaymentRequest shippingOption attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is presented, select "PICK ME!" as the shipping option.
+</p>
+<ol>
+  <li>
+    <button onclick="testShippingOptionChanged()">
+      When the shipping option is manually changed, request.shippingOption represents the user's choice.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
index 5390974..8486463 100644 (file)
@@ -88,15 +88,29 @@ promise_test(async t => {
   const unsupportedMethods = [
     "this-is-not-supported",
     "https://not.supported",
-    "basic-card?not-really",
-    "basic-card://not-ok",
-    "basic card",
-    "/basic card/",
-    "BaSicCarD",
-    "BASIC-CARD",
-    " basic-card ",
-    "this is not supported",
-    " ",
+    "e",
+    "n6jzof05mk2g4lhxr-u-q-w1-c-i-pa-ty-bdvs9-ho-ae7-p-md8-s-wq3-h-qd-e-q-sa",
+    "a-b-q-n-s-pw0",
+    "m-u",
+    "s-l5",
+    "k9-f",
+    "m-l",
+    "u4-n-t",
+    "i488jh6-g18-fck-yb-v7-i",
+    "x-x-t-t-c34-o",
+    "https://wpt",
+    "https://wpt.fyi/",
+    "https://wpt.fyi/payment",
+    "https://wpt.fyi/payment-request",
+    "https://wpt.fyi/payment-request?",
+    "https://wpt.fyi/payment-request?this=is",
+    "https://wpt.fyi/payment-request?this=is&totally",
+    "https://wpt.fyi:443/payment-request?this=is&totally",
+    "https://wpt.fyi:443/payment-request?this=is&totally#fine",
+    "https://:@wpt.fyi:443/payment-request?this=is&totally#👍",
+    " \thttps://wpt\n ",
+    "https://xn--c1yn36f",
+    "https://點看",
   ];
   for (const method of unsupportedMethods) {
     try {
index 9900113..c1bdc9d 100644 (file)
@@ -13,15 +13,13 @@ PASS If the first character of details.total.amount.value is U+002D HYPHEN-MINUS
 PASS For each item in details.displayItems: if item.amount.value is not a valid decimal monetary value, then throw a TypeError 
 PASS Negative values are allowed for displayItems.amount.value, irrespective of total amount 
 PASS it handles high precision currency values without throwing 
-FAIL For each option in details.shippingOptions: if option.amount.value is not a valid decimal monetary value, then throw a TypeError "-" is not a valid decimal monetary value.
+PASS For each option in details.shippingOptions: if option.amount.value is not a valid decimal monetary value, then throw a TypeError 
 PASS If there is no selected shipping option, then PaymentRequest.shippingOption remains null 
 FAIL If there is a selected shipping option, and requestShipping is set, then that option becomes synchronously selected assert_equals: Must be null when no shipping is requested (defaults to false) expected (object) null but got (string) "the-id"
 FAIL If requestShipping is set, and if there is a multiple selected shipping options, only the last is selected. assert_equals: shippingOption must be null, as requestShipping is false expected (object) null but got (string) "the-id"
-FAIL If there are any duplicate shipping option ids, and shipping is requested, then throw a TypeError Test bug: unrecognized DOMException code "() => {
-    const request = new PaymentRequest(defaultMethods, details, {
-      requestShipping: true,
-    });
-  }" passed to assert_throws()
+FAIL If there are any duplicate shipping option ids, and shipping is requested, then throw a TypeError assert_throws: Expected to throw a TypeError because duplicate IDs function "() => {
+      new PaymentRequest(defaultMethods, details, { requestShipping: true });
+    }" did not throw
 FAIL Throw when there are duplicate shippingOption ids, even if other values are different assert_throws: Expected to throw a TypeError because duplicate IDs function "() => {
       new PaymentRequest(defaultMethods, details, { requestShipping: true });
     }" did not throw
index 00ceeba..1cdb2ab 100644 (file)
@@ -350,14 +350,6 @@ test(() => {
     const details = Object.assign({}, defaultDetails, {
       shippingOptions: [invalidShippingOption],
     });
-    const request = new PaymentRequest(defaultMethods, details, {
-      requestShipping: false,
-    });
-    assert_equals(
-      request.shippingOption,
-      null,
-      "shippingOption must be null, because requestShipping is false"
-    );
     assert_throws(
       new TypeError(),
       () => {
@@ -476,11 +468,13 @@ test(() => {
     null,
     "shippingOption must be null, because requestShipping is false"
   );
-  assert_throws(() => {
-    const request = new PaymentRequest(defaultMethods, details, {
-      requestShipping: true,
-    });
-  });
+  assert_throws(
+    new TypeError(),
+    () => {
+      new PaymentRequest(defaultMethods, details, { requestShipping: true });
+    },
+    "Expected to throw a TypeError because duplicate IDs"
+  );
 }, "If there are any duplicate shipping option ids, and shipping is requested, then throw a TypeError");
 
 test(() => {
index 97d417b..425f65a 100644 (file)
@@ -96,6 +96,15 @@ test(() => {
     "\t\na-b",
     "a-b ",
     "a-b\n\t",
+    "basic-card?not-really",
+    "basic-card://not-ok",
+    "basic card",
+    "/basic card/",
+    "BaSicCarD",
+    "BASIC-CARD",
+    " basic-card ",
+    "this is not supported",
+    " ",
   ];
   for (const invalidMethod of invalidMethods) {
     assert_throws(
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html
new file mode 100644 (file)
index 0000000..509fa4d
--- /dev/null
@@ -0,0 +1,84 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-complete()">
+<title>
+  PaymentResponse.prototype.complete() method
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<script>
+async function runManualTest({ completeWith: result }, button) {
+  button.disabled = true;
+  const { response, request } = await getPaymentRequestResponse();
+  promise_test(async () => {
+    try {
+      // We .complete() as normal, using the passed test value
+      const promise = response.complete(result);
+      assert_true(promise instanceof Promise, "returns a promise");
+      const returnedValue = await promise;
+      assert_equals(
+        returnedValue,
+        undefined,
+        "Returned value must always be undefined"
+      );
+      // We now call .complete() again, to force an exception
+      // because [[completeCalled]] is true.
+      try {
+        await response.complete(result);
+        assert_unreached("Expected InvalidStateError to be thrown");
+      } catch (err) {
+        assert_equals(
+          err.code,
+          DOMException.INVALID_STATE_ERR,
+          "Must throw an InvalidStateError"
+        );
+      }
+      button.innerHTML = `✅  ${button.textContent}`;
+    } catch (err) {
+      button.innerHTML = `❌  ${button.textContent}`;
+      assert_unreached("Unexpected exception: " + err.message);
+    }
+  }, button.textContent.trim());
+}
+</script>
+
+<h2>
+    Manual Tests for PaymentResponse.complete() - Please run in order!
+</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When presented with the payment sheet, use any credit card select to "Pay".
+  Also confirm any prompts that come up.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest({completeWith: 'success'}, this)">
+      If the value of the internal slot [[completeCalled]] is true,
+      reject promise with an "InvalidStateError" DOMException.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest({completeWith: 'unknown'}, this)">
+      Passing no argument defaults to "unknown",
+      eventually closing the sheet and doesn't throw.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest({completeWith: 'success'}, this)">
+      Passing "success" eventually closes the sheet and doesn't throw.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest({completeWith: 'fail'}, this).then(done)">
+      Passing "fail" eventually closes the sheet and doesn't throw.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
index 90425e2..bf938c5 100644 (file)
@@ -113,6 +113,10 @@ async function runManualTest(button, options, expected = {}, id = undefined) {
         `Expected response ${attribute} attribute to be ${value}`
       );
     }
+    assert_idl_attribute(response, "details");
+    assert_equals(typeof response.details, "object", "Expected an object");
+    // Testing that this does not throw:
+    response.toJSON();
     if (options && options.requestShipping) {
       assert_equals(
         response.shippingOption,
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..cd25e94
--- /dev/null
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-methodname">
+<title>
+  PaymentResponse.prototype.methodName attribute
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>methodName attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  Use any credit card and any values.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, {}, { methodName: 'basic-card' }).then(done)">
+      Expect the payment method identifier to be 'basic-card'.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..c7eaf65
--- /dev/null
@@ -0,0 +1,48 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-payeremail">
+<title>
+  PaymentResponse.prototype.payerEmail attribute
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>payerEmail attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When requested, please use "wpt@w3.org" as the email.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, undefined, { payerEmail: null })">
+      payerEmail attribute is null when options undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerEmail: undefined }, { payerEmail: null })">
+      payerEmail attribute is null when requestPayerEmail is undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerEmail: false }, { payerEmail: null })">
+      payerEmail attribute is null when requestPayerEmail is false.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerEmail: true }, { payerEmail: 'wpt@w3.org' })">
+      payerEmail attribute is 'wpt@w3.org' when requestPayerEmail is true.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerEmail: 'yep' }, { payerEmail: 'wpt@w3.org' }).then(done)">
+      payerEmail attribute is 'wpt@w3.org' when requestPayerEmail is truthy.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..b2636e3
--- /dev/null
@@ -0,0 +1,48 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-payername">
+<title>
+  PaymentResponse.prototype.payerName attribute
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>payerName attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When requested, please use "web platform test" as the payer name.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, undefined, { payerName: null })">
+      payerName attribute is null when option is undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerName: undefined }, { payerName: null })">
+      payerName attribute is null when requestPayerName is undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerName: false }, { payerName: null })">
+      payerName attribute is null when requestPayerName is false.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerName: true }, { payerName: 'web platform test' })">
+      payerName attribute is 'web platform test' when requestPayerName is true.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerName: 'yep' }, { payerName: 'web platform test' }).then(done)">
+      payerName attribute is 'web platform test' when requestPayerName is truthy.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..c74f45e
--- /dev/null
@@ -0,0 +1,48 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-payerphone">
+<title>
+  PaymentResponse.prototype.payerPhone attribute
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>payerPhone attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When prompted, please use +12345678910 as the phone number.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, undefined, { payerPhone: null })">
+      payerPhone attribute is null when options is undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerPhone: undefined }, { payerPhone: null })">
+      payerPhone attribute is null when requestPayerPhone is undefined.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerPhone: false }, { payerPhone: null })">
+      payerPhone attribute is null when requestPayerPhone is false.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerPhone: true }, { payerPhone: '+12345678910' })">
+      payerPhone attribute is '+12345678910' when requestPayerPhone is true.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestPayerPhone: 'yep' }, { payerPhone: '+12345678910' }).then(done)">
+      payerPhone attribute is '+12345678910' when requestPayerPhone is truthy.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..653ed55
--- /dev/null
@@ -0,0 +1,34 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-requestid">
+<title>
+  PaymentResponse.prototype.requestId attribute
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>requestId attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When presented with the payment sheet, use any credit card select to "Pay".
+  Also confirm any prompts that come up.
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, {}, {})">
+      Must mirror the payment request's automatically set id
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, {}, {requestId: 'pass'}, 'pass').then(done)">
+      Must mirror the payment request's explicitly set id
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..b5a4082
--- /dev/null
@@ -0,0 +1,101 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-shippingaddress">
+<title>
+  PaymentResponse.prototype.shippingAddress
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<script>
+async function checkNullShippingAddress(button, options) {
+  button.disabled = true;
+  const { request, response } = await getPaymentRequestResponse(options);
+  await response.complete();
+  test(() => {
+    assert_idl_attribute(response, "shippingAddress");
+    assert_equals(
+      response.shippingAddress,
+      null,
+      "Expected response.shippingAddress to be null"
+    );
+    assert_equals(
+      request.shippingAddress,
+      null,
+      "Expected request.shippingAddress to be null"
+    );
+  }, button.textContent.trim());
+}
+
+async function runManualTest(button, options = {}, expected = {}, id) {
+  button.disabled = true;
+  const { request, response } = await getPaymentRequestResponse(options, id);
+  await response.complete();
+  test(() => {
+    assert_equals(response.requestId, request.id, `Expected ids to match`);
+    assert_idl_attribute(response, "shippingAddress");
+    const { shippingAddress: addr } = request;
+    assert_true(
+      addr instanceof PaymentAddress,
+      "Expect instance of PaymentAddress"
+    );
+    try {
+      addr.toJSON();
+    } catch (err) {
+      assert_unreached(
+        `Unexpected exception calling PaymentAddress.toJSON(): ${err}`
+      );
+    }
+    if (expected.shippingAddress === null) {
+      return;
+    }
+    assert_equals(addr.country, "AF", "Expected AF for country");
+    assert_true(
+      addr.addressLine instanceof Array,
+      "Expected addressLine to be an array"
+    );
+    assert_equals(
+      addr.addressLine.toString(),
+      "1 wpt street",
+      "Expected '1 wpt street' for addressLine"
+    );
+    assert_equals(addr.city, "Kabul", "Expected city to be Kabul");
+    assert_equals(addr.postalCode, "1001", "Expect postalCode to be 1001");
+    assert_equals(addr.recipient, "web platform test");
+  }, button.textContent.trim());
+}
+</script>
+<h2>shippingAddress attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When prompted, please enter "web platform test" as recipient, at address "1 wpt street" in "Kabul, Afghanistan", zip/postal code 1001.
+</p>
+<ol>
+  <li>
+    <button onclick="checkNullShippingAddress(this, undefined)">
+      If options is undefined, then shippingAddress must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="checkNullShippingAddress(this, {})">
+      If the requestShipping member is missing, then shippingAddress must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="checkNullShippingAddress(this, {requestShipping: false})">
+      If the requestShipping member is false, then shippingAddress must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, {requestShipping: true}).then(done)">
+      If the requestShipping member is true, then shippingAddress must be "1 wpt street" in "Kabul, Afghanistan", zip code 1001.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html
new file mode 100644 (file)
index 0000000..eec7a4d
--- /dev/null
@@ -0,0 +1,43 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-shippingoption">
+<title>
+  PaymentResponse.prototype.complete() method
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<h2>shippingOption attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  For the last test, please select the only available shipping option and select "Pay".
+</p>
+<ol>
+  <li>
+    <button onclick="runManualTest(this, undefined, { shippingOption: null })">
+      If the options is undefined, then shippingOption must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestShipping: undefined }, { shippingOption: null })">
+      If the requestShipping member is missing, then shippingOption must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestShipping: false }, { shippingOption: null })">
+      If the requestShipping member is false, then shippingOption must be null.
+    </button>
+  </li>
+  <li>
+    <button onclick="runManualTest(this, { requestShipping: true }, { shippingOption: 'pass' }).then(done)">
+      If the requestShipping member is true, then shippingOption must be the id of the selected shipping option ("pass").
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html
new file mode 100644 (file)
index 0000000..063d31b
--- /dev/null
@@ -0,0 +1,156 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<link rel="help" href="https://w3c.github.io/payment-request/#show()-method">
+<title>PaymentRequest show() rejects if doc is not fully active</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentrequest-show()">
+<body>
+<script>
+const validMethod = Object.freeze({
+  supportedMethods: "basic-card",
+});
+const validMethods = Object.freeze([validMethod]);
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "5.00",
+});
+const validTotal = Object.freeze({
+  label: "Total due",
+  amount: validAmount,
+});
+const validDetails = Object.freeze({
+  total: validTotal,
+});
+
+function getLoadedPaymentRequest(iframe, url) {
+  return new Promise(resolve => {
+    iframe.addEventListener(
+      "load",
+      () => {
+        const { PaymentRequest } = iframe.contentWindow;
+        const request = new PaymentRequest(validMethods, validDetails);
+        resolve(request);
+      },
+      { once: true }
+    );
+    iframe.src = url;
+  });
+}
+
+promise_test(async t => {
+  // Check that PaymentRequests can be constructed.
+  new PaymentRequest(validMethods, validDetails);
+  const iframe = document.createElement("iframe");
+  iframe.allowPaymentRequest = true;
+  document.body.appendChild(iframe);
+
+  // We first got to page1.html, grab a PaymentRequest instance.
+  const request1 = await getLoadedPaymentRequest(
+    iframe,
+    "/payment-request/resources/page1.html"
+  );
+
+  // We navigate the iframe again, putting request1's document into an inactive state.
+  const request2 = await getLoadedPaymentRequest(
+    iframe,
+    "/payment-request/resources/page2.html"
+  );
+
+  // Now, request1's relevant global object's document is no longer active.
+  // So, call .show(), and make sure it rejects appropriately.
+  await promise_rejects(
+    t,
+    "AbortError",
+    request1.show(),
+    "Inactive document, so must throw AbortError"
+  );
+
+  // request2 has an active document tho, so confirm it's working as expected:
+  request2.show();
+  await request2.abort();
+  await promise_rejects(
+    t,
+    "InvalidStateError",
+    request2.show(),
+    "Abort already called, so InvalidStateError"
+  );
+  // We are done, so clean up.
+  iframe.remove();
+}, "PaymentRequest.show() aborts if the document is not active");
+
+promise_test(async t => {
+  // check that PaymentRequests can be constructed (smoke test).
+  new PaymentRequest(validMethods, validDetails);
+
+  // We nest two iframes and wait for them to load.
+  const outerIframe = document.createElement("iframe");
+  outerIframe.allowPaymentRequest = true;
+  document.body.appendChild(outerIframe);
+  // Load the outer iframe (we don't care about the awaited request)
+  await getLoadedPaymentRequest(
+    outerIframe,
+    "/payment-request/resources/page1.html"
+  );
+
+  // Now we create the inner iframe
+  const innerIframe = outerIframe.contentDocument.createElement("iframe");
+  innerIframe.allowPaymentRequest = true;
+
+  // nest them
+  outerIframe.contentDocument.body.appendChild(innerIframe);
+
+  // load innerIframe, and get the PaymentRequest instance
+  const request = await getLoadedPaymentRequest(
+    innerIframe,
+    "/payment-request/resources/page2.html"
+  );
+
+  // Navigate the outer iframe to a new location.
+  // Wait for the load event to fire.
+  await new Promise(resolve => {
+    outerIframe.addEventListener("load", resolve);
+    outerIframe.src = "/payment-request/resources/page2.html";
+  });
+  // Now, request's relevant global object's document is still active
+  // (it is the active document of the inner iframe), but is not fully active
+  // (since the parent of the inner iframe is itself no longer active).
+  // So, call request.show() and make sure it rejects appropriately.
+  await promise_rejects(
+    t,
+    "AbortError",
+    request.show(),
+    "Active, but not fully active, so must throw AbortError"
+  );
+  // We are done, so clean up.
+  iframe.remove();
+}, "PaymentRequest.show() aborts if the document is active, but not fully active");
+
+promise_test(async t => {
+  // Check that PaymentRequests can be constructed.
+  new PaymentRequest(validMethods, validDetails);
+  const iframe = document.createElement("iframe");
+  iframe.allowPaymentRequest = true;
+  document.body.appendChild(iframe);
+  // Make a request in the iframe.
+  const request = await getLoadedPaymentRequest(
+    iframe,
+    "/payment-request/resources/page1.html"
+  );
+  // Present the payment sheet.
+  const showPromise = request.show();
+  // Navigate the iframe to a new location. Wait for the load event to fire.
+  await new Promise(resolve => {
+    iframe.addEventListener("load", resolve);
+    iframe.src = "/payment-request/resources/page2.html";
+  });
+  await promise_rejects(
+    t,
+    "AbortError",
+    showPromise,
+    "The iframe was navigated away, so showPromise must reject with AbortError"
+  );
+  // We are done, so clean up.
+  iframe.remove();
+}, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment request aborts.");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html
new file mode 100644 (file)
index 0000000..6375f9b
--- /dev/null
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<!--  Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<meta charset="utf-8">
+<title>Test for PaymentRequest shippingAddress attribute</title>
+<link rel="help" href="https://w3c.github.io/payment-request/#shippingaddress-attribute">
+<link rel="help" href="https://w3c.github.io/payment-request/#onshippingaddresschange-attribute">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const validMethod = Object.freeze({ supportedMethods: "basic-card" });
+const validMethods = Object.freeze([validMethod]);
+const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
+const validTotal = Object.freeze({
+  label: "label",
+  amount: validAmount,
+});
+const validShippingOption = Object.freeze({
+  id: "valid",
+  label: "Shipping Option",
+  amount: validAmount,
+  selected: false,
+});
+const validDetails = Object.freeze({
+  total: validTotal,
+  shippingOptions: [validShippingOption],
+});
+const requestShipping = Object.freeze({
+  requestShipping: true,
+});
+
+function testShippingAddressChange() {
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      requestShipping
+    );
+    assert_equals(
+      request.shippingAddress,
+      null,
+      "request.shippingAddress must initially be null"
+    );
+    const listenerPromise = new Promise(resolve => {
+      request.addEventListener("shippingaddresschange", () => {
+        resolve(request.shippingAddress);
+      });
+    });
+    const handlerPromise = new Promise(resolve => {
+      request.onshippingaddresschange = () => {
+        resolve(request.shippingAddress);
+      };
+    });
+    request.show().catch(err => err);
+    const results = await Promise.all([listenerPromise, handlerPromise]);
+    assert_true(
+      results.every(obj => obj instanceof PaymentAddress),
+      "Expected instances of PaymentAddress"
+    );
+    await request.abort();
+  });
+  done();
+}
+
+</script>
+
+<h2>PaymentRequest shippingAddress attribute</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is presented, enter or select a shipping address.
+</p>
+<ol>
+  <li>
+    <button onclick="testShippingAddressChange()">
+      When the shipping address is manually changed, request.shippingAddress is a PaymentAddress.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html
new file mode 100644 (file)
index 0000000..0c0ba4a
--- /dev/null
@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<!--  Copyright © 2017 Mozilla and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang).  -->
+<meta charset="utf-8">
+<title>Test for validity of payment method identifiers when calling updateWith() method</title>
+<link rel="help" href="https://www.w3.org/TR/payment-request/#updatewith()-method">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+"use strict";
+setup({ explicit_done: true, explicit_timeout: true });
+const validMethod = Object.freeze({
+  supportedMethods: "https://:@wpt.fyi:443/payment-request",
+});
+
+const validMethods = Object.freeze([validMethod]);
+
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "1.0",
+});
+
+const validTotal = Object.freeze({
+  label: "Default Total",
+  amount: validAmount,
+});
+
+const validShippingOption = Object.freeze({
+  id: "standard",
+  label: "Shipping option",
+  amount: validAmount,
+  selected: true,
+});
+
+const validDetails = Object.freeze({
+  total: validTotal,
+  shippingOptions: [validShippingOption],
+});
+
+const validModifier = Object.freeze({
+  supportedMethods: "basic-card",
+  total: validTotal,
+});
+
+test(() => {
+  try {
+    new PaymentRequest(validMethods, validDetails);
+  } catch (err) {
+    done();
+    throw err;
+  }
+}, "smoke test");
+
+function manualTest(button, { invalidMethod }) {
+  button.disabled = true;
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      [{ supportedMethods: "basic-card" }],
+      validDetails,
+      { requestShipping: true }
+    );
+    const listener = ev => {
+      const invalidModifier = Object.assign({}, validModifier, {
+        supportedMethods: invalidMethod,
+      });
+      const invalidDetails = Object.assign({}, validDetails, {
+        modifiers: [validModifier, invalidModifier],
+      });
+      ev.updateWith(invalidDetails);
+    };
+    // We test against a valid and an invalid modifier
+    request.addEventListener("shippingaddresschange", listener, { once: true });
+    const showPromise = request.show();
+    await promise_rejects(t, new RangeError(), showPromise);
+  }, button.textContent.trim());
+}
+</script>
+<h2>updateWith() method: test validity of payment method identifiers.</h2>
+<p>
+  When shown a payment sheet, select a different address.
+</p>
+<ol>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'https://:password@example.com'});">
+      Must throw if the URL has a password.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'https://username@example.com'});">
+      Must throw if the URL has a username.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'https://username:password@example.com/pay'});">
+      Must throw if the URL has a username and a password.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'http://username:password@example.com/pay'});">
+      Must throw if it's http, and has a username and password.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'http://foo.com:100000000/pay'});">
+      Must throw if the URL is invalid (port range).
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'basic-💳'});">
+      Must throw if the PMI contains characters that are out of range.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'not-https://wpt.fyi/payment-request'});">
+      Must throw if not https.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: '¡basic-*-card!'});">
+      Must throw if the standardized PMI contains characters outside the ascii range.
+    </button>
+  </li>
+  <li>
+    <button onclick="manualTest(this, {invalidMethod: 'Basic-Card'}); done();">
+      Must throw if standardized PMI has uppercase characters.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html
new file mode 100644 (file)
index 0000000..bfc83ab
--- /dev/null
@@ -0,0 +1,70 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#user-aborts-the-payment-request-algorithm">
+<title>
+  User aborts the payment request algorithm.
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "1.0",
+});
+const validTotal = Object.freeze({
+  label: "Total due",
+  amount: validAmount,
+});
+const validMethod = Object.freeze({
+  supportedMethods: "basic-card",
+});
+const validMethods = Object.freeze([validMethod]);
+const validDetails = Object.freeze({
+  total: validTotal,
+});
+
+test(() => {
+  try {
+    new PaymentRequest(validMethods, validDetails);
+  } catch (err) {
+    done();
+    throw err;
+  }
+}, "Can construct a payment request (smoke test).");
+
+async function runAbortTest(button) {
+  button.disabled = true;
+  const { textContent: testName } = button;
+  promise_test(async t => {
+    const request = new PaymentRequest(validMethods, validDetails);
+    // Await the user to abort
+    await promise_rejects(t, "AbortError", request.show());
+    // [[state]] is now closed
+    await promise_rejects(t, "InvalidStateError", request.show());
+  }, testName.trim());
+}
+</script>
+<h2>
+   User aborts the payment request algorithm.
+</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When presented with the payment sheet, abort the payment request
+  (e.g., by hitting the esc key or pressing a UA provided button).
+</p>
+<ol>
+  <li>
+    <button onclick="runAbortTest(this); done();">
+      If the user aborts, the UA must run the user aborts the payment request algorithm.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html
new file mode 100644 (file)
index 0000000..c4d390f
--- /dev/null
@@ -0,0 +1,220 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#user-accepts-the-payment-request-algorithm">
+<title>
+  User accepts the payment request algorithm
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const basicCardMethod = Object.freeze({
+  supportedMethods: "basic-card",
+});
+const validMethod = Object.freeze({
+  supportedMethods: "this-is-just-for-testings-will-never-match",
+});
+const methods = Object.freeze([basicCardMethod, validMethod]);
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "5.00",
+});
+const shippingOptions = [
+  Object.freeze({
+    id: "option1",
+    label: "Option 1",
+    amount: validAmount,
+    selected: false,
+  }),
+  Object.freeze({
+    id: "option 2",
+    label: "Option 2",
+    amount: validAmount,
+    selected: true,
+  }),
+];
+
+const detailsNoShippingOptions = Object.freeze({
+  total: {
+    label: "Total due",
+    amount: validAmount,
+  },
+});
+
+const detailsWithShippingOptions = Object.assign({}, detailsNoShippingOptions, {
+  shippingOptions,
+});
+
+const optionsRequestNothing = Object.freeze({
+  requestShipping: false,
+  requestPayerEmail: false,
+  requestPayerName: false,
+  requestPayerPhone: false,
+});
+
+const optionsRequestEverything = Object.freeze({
+  requestShipping: true,
+  requestPayerEmail: true,
+  requestPayerName: true,
+  requestPayerPhone: true,
+});
+
+test(() => {
+  // smoke test
+  try {
+    new PaymentRequest(methods, detailsNoShippingOptions);
+  } catch (err) {
+    done();
+    throw err;
+  }
+}, "Must be able to construct a payment request (smoke test)");
+
+function testAcceptRequestAlgorithm(
+  button,
+  details,
+  options = {},
+  expectedResponse = {}
+) {
+  button.disabled = true;
+  promise_test(async t => {
+    const request = new PaymentRequest(methods, details, options);
+    const response = await request.show();
+    assert_true(
+      response instanceof PaymentResponse,
+      "Expected an instance of PaymentResponse."
+    );
+    // Response [[calledComplete]] is false, so this shouldn't throw
+    await response.complete("success");
+    // For good measure, test that subsequent complete()
+    for (const state of [undefined, "success", "fail", "unknown"]) {
+      await promise_rejects(
+        t,
+        "InvalidStateError",
+        response.complete(state),
+        "Response [[calledComplete]] is true, so InvalidStateError"
+      );
+    }
+    assert_equals(
+      request.id,
+      response.requestId,
+      "Request and response ids must match."
+    );
+    assert_true(response.details instanceof Object, "Expected an object");
+    assert_equals(
+      response.shippingAddress,
+      request.shippingAddress,
+      "Request and response must reference same shippingAddress (or both null)."
+    );
+    assert_equals(
+      response.shippingOption,
+      request.shippingOption,
+      "Request and response must be the same value (or both null)."
+    );
+    if (options.requestShipping === true) {
+      assert_true(
+        response.shippingAddress instanceof PaymentAddress,
+        "Expected an instance of PaymentAddress."
+      );
+    }
+    const expected = {
+      methodName: "basic-card",
+      payerEmail: options.requestPayerEmail
+        ? expectedResponse.payerEmail
+        : null,
+      payerName: options.requestPayerName ? expectedResponse.payerName : null,
+      payerPhone: options.requestPayerPhone
+        ? expectedResponse.payerPhone
+        : null,
+    };
+    for (const [attr, expectedValue] of Object.entries(expected)) {
+      assert_equals(
+        response[attr],
+        expectedValue,
+        `response.${attr} must be ${expectedValue}`
+      );
+    }
+    await promise_rejects(
+      t,
+      "InvalidStateError",
+      request.show(),
+      "Request [[state]] is closed, so InvalidStateError"
+    );
+  }, button.textContent.trim());
+}
+
+</script>
+
+<section>
+  <h2 id="user-accepts-payment-request">User accepts payment request</h2>
+  <p>
+    Click on each button in sequence from top to bottom without refreshing the page.
+    Each button will bring up the Payment Request UI window.
+  </p>
+  <p>
+    When shown the payment sheet, please input a credit card and select Pay.
+  </p>
+  <ol>
+    <li>
+      <button onclick="
+        const detailsWithId = Object.assign({}, detailsNoShippingOptions, { id: 'pass' });
+        testAcceptRequestAlgorithm(this, detailsWithId, optionsRequestNothing);">
+        User accepts payment request, but not shipping is requested.
+      </button> Use any credit card to pay.
+    </li>
+    <li>
+      <button onclick="
+        const requestShipping = Object.assign({}, optionsRequestNothing, {requestShipping: true});
+        const expectedValues = { shippingOption: 'option 2' };
+        testAcceptRequestAlgorithm(this, detailsWithShippingOptions, requestShipping, expectedValues);">
+        User accepts payment request, merchant requests shipping.
+      </button> Select any shipping option, and use any credit card to pay.
+    </li>
+    <li>
+      <button onclick="
+        const requestPayerEmail = Object.assign({}, optionsRequestNothing, {requestPayerEmail: true});
+        const expectValues = { payerEmail: 'wpt@w3.org' };
+        testAcceptRequestAlgorithm(this, detailsNoShippingOptions, requestPayerEmail, expectValues);">
+        User accepts payment request, merchant requests email.
+      </button>
+      When prompted, please use "wpt@w3.org" as the email.
+    </li>
+    <li>
+      <button onclick="
+        const requestPayerPhone = Object.assign({}, optionsRequestNothing, {requestPayerPhone: true});
+        const expectValues = { payerPhone: '+12345678910' };
+        testAcceptRequestAlgorithm(this, detailsNoShippingOptions, requestPayerPhone, expectValues);">
+        User accepts payment request, merchant requests phone.
+      </button>
+      When prompted, please use "+12345678910" as the phone number.
+    </li>
+    <li>
+      <button onclick="
+        const requestPayerName = Object.assign({}, optionsRequestNothing, {requestPayerName: true});
+        const expectValues = { payerName: 'web platform test' };
+        testAcceptRequestAlgorithm(this, detailsNoShippingOptions, requestPayerName, expectValues);">
+        User accepts payment request, merchant requests payer's name.
+      </button>
+      When prompted, please use "web platform test" as the payer name.
+    </li>
+    <li>
+      <button onclick="
+        const expectValues = {
+          payerEmail: 'wpt@w3.org',
+          payerName: 'web platform test',
+          payerPhone: '+12345678910',
+          shippingOption: 'option 2',
+        };
+        testAcceptRequestAlgorithm(this, detailsWithShippingOptions, optionsRequestEverything, expectValues);">
+        User accepts payment request, merchant requests everything.
+      </button>
+      When prompted, please use: "+12345678910" as the phone number, "web platform test" as the payer name, and "wpt@w3.org" as the email. Then press Pay.
+    </li>
+    <li>
+      <button onclick="done()">Done</button>
+    </li>
+  </ol>
+</section>
+<small>
+  If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
+  and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
+</small>
index 14e9ec2..ef02d08 100644 (file)
@@ -33,10 +33,8 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingOption-attribute.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html
-/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-update-event-constructor.http.html
-/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-update-event-constructor.https.html
-/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-update-event-updatewith-method.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html
index 2b9ed96..b384758 100644 (file)
@@ -31,6 +31,24 @@ webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpayment
 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html [ Skip ]
 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ]
 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
+webkit.org/b/177783 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ Skip ]
+
+# skip manual payment-request tests
+imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
 
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.