| #!mojo mojo:js_content_handler |
| "mojo/services/public/js/application", |
| "services/js/test/echo_service.mojom", |
| ], function(application, echoServiceMojom) { |
| const Application = application.Application; |
| const EchoService = echoServiceMojom.EchoService; |
| return Promise.resolve({value: s}); |
| // This method is only used by the ShareEchoService test. |
| var echoTargetURL = echoApp.url.replace("echo.js", "echo_target.js"); |
| var targetSP = echoApp.shell.connectToApplication(echoTargetURL); |
| // This Promise resolves after echo_target.js has called the echoString() |
| // method defined on the local EchoService implementation. For its part, |
| // the target application quits after one successful call to echoString(). |
| return new Promise(function(resolve) { |
| targetSP.provideService(EchoService, function() { |
| this.echoString = function(s) { |
| return Promise.resolve({value: s}); |
| class Echo extends Application { |
| acceptConnection(url, serviceExchange) { |
| serviceExchange.provideService(EchoService, EchoServiceImpl); |