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 1c3b1a24eee7719e04a72019b1ff595c04f96813..32aa502062215713f6b47452cc2a884fa91aeeab 100644 |
--- a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html |
+++ b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html |
@@ -181,6 +181,50 @@ test(function() { |
}); |
}, 'Absence of total should throw TypeError.'); |
+test(function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': undefined}); |
+}, 'Undefined modifiers should not throw.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': []}); |
+ }); |
+}, 'Empty modifiers should throw TypeError.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'total' : buildItem()}]}); |
please use gerrit instead
2016/06/26 19:45:24
no space between the second 'total' and :
zino
2016/06/27 17:29:23
Done.
|
+ }); |
+}, 'Absence of supportedMethods in modifiers should throw TypeError.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': []}]}); |
+ }); |
+}, 'Empty supportedMethods in modifiers should throw TypeError.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': undefined}]}); |
+ }); |
+}, 'Undefined supportedMethods in modifiers should throw TypeError.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': null}]}); |
+ }); |
+}, 'Null supportedMethods in modifiers should throw TypeError.'); |
+ |
+test(function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': ['foo'], 'total': buildItem({'value': '0.0'})}]}); |
please use gerrit instead
2016/06/26 19:45:24
Value format checks should really be done in "Inva
zino
2016/06/27 17:29:23
I added tests :)
Done.
|
+}, 'Non-negative total value in PaymentDetailsModifier should not throw.'); |
+ |
+test(function() { |
+ assert_throws(new TypeError(), function() { |
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': ['foo'], 'total': buildItem({'value': '-0.01'})}]}); |
+ }); |
+}, 'Negative total value in PaymentDetailsModifier should throw a TypeError.'); |
+ |
promise_test(function(t) { |
return promise_rejects(t, null, new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails()).abort()); |
}, 'abort() without show() should reject with error'); |