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

Side by Side Diff: services/js/test/echo.js

Issue 1964673002: Delete JSEchoTest.ShareEchoService -- it tests the wrong-way ServiceProvider (exposed_services). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 | « services/js/echo_apptest.cc ('k') | services/js/test/echo_service.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo mojo:js_content_handler 1 #!mojo mojo:js_content_handler
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 define("main", [ 6 define("main", [
7 "mojo/services/public/js/application", 7 "mojo/services/public/js/application",
8 "services/js/test/echo_service.mojom", 8 "services/js/test/echo_service.mojom",
9 ], function(application, echoServiceMojom) { 9 ], function(application, echoServiceMojom) {
10 10
11 const Application = application.Application; 11 const Application = application.Application;
12 const EchoService = echoServiceMojom.EchoService; 12 const EchoService = echoServiceMojom.EchoService;
13 var echoApp; 13 var echoApp;
14 14
15 class EchoServiceImpl { 15 class EchoServiceImpl {
16 echoString(s) { 16 echoString(s) {
17 return Promise.resolve({value: s}); 17 return Promise.resolve({value: s});
18 } 18 }
19 19
20 // This method is only used by the ShareEchoService test.
21 shareEchoService() {
22 var echoTargetURL = echoApp.url.replace("echo.js", "echo_target.js");
23 var targetSP = echoApp.shell.connectToApplication(echoTargetURL);
24 // This Promise resolves after echo_target.js has called the echoString()
25 // method defined on the local EchoService implementation. For its part,
26 // the target application quits after one successful call to echoString().
27 return new Promise(function(resolve) {
28 targetSP.provideService(EchoService, function() {
29 this.echoString = function(s) {
30 resolve({ok: true});
31 return Promise.resolve({value: s});
32 }
33 });
34 });
35 }
36
37 quit() { 20 quit() {
38 echoApp.quit(); 21 echoApp.quit();
39 } 22 }
40 } 23 }
41 24
42 class Echo extends Application { 25 class Echo extends Application {
43 acceptConnection(url, serviceExchange) { 26 acceptConnection(url, serviceExchange) {
44 echoApp = this; 27 echoApp = this;
45 serviceExchange.provideService(EchoService, EchoServiceImpl); 28 serviceExchange.provideService(EchoService, EchoServiceImpl);
46 } 29 }
47 } 30 }
48 31
49 return Echo; 32 return Echo;
50 }); 33 });
OLDNEW
« no previous file with comments | « services/js/echo_apptest.cc ('k') | services/js/test/echo_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698