[Apple Pay] Increment the API version to 5
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 23:10:33 +0000 (23:10 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 23:10:33 +0000 (23:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190686
<rdar://problem/45348523>

Reviewed by Simon Fraser.

Source/WebCore:

Test: http/tests/ssl/applepay/ApplePaySessionV5.html

* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::supportsVersion):

Source/WebKit:

* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::supportsVersion):

LayoutTests:

* http/tests/ssl/applepay/ApplePaySessionV5-expected.txt: Added.
* http/tests/ssl/applepay/ApplePaySessionV5.html: Added.
* platform/mac-wk2/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/testing/MockPaymentCoordinator.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp

index ba61a31..4a1a8c5 100644 (file)
@@ -1,3 +1,15 @@
+2018-10-17  Andy Estes  <aestes@apple.com>
+
+        [Apple Pay] Increment the API version to 5
+        https://bugs.webkit.org/show_bug.cgi?id=190686
+        <rdar://problem/45348523>
+
+        Reviewed by Simon Fraser.
+
+        * http/tests/ssl/applepay/ApplePaySessionV5-expected.txt: Added.
+        * http/tests/ssl/applepay/ApplePaySessionV5.html: Added.
+        * platform/mac-wk2/TestExpectations:
+
 2018-10-17  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Certain tags should identify their context to iOS API
diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5-expected.txt b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5-expected.txt
new file mode 100644 (file)
index 0000000..e07bd2e
--- /dev/null
@@ -0,0 +1,23 @@
+Test basic creation of an ApplePaySession object.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing supportsVersion
+
+PASS ApplePaySession.supportsVersion(0) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS ApplePaySession.supportsVersion(1) is true
+PASS ApplePaySession.supportsVersion(2) is true
+PASS ApplePaySession.supportsVersion(3) is true
+PASS ApplePaySession.supportsVersion(4) is true
+PASS ApplePaySession.supportsVersion(5) is true
+
+Testing PaymentRequest (v5)
+
+PASS new ApplePaySession(5, { }) threw exception TypeError: Member ApplePayPaymentRequest.countryCode is required and must be an instance of DOMString.
+PASS new ApplePaySession(5, validRequest()) did not throw exception.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5.html b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV5.html
new file mode 100644 (file)
index 0000000..37890a7
--- /dev/null
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test basic creation of an ApplePaySession object.");
+
+window.jsTestIsAsync = true;
+
+function validRequest() {
+    return {
+          countryCode: 'US',
+          currencyCode: 'USD',
+          supportedNetworks: ['visa', 'masterCard', 'carteBancaire'],
+          merchantCapabilities: ['supports3DS'],
+          total: { label: 'Your Label', amount: '10.00' },
+    }
+}
+
+function logAndShouldThrow(setup, test) {
+    debug("SETUP: " + setup)
+    eval(setup);
+    shouldThrow(test);
+    debug("")
+}
+
+function logAndShouldNotThrow(setup, test) {
+    debug("SETUP: " + setup)
+    eval(setup);
+    shouldNotThrow(test);
+    debug("")
+}
+
+function go() {
+    debug("Testing supportsVersion");
+    debug("");
+    shouldThrow("ApplePaySession.supportsVersion(0)");
+    shouldBeTrue("ApplePaySession.supportsVersion(1)");
+    shouldBeTrue("ApplePaySession.supportsVersion(2)");
+    shouldBeTrue("ApplePaySession.supportsVersion(3)");
+    shouldBeTrue("ApplePaySession.supportsVersion(4)");
+    shouldBeTrue("ApplePaySession.supportsVersion(5)");
+    debug("");
+
+    debug("Testing PaymentRequest (v5)")
+    debug("");
+    shouldThrow("new ApplePaySession(5, { })");
+    shouldNotThrow("new ApplePaySession(5, validRequest())");
+    debug("");
+
+    document.querySelector("button").remove();
+
+    finishJSTest();
+}
+
+function clickElement(element) {
+    let x = element.offsetLeft + 2;
+    let y = element.offsetTop + 2;
+
+    var supportsTouchEvents = "TouchEvent" in window;
+    if (supportsTouchEvents && window.testRunner && testRunner.runUIScript) {
+        testRunner.runUIScript(`(function() { uiController.singleTapAtPoint(${x}, ${y}, function() { }); })();`, function () { });
+    } else if (window.eventSender) {
+        eventSender.mouseMoveTo(x, y);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
+}
+
+window.onload = function() {
+    clickElement(document.querySelector("button"));
+}
+
+</script>
+<button onclick='go()'>Go</button>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 2f67811..a916309 100644 (file)
@@ -26,10 +26,12 @@ fast/media/mq-prefers-reduced-motion-live-update.html [ Pass ]
 [ Sierra ] http/tests/ssl/applepay/ApplePayError.html [ Skip ]
 [ Sierra ] http/tests/ssl/applepay/ApplePaySessionV3.html [ Skip ]
 [ Sierra ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Skip ]
+[ Sierra ] http/tests/ssl/applepay/ApplePaySessionV5.html [ Skip ]
 [ Sierra ] http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html [ Skip ]
 [ Sierra ] http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html [ Skip ]
 [ HighSierra ] http/tests/ssl/applepay/ApplePayButtonV4.html [ Skip ]
 [ HighSierra ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Skip ]
+[ HighSierra ] http/tests/ssl/applepay/ApplePaySessionV5.html [ Skip ]
 
 fast/visual-viewport/rubberbanding-viewport-rects.html [ Pass ]
 fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html  [ Pass ]
@@ -755,6 +757,7 @@ webkit.org/b/185994 [ Debug ] fast/text/user-installed-fonts/shadow-postscript-f
 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayError.html [ Pass ]
 [ HighSierra+ ] http/tests/ssl/applepay/ApplePaySessionV3.html [ Pass ]
 [ Mojave+ ] http/tests/ssl/applepay/ApplePaySessionV4.html [ Pass ]
+[ Mojave+ ] http/tests/ssl/applepay/ApplePaySessionV5.html [ Pass ]
 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html [ Pass ]
 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html [ Pass ]
 # <rdar://problem/31634451>
index 6cbaf87..1653334 100644 (file)
@@ -1,3 +1,16 @@
+2018-10-17  Andy Estes  <aestes@apple.com>
+
+        [Apple Pay] Increment the API version to 5
+        https://bugs.webkit.org/show_bug.cgi?id=190686
+        <rdar://problem/45348523>
+
+        Reviewed by Simon Fraser.
+
+        Test: http/tests/ssl/applepay/ApplePaySessionV5.html
+
+        * testing/MockPaymentCoordinator.cpp:
+        (WebCore::MockPaymentCoordinator::supportsVersion):
+
 2018-10-17  Eric Carlson  <eric.carlson@apple.com>
 
         [MediaStream] Consolidate all image conversion and resizing into one class
index ab1c05e..e9b4c9a 100644 (file)
@@ -61,7 +61,7 @@ bool MockPaymentCoordinator::supportsVersion(unsigned version)
 #elif !ENABLE(APPLE_PAY_SESSION_V4)
     static const unsigned currentVersion = 3;
 #else
-    static const unsigned currentVersion = 4;
+    static const unsigned currentVersion = 5;
 #endif
 
     return version <= currentVersion;
index afec259..bdb9c6a 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-17  Andy Estes  <aestes@apple.com>
+
+        [Apple Pay] Increment the API version to 5
+        https://bugs.webkit.org/show_bug.cgi?id=190686
+        <rdar://problem/45348523>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+        (WebKit::WebPaymentCoordinator::supportsVersion):
+
 2018-10-17  Alex Christensen  <achristensen@webkit.org>
 
         BackForwardClient needs to be able to support UIProcess-only back/forward lists
index 209a85d..7746272 100644 (file)
@@ -60,7 +60,7 @@ bool WebPaymentCoordinator::supportsVersion(unsigned version)
 #elif !ENABLE(APPLE_PAY_SESSION_V4)
     static const unsigned currentVersion = 3;
 #else
-    static const unsigned currentVersion = 4;
+    static const unsigned currentVersion = 5;
 #endif
 
     return version <= currentVersion;