| OLD | NEW |
| 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', |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 this.onSetClient = null; | 31 this.onSetClient = null; |
| 32 } | 32 } |
| 33 | 33 |
| 34 setClient(client) { | 34 setClient(client) { |
| 35 this.client_ = client; | 35 this.client_ = client; |
| 36 | 36 |
| 37 if (this.onSetClient) | 37 if (this.onSetClient) |
| 38 this.onSetClient(); | 38 this.onSetClient(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 startSession(urls) { | 41 startPresentation(urls) { |
| 42 return Promise.resolve({ | 42 return Promise.resolve({ |
| 43 sessionInfo: { url: urls[0], id: 'fakesession' }, | 43 presentation_info: { url: urls[0], id: 'fakePresentationId' }, |
| 44 error: null, | 44 error: null, |
| 45 }); | 45 }); |
| 46 } | 46 } |
| 47 | 47 |
| 48 joinSession(urls) { | 48 reconnectPresentation(urls) { |
| 49 return Promise.resolve({ | 49 return Promise.resolve({ |
| 50 sessionInfo: { url: urls[0], id: 'fakeSessionId' }, | 50 presentation_info: { url: urls[0], id: 'fakePresentationId' }, |
| 51 error: null, | 51 error: null, |
| 52 }); | 52 }); |
| 53 } | 53 } |
| 54 | 54 |
| 55 terminate(presentationUrl, presentationId) { | 55 terminate(presentationUrl, presentationId) { |
| 56 this.client_.onConnectionStateChanged( | 56 this.client_.onConnectionStateChanged( |
| 57 { url: presentationUrl, id: presentationId }, | 57 { url: presentationUrl, id: presentationId }, |
| 58 presentationService.PresentationConnectionState.TERMINATED); | 58 presentationService.PresentationConnectionState.TERMINATED); |
| 59 } | 59 } |
| 60 | 60 |
| 61 setPresentationConnection( | 61 setPresentationConnection( |
| 62 seesionInfo, controllerConnectionPtr, receiverConnectionRequest) { | 62 presentation_info, controllerConnectionPtr, |
| 63 receiverConnectionRequest) { |
| 63 this.controllerConnectionPtr_ = controllerConnectionPtr; | 64 this.controllerConnectionPtr_ = controllerConnectionPtr; |
| 64 this.receiverConnectionRequest_ = receiverConnectionRequest; | 65 this.receiverConnectionRequest_ = receiverConnectionRequest; |
| 65 this.client_.onConnectionStateChanged( | 66 this.client_.onConnectionStateChanged( |
| 66 seesionInfo, | 67 presentation_info, |
| 67 presentationService.PresentationConnectionState.CONNECTED); | 68 presentationService.PresentationConnectionState.CONNECTED); |
| 68 } | 69 } |
| 69 | 70 |
| 70 onReceiverConnectionAvailable( | 71 onReceiverConnectionAvailable( |
| 71 strUrl, id, opt_controllerConnectionPtr, opt_receiverConnectionReque
st) { | 72 strUrl, id, opt_controllerConnectionPtr, opt_receiverConnectionReque
st) { |
| 72 const mojoUrl = new url.Url(); | 73 const mojoUrl = new url.Url(); |
| 73 mojoUrl.url = strUrl; | 74 mojoUrl.url = strUrl; |
| 74 var controllerConnectionPtr = opt_controllerConnectionPtr; | 75 var controllerConnectionPtr = opt_controllerConnectionPtr; |
| 75 if (!controllerConnectionPtr) { | 76 if (!controllerConnectionPtr) { |
| 76 controllerConnectionPtr = new presentationService.PresentationConnec
tionPtr(); | 77 controllerConnectionPtr = new presentationService.PresentationConnec
tionPtr(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return; | 111 return; |
| 111 | 112 |
| 112 const boundingRect = button.getBoundingClientRect(); | 113 const boundingRect = button.getBoundingClientRect(); |
| 113 const x = boundingRect.left + boundingRect.width / 2; | 114 const x = boundingRect.left + boundingRect.width / 2; |
| 114 const y = boundingRect.top + boundingRect.height / 2; | 115 const y = boundingRect.top + boundingRect.height / 2; |
| 115 | 116 |
| 116 eventSender.mouseMoveTo(x, y); | 117 eventSender.mouseMoveTo(x, y); |
| 117 eventSender.mouseDown(); | 118 eventSender.mouseDown(); |
| 118 eventSender.mouseUp(); | 119 eventSender.mouseUp(); |
| 119 } | 120 } |
| OLD | NEW |