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

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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cda7c6a1ad3dc77d1a5f8c659f99f889d4f0e479 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,66 @@ 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'});
+ 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': 'invalid'});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as invalid string.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': null});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as null.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': undefined});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as undefined.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': []});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as [].');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': {}});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as {}.');
+
+test(function() {
+ var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {'requestShipping': true, 'shippingType': 0});
+ assert_equals('shipping', request.shippingType);
+}, 'Shipping type should be \'shipping\' if shipping type is specified as a number.');
+
+test(function() {
new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'displayItems': undefined});
}, 'Undefined display items should not throw.');
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698