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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js

Issue 2903643002: PaymentHandler: Implement PaymentRequestEvent constructor. (Closed)
Patch Set: PaymentHandler: Implement PaymentRequestEvent constructor. Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js b/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js
index addfad8ac606ffb16adc6fd3d316b541d428235c..986c07e5a4de222409caa4611a5411d33b5b6997 100644
--- a/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js
+++ b/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js
@@ -12,3 +12,46 @@ test(() => {
assert_own_property(PaymentRequestEvent.prototype, 'instrumentKey');
assert_own_property(PaymentRequestEvent.prototype, 'respondWith');
});
+
+promise_test(() => {
+ return new Promise(resolve => {
+ var eventWithInit = new PaymentRequestEvent('paymentrequest', {
+ topLevelOrigin: 'https://example.com',
+ paymentRequestOrigin: 'https://example.com',
+ paymentRequestId: 'payment-request-id',
+ methodData: [{
+ supportedMethods: ['basic-card']
+ }],
+ total: {
+ label: 'Total',
+ amount: {
+ currency: 'USD',
+ value: '55.00'
+ }
+ },
+ modifiers: [{
+ supportedMethods: ['basic-card']
+ }],
+ instrumentKey: 'payment-instrument-key'
+ });
+
+ self.addEventListener('paymentrequest', e => {
+ assert_equals(e.topLevelOrigin, 'https://example.com');
+ assert_equals(e.paymentRequestOrigin, 'https://example.com');
+ assert_equals(e.paymentRequestId, 'payment-request-id');
+ assert_equals(e.methodData.length, 1);
+ assert_equals(e.methodData[0].supportedMethods.length, 1);
+ assert_equals(e.methodData[0].supportedMethods[0], 'basic-card');
+ assert_equals(e.total.label, 'Total');
+ assert_equals(e.total.amount.currency, 'USD');
+ assert_equals(e.total.amount.value, '55.00');
+ assert_equals(e.modifiers.length, 1);
+ assert_equals(e.modifiers[0].supportedMethods.length, 1);
+ assert_equals(e.modifiers[0].supportedMethods[0], 'basic-card');
+ assert_equals(e.instrumentKey, 'payment-instrument-key');
+ resolve();
+ });
+
+ self.dispatchEvent(eventWithInit);
+ });
+});
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequestEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698