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

Unified Diff: third_party/WebKit/LayoutTests/payments/payment-request-interface.html

Issue 2351533002: PaymentRequest: Add support for shipping type. (in blink side) (Closed)
Patch Set: PaymentRequest: Add support for shipping type. (in blink side) Created 4 years, 3 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: third_party/WebKit/LayoutTests/payments/payment-request-interface.html
diff --git a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
index d1c6c7d1639e78cc87939899dfffc5c3e2b11fdd..904ab4b7b6cc60c2675a1d61e2326b76b99d3d91 100644
--- a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
+++ b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
@@ -85,6 +85,7 @@ test(function() {
var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
assert_readonly(request, 'shippingAddress', 'PaymentRequest should have a readonly shippingAddress property.');
assert_readonly(request, 'shippingOption', 'PaymentRequest should have a readonly shippingOption property.');
+ assert_readonly(request, 'shippingType', 'PaymentRequest should have a readonly shippingType property.');
}, 'PaymentRequest should have readonly shippingAddress and shippingOption properties.');
test(function() {
@@ -155,6 +156,41 @@ test(function() {
}, 'Shipping option identifier should default to the last selected shipping option, if multiple are selected.');
test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': false});
+ assert_equals(null, request.shippingType);
+}, 'Shipping type should be null if shipping is explicitly not requested.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' by default if shipping type isn\'t specified.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': false, 'shippingType': 'shipping'});
please use gerrit instead 2016/09/18 16:54:56 Add a test for 'shippingType' being: null undefin
zino 2016/09/18 18:57:40 Done.
+ assert_equals(null, request.shippingType);
+}, 'Shipping type should be null if shipping type is specified but requestShipping is false.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': 'shipping'});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as \'shipping\'.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': 'delivery'});
+ assert_equals('delivery', request.shippingType);
+}, 'Shipping type should be \'delivery\' if shipping type is specified as \'delivery\'.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': 'pickup'});
+ assert_equals('pickup', request.shippingType);
+}, 'Shipping type should be \'pickup\' if shipping type is specified as \'pickup\'.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': 'shipping'});
please use gerrit instead 2016/09/18 16:54:56 Change 'shipping' to 'invalid'.
zino 2016/09/18 18:57:40 Done.
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is invalid.');
+
+test(function() {
new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'displayItems': undefined});
}, 'Undefined display items should not throw.');

Powered by Google App Engine
This is Rietveld 408576698