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

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

Issue 2101463002: PaymentRequest: Implement PaymentDetailsModifier dictionary (in blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 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');

Powered by Google App Engine
This is Rietveld 408576698