OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * This URL is defined in content/public/test/test_mojo_app.cc. It identifies | 7 * This URL is defined in content/public/test/test_mojo_app.cc. It identifies |
8 * content_shell's out-of-process Mojo test app. | 8 * content_shell's out-of-process Mojo test app. |
9 */ | 9 */ |
10 var TEST_APP_URL = 'system:content_mojo_test'; | 10 var TEST_APP_URL = 'system:content_mojo_test'; |
11 | 11 |
12 | 12 |
13 define('main', [ | 13 define('main', [ |
14 'mojo/application/public/interfaces/shell.mojom', | |
15 'mojo/public/js/core', | 14 'mojo/public/js/core', |
16 'mojo/public/js/router', | 15 'mojo/public/js/router', |
17 'mojo/services/network/public/interfaces/url_loader.mojom', | 16 'mojo/services/network/public/interfaces/url_loader.mojom', |
| 17 'mojo/shell/public/interfaces/shell.mojom', |
18 'content/public/renderer/service_provider', | 18 'content/public/renderer/service_provider', |
19 'content/public/test/test_mojo_service.mojom', | 19 'content/public/test/test_mojo_service.mojom', |
20 ], function(shellMojom, core, router, urlMojom, serviceRegistry, testMojom) { | 20 ], function (core, router, urlMojom, shellMojom, serviceRegistry, testMojom) { |
21 | 21 |
22 var connectToService = function(serviceProvider, iface) { | 22 var connectToService = function(serviceProvider, iface) { |
23 var pipe = core.createMessagePipe(); | 23 var pipe = core.createMessagePipe(); |
24 var service = new iface.proxyClass(new router.Router(pipe.handle0)); | 24 var service = new iface.proxyClass(new router.Router(pipe.handle0)); |
25 serviceProvider.connectToService(iface.name, pipe.handle1); | 25 serviceProvider.connectToService(iface.name, pipe.handle1); |
26 return service; | 26 return service; |
27 }; | 27 }; |
28 | 28 |
29 return function() { | 29 return function() { |
30 domAutomationController.setAutomationId(0); | 30 domAutomationController.setAutomationId(0); |
31 var shellPipe = serviceRegistry.connectToService(shellMojom.Shell.name); | 31 var shellPipe = serviceRegistry.connectToService(shellMojom.Shell.name); |
32 var shell = new shellMojom.Shell.proxyClass(new router.Router(shellPipe)); | 32 var shell = new shellMojom.Shell.proxyClass(new router.Router(shellPipe)); |
33 var urlRequest = new urlMojom.URLRequest({ url: TEST_APP_URL }); | 33 var urlRequest = new urlMojom.URLRequest({ url: TEST_APP_URL }); |
34 shell.connectToApplication(urlRequest, | 34 shell.connectToApplication(urlRequest, |
35 function (services) { | 35 function (services) { |
36 var test = connectToService(services, testMojom.TestMojoService); | 36 var test = connectToService(services, testMojom.TestMojoService); |
37 test.getRequestorURL().then(function(response) { | 37 test.getRequestorURL().then(function(response) { |
38 domAutomationController.send( | 38 domAutomationController.send( |
39 response.url == 'chrome://mojo-web-ui/'); | 39 response.url == 'chrome://mojo-web-ui/'); |
40 }); | 40 }); |
41 }, | 41 }, |
42 function (exposedServices) {}, | 42 function (exposedServices) {}, |
43 new shellMojom.CapabilityFilter({ filter: new Map([["*", ["*"]]]) })); | 43 new shellMojom.CapabilityFilter({ filter: new Map([["*", ["*"]]]) })); |
44 }; | 44 }; |
45 }); | 45 }); |
OLD | NEW |