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

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

Issue 816113004: Dart: Adds a content handler and a test. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge CLs that address comments Created 5 years, 11 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
(Empty)
1 #!mojo mojo:dart_content_handler
2
3 // Copyright 2014 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6
7 import 'dart:async';
8 import 'dart:mojo_bindings';
9 import 'dart:mojo_core';
10
11 import 'package:services/dart/test/echo_service.mojom.dart';
12
13 // TODO(zra): Interface implementations that delegate to another implementation
14 // will all look the same, more or less. Maybe we should generate them?
15 class EchoServiceImpl extends EchoServiceInterface {
16 EchoServiceInterface _delegate;
17
18 EchoServiceImpl(this._delegate, MojoMessagePipeEndpoint endpoint) :
19 super(endpoint);
20
21 echoString(String value) => _delegate.echoString(value);
22 }
23
24 class EchoApplication extends Application implements EchoServiceInterface {
25 EchoApplication(MojoMessagePipeEndpoint endpoint) : super(endpoint);
26
27 EchoApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle);
28
29 Function interfaceFactoryClosure() {
30 return (endpoint) => new EchoServiceImpl(this, endpoint);
31 }
32
33 echoString(String value) {
34 var response = new EchoServiceEchoStringResponseParams();
35 if (value == 'quit') {
36 close();
37 }
38 response.value = value;
39 return new Future.value(response);
40 }
41 }
42
43 main(List args) {
44 MojoHandle shellHandle = new MojoHandle(args[0]);
45 String url = args[1];
46 var echoApplication = new EchoApplication.fromHandle(shellHandle);
47 echoApplication.listen();
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698