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

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Address Mark's comments Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Mock implementation of mojo PresentationService. 2 * Mock implementation of mojo PresentationService.
3 */ 3 */
4 4
5 "use strict"; 5 "use strict";
6 6
7 let presentationServiceMock = loadMojoModules( 7 let presentationServiceMock = loadMojoModules(
8 'presentationServiceMock', 8 'presentationServiceMock',
9 [ 9 [
10 'third_party/WebKit/public/platform/modules/presentation/presentation.mojo m', 10 'third_party/WebKit/public/platform/modules/presentation/presentation.mojo m',
11 'mojo/public/js/bindings', 11 'mojo/public/js/bindings',
12 ]).then(mojo => { 12 ]).then(mojo => {
13 let [ presentationService, bindings ] = mojo.modules; 13 let [ presentation, bindings ] = mojo.modules;
mark a. foltz 2017/01/20 18:48:22 nit: Can you leave this as presentationService, so
takumif 2017/01/23 19:58:12 Done.
14 14
15 class PresentationServiceMock { 15 class PresentationServiceMock {
16 constructor(interfaceProvider) { 16 constructor(interfaceProvider) {
17 interfaceProvider.addInterfaceOverrideForTesting( 17 interfaceProvider.addInterfaceOverrideForTesting(
18 presentationService.PresentationService.name, 18 presentation.PresentationService.name,
19 handle => this.bindingSet_.addBinding(this, handle)); 19 handle => this.bindingSet_.addBinding(this, handle));
20 this.interfaceProvider_ = interfaceProvider; 20 this.interfaceProvider_ = interfaceProvider;
21 this.pendingResponse_ = null; 21 this.pendingResponse_ = null;
22 this.bindingSet_ = new bindings.BindingSet( 22 this.bindingSet_ = new bindings.BindingSet(
23 presentationService.PresentationService); 23 presentation.PresentationService);
24 }
25
26 setClient(client) {
27 this.client_ = client;
24 } 28 }
25 29
26 startSession(urls) { 30 startSession(urls) {
27 return Promise.resolve({ 31 return Promise.resolve({
28 sessionInfo: { url: urls[0], id: 'fakesession' }, 32 sessionInfo: { url: urls[0], id: 'fakesession' },
29 error: null, 33 error: null,
30 }); 34 });
31 } 35 }
32 36
33 joinSession(urls) { 37 joinSession(urls) {
34 return Promise.resolve({ 38 return Promise.resolve({
35 sessionInfo: { url: urls[0], id: 'fakeSessionId' }, 39 sessionInfo: { url: urls[0], id: 'fakeSessionId' },
36 error: null, 40 error: null,
37 }); 41 });
38 } 42 }
43
44 closeConnection(url, id) {
45 this.client_.onConnectionClosed(
46 { url: url, id: id },
47 presentation.PresentationConnectionCloseReason.CLOSED,
48 ''
49 );
50 }
39 } 51 }
40 52
41 return new PresentationServiceMock(mojo.frameInterfaces); 53 return new PresentationServiceMock(mojo.frameInterfaces);
42 }); 54 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698