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

Side by Side Diff: sky/tests/services/iframe-embed-vmc.sky

Issue 948943002: Gets HTMLIFrameElement::embedViewManagerClient to work with dart (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
1 <html> 1 <sky>
2 <import src="/gen/mojo/public/interfaces/application/shell.mojom.sky" as="shellM ojom" />
3 <import src="/gen/mojo/public/sky/connection.sky" as="connection" />
4 <import src="/gen/mojo/public/sky/core.sky" as="core" />
5 <import src="/gen/mojo/services/public/sky/shell.sky" as="shellJS" />
6 <import src="/gen/services/js/test/echo_service.mojom.sky" as="echoServiceMojom" />
7 <import src="/gen/mojo/services/view_manager/public/interfaces/view_manager.mojo m.sky" as="ViewManager">
8 <import src="/gen/mojo/services/input_events/public/interfaces/input_events.mojo m.sky" as="InputEvents"/>
9 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
10 2
11 <iframe></iframe> 3 <iframe></iframe>
12 4
13 <script> 5 <script>
14 var shellHandle = internals.takeShellProxyHandle(); 6 import 'dart:async';
15 var shellProxy = connection.bindHandleToProxy(shellHandle, shellMojom.Shell); 7 import '/mojo/public/dart/application.dart';
16 var shell = new shellJS.Shell(shellProxy); 8 import 'dart:mojo_bindings';
9 import 'dart:mojo_core';
10 import 'dart:typed_data';
11 import 'dart:sky';
12 import 'dart:sky.internals' as internals;
abarth-chromium 2015/02/23 22:29:37 Please alphabetize these imports.
17 13
18 // The vmcApp provides ViewManagerClient and EchoService. 14 import 'package:mojo/public/interfaces/application/shell.mojom.dart' as shell_mo jom;
19 var vmcURL = "http://127.0.0.1:8000/sky/tests/services/resources/iframe-vmc.js" 15 import 'package:mojo/services/input_events/public/interfaces/input_events.mojom. dart' as input_events;
20 var vmcApp = shell.connectToApplication(vmcURL); 16 import 'package:mojo/services/view_manager/public/interfaces/view_manager.mojom. dart' as view_manager;
17 import 'package:services/js/test/echo_service.mojom.dart' as echo_service_mojom;
21 18
22 // The Promise returned by the vmcApp's echoString() method will not 19 class IFrameEmbed extends Application {
23 // resolve until the vmcApp's onEmbed() method runs. 20 IFrameEmbed.fromHandle(MojoHandle handle) : super.fromHandle(handle);
24 var echoService = vmcApp.requestService(echoServiceMojom.EchoService); 21 IFrameEmbed(MojoMessagePipeEndpoint endpoint) : super(endpoint);
25 echoService.echoString("success").then(function(response) {
26 internals.notifyTestComplete(response.value);
27 });
28 22
29 // Using internals.connectToService here, instead of just connecting 23 void initialize(List<String> args, String url) {
30 // with vmcApp, because we just need a MessagePipe handle (not a proxy). 24 // The vmcApp provides ViewManagerClient and EchoService.
31 var vmcService = internals.connectToService(vmcURL, ViewManager.ViewManagerClien t.name); 25 const vmcURL =
32 document.querySelector("iframe").embedViewManagerClient(vmcService); 26 "http://127.0.0.1:8000/sky/tests/services/resources/iframe-vmc.js";
27 final vmcAppConnection = connectToApplication(vmcURL);
28
29 // The Promise returned by the vmcApp's echoString() method will not
30 // resolve until the vmcApp's onEmbed() method runs.
31 final echoService = new echo_service_mojom.EchoServiceProxy.unbound();
32 vmcAppConnection.requestService(echoService);
33 echoService.echoString("success").then((response) {
34 internals.notifyTestComplete(response.value);
35 });
36 // Using internals.connectToService here, instead of just connecting
37 // with vmcApp, because we just need a MessagePipe handle (not a proxy).
38 final vmcService = internals.connectToService(
39 vmcURL, view_manager.ViewManagerClient.name);
40 document.querySelector("iframe").embedViewManagerClient(vmcService);
41 }
42 }
43
44 main() {
45 var messagePipe = new MojoMessagePipe();
46 var app = new IFrameEmbed(messagePipe.endpoints[1]);
47 app.listen();
48 var shellProxy = new shell_mojom.ShellProxy.fromHandle(
49 new MojoHandle(internals.takeShellProxyHandle()));
50 app.initializeFromShellProxy(shellProxy, [], "");
51 }
33 </script> 52 </script>
34 </html> 53 </sky>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698