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 2135633002: Moving assert_throws test cases under generate_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 f58060876c73338cf78273f84365af0323728fd5..c0854654bec17714e7211eaed86cbd6ef52c9da9 100644
--- a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
+++ b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
@@ -167,65 +167,17 @@ test(function() {
}, 'Non-negative total value should not throw.');
test(function() {
- assert_throws(new TypeError(), function() {
- new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total', {'value': '-0.01'}));
- });
-}, 'Negative total value should throw a TypeError.');
-
-test(function() {
new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('displayItems.0', {'value': '-0.01'}));
}, 'Negative line item value should not throw.');
test(function() {
- assert_throws(new TypeError(), function() {
- new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [buildItem()]});
- });
-}, '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()}]});
- });
-}, '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'})}]});
}, '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');
@@ -252,12 +204,36 @@ generate_tests(assert_throws, [
['Duplicate supported payment method identifiers should throw TypeError.', null, function() {
new PaymentRequest([{'supportedMethods': ['foo']}, {'supportedMethods': ['foo']}], buildDetails(), {})
}],
+ ['Absence of total should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [buildItem()]})
+ }],
+ ['Negative total value should throw a TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total', {'value': '-0.01'}))
+ }],
['Duplicate supported payment method identifiers in modifiers should throw TypeError.', null, function() {
new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': ['foo', 'foo']}]})
}],
['Duplicate supported payment method identifiers in modifiers should throw TypeError.', null, function() {
new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': ['foo']}, {'supportedMethods': ['foo']}]})
}],
+ ['Negative total value in PaymentDetailsModifier should throw a TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': ['foo'], 'total': buildItem({'value': '-0.01'})}]})
+ }],
+ ['Null supportedMethods in modifiers should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': null}]})
+ }],
+ ['Undefined supportedMethods in modifiers should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': undefined}]})
+ }],
+ ['Empty supportedMethods in modifiers should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'supportedMethods': []}]})
+ }],
+ ['Absence of supportedMethods in modifiers should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': [{'total': buildItem()}]})
+ }],
+ ['Empty modifiers should throw TypeError.', null, function() {
+ new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'modifiers': []})
+ }],
['Empty details should throw', null, function() {
new PaymentRequest([{'supportedMethods': ['foo']}], {})
}],
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698