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

Side by Side Diff: third_party/WebKit/LayoutTests/payments/resources/payment-request-mock.js

Issue 2595563004: Mojo JS bindings: fix enum array validation. (Closed)
Patch Set: . Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_js_generator.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * payment-request-mock contains a mock implementation of PaymentRequest. 2 * payment-request-mock contains a mock implementation of PaymentRequest.
3 */ 3 */
4 4
5 "use strict"; 5 "use strict";
6 6
7 let paymentRequestMock = loadMojoModules( 7 let paymentRequestMock = loadMojoModules(
8 'paymentRequestMock', 8 'paymentRequestMock',
9 ['components/payments/payment_request.mojom', 9 ['components/payments/payment_request.mojom',
10 'mojo/public/js/router', 10 'mojo/public/js/bindings',
11 ]).then(mojo => { 11 ]).then(mojo => {
12 let [paymentRequest, router] = mojo.modules; 12 let [paymentRequest, bindings] = mojo.modules;
13 13
14 class PaymentRequestMock { 14 class PaymentRequestMock {
15 constructor(interfaceProvider) { 15 constructor(interfaceProvider) {
16 interfaceProvider.addInterfaceOverrideForTesting( 16 interfaceProvider.addInterfaceOverrideForTesting(
17 paymentRequest.PaymentRequest.name, 17 paymentRequest.PaymentRequest.name,
18 handle => this.connectPaymentRequest_(handle)); 18 handle => this.bindings_.addBinding(this, handle));
19 19
20 this.interfaceProvider_ = interfaceProvider; 20 this.interfaceProvider_ = interfaceProvider;
21 this.pendingResponse_ = null; 21 this.pendingResponse_ = null;
22 } 22 this.bindings_ = new bindings.BindingSet(paymentRequest.PaymentRequest);
23
24 connectPaymentRequest_(handle) {
25 this.paymentRequestStub_ = new paymentRequest.PaymentRequest.stubClass(thi s);
26 this.paymentRequestRouter_ = new router.Router(handle);
27 this.paymentRequestRouter_.setIncomingReceiver(this.paymentRequestStub_);
28 } 23 }
29 24
30 init(client, supportedMethods, details, options) { 25 init(client, supportedMethods, details, options) {
31 this.client_ = client; 26 this.client_ = client;
32 if (this.pendingResponse_) { 27 if (this.pendingResponse_) {
33 let response = this.pendingResponse_; 28 let response = this.pendingResponse_;
34 this.pendingResponse_ = null; 29 this.pendingResponse_ = null;
35 this.onPaymentResponse(response); 30 this.onPaymentResponse(response);
36 } 31 }
37 } 32 }
(...skipping 14 matching lines...) Expand all
52 } 47 }
53 this.client_.onPaymentResponse(new paymentRequest.PaymentResponse(data)); 48 this.client_.onPaymentResponse(new paymentRequest.PaymentResponse(data));
54 } 49 }
55 50
56 onComplete() { 51 onComplete() {
57 this.client_.onComplete(); 52 this.client_.onComplete();
58 } 53 }
59 } 54 }
60 return new PaymentRequestMock(mojo.frameInterfaces); 55 return new PaymentRequestMock(mojo.frameInterfaces);
61 }); 56 });
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_js_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698