Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js |
| diff --git a/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js |
| index 3db3d1ea3ca4bddcb83bb9f1701627cd94f5f5a6..f583269de1928cb461f416b9a1b440e7097d6a93 100644 |
| --- a/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js |
| +++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js |
| @@ -8,9 +8,13 @@ let presentationServiceMock = loadMojoModules( |
| 'presentationServiceMock', |
| [ |
| 'third_party/WebKit/public/platform/modules/presentation/presentation.mojom', |
| + 'url/mojo/url.mojom', |
| 'mojo/public/js/bindings', |
| ]).then(mojo => { |
| - let [ presentationService, bindings ] = mojo.modules; |
| + let [ presentationService, url, bindings ] = mojo.modules; |
| + |
| + class MockPresentationConnection { |
| + }; |
| class PresentationServiceMock { |
| constructor(interfaceProvider) { |
| @@ -23,6 +27,10 @@ let presentationServiceMock = loadMojoModules( |
| presentationService.PresentationService); |
| } |
| + setClient(client) { |
| + this.client_ = client; |
| + } |
| + |
| startSession(urls) { |
| return Promise.resolve({ |
| sessionInfo: { url: urls[0], id: 'fakesession' }, |
| @@ -36,6 +44,22 @@ let presentationServiceMock = loadMojoModules( |
| error: null, |
| }); |
| } |
| + |
| + onReceiverConnectionAvailable(str_url, id) { |
| + var mojo_url = new url.Url(); |
|
mark a. foltz
2017/02/21 17:47:38
s/var/const/ here and below.
Also, Javascript var
zhaobin
2017/02/21 19:11:38
Done.
|
| + mojo_url.url = str_url; |
| + var controller_connection_ptr = new presentationService.PresentationConnectionPtr(); |
| + var connectionBinding = new bindings.Binding( |
| + presentationService.PresentationConnection, |
| + new MockPresentationConnection(), |
| + bindings.makeRequest(controller_connection_ptr)); |
| + var receiver_connection_ptr = new presentationService.PresentationConnectionPtr(); |
| + |
| + this.client_.onReceiverConnectionAvailable( |
| + { url: mojo_url, id: id }, |
| + controller_connection_ptr, |
| + bindings.makeRequest(receiver_connection_ptr)); |
| + } |
| } |
| return new PresentationServiceMock(mojo.frameInterfaces); |