Chromium Code Reviews| Index: services/dart/test/echo.dart |
| diff --git a/services/dart/test/echo.dart b/services/dart/test/echo.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a9dc19041a30a57293f42cb326b628f1380eef81 |
| --- /dev/null |
| +++ b/services/dart/test/echo.dart |
| @@ -0,0 +1,49 @@ |
| +#!mojo mojo:dart_content_handler |
| + |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +import 'dart:async'; |
| +import 'dart:mojo_application'; |
| +import 'dart:mojo_bindings'; |
| +import 'dart:mojo_core'; |
| + |
| +import 'package:services/dart/test/echo_service.mojom.dart'; |
| + |
| +// TODO(zra): Interface implementations that delegate to another implementation |
| +// will all look the same, more or less. Maybe we should generate them? |
|
abarth-chromium
2015/01/18 22:19:02
Yeah, we generate them in JavaScript.
zra
2015/01/20 17:36:51
There is a simple way to remove this. I'll clean i
|
| +class EchoServiceImpl extends EchoServiceInterface { |
| + EchoServiceInterface _delegate; |
| + |
| + EchoServiceImpl(this._delegate, MojoMessagePipeEndpoint endpoint) : |
| + super(endpoint); |
| + |
| + echoString(String value) => _delegate.echoString(value); |
| +} |
| + |
| +class EchoApplication extends Application implements EchoServiceInterface { |
| + EchoApplication(MojoMessagePipeEndpoint endpoint) : super(endpoint); |
| + |
| + EchoApplication.fromHandle(MojoHandle handle) : super.fromHandle(handle); |
|
abarth-chromium
2015/01/18 22:19:02
It's too bad we need both these constructors. The
abarth-chromium
2015/01/18 22:19:02
It's too bad we need both these constructors. See
zra
2015/01/20 17:36:51
I'll try to clean up in the next CL.
|
| + |
| + Function interfaceFactoryClosure() { |
| + return (endpoint) => new EchoServiceImpl(this, endpoint); |
| + } |
| + |
| + echoString(String value) { |
| + var response = new EchoServiceEchoStringResponseParams(); |
|
abarth-chromium
2015/01/18 22:19:02
In other languages, we're able to bury the EchoSer
zra
2015/01/20 17:36:51
I'll try to clean up in the next CL.
|
| + if (value == 'quit') { |
| + close(); |
| + } |
| + response.value = value; |
| + return new Future.value(response); |
| + } |
| +} |
| + |
| +main(List args) { |
| + MojoHandle shellHandle = new MojoHandle(args[0]); |
| + String url = args[1]; |
| + var echoApplication = new EchoApplication.fromHandle(shellHandle); |
| + echoApplication.listen(); |
| +} |