blob: 56a316a510f27eb797e6291edfeac4e14ddb124b [file] [log] [blame]
// Copyright 2019 The Fuchsia 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 'package:fidl_fidl_examples_echo/fidl_async.dart';
import 'package:lib.app.dart/app_async.dart';
import 'package:test/test.dart';
import 'package:fidl_fuchsia_sys/fidl_async.dart' show LaunchInfo;
void main() {
test('test echo server publishes service correctly', () async {
const String server =
'fuchsia-pkg://fuchsia.com/echo_server_async_dart#meta/echo_server_async_dart.cmx';
var context = StartupContext.fromStartupInfo();
final Services services = Services();
final LaunchInfo launchInfo =
LaunchInfo(url: server, directoryRequest: services.request());
await context.launcher.createComponent(launchInfo, null);
var echo = EchoProxy();
echo.ctrl
.bind(await services.connectToServiceByName<Echo>(Echo.$serviceName));
final response = await echo.echoString('hello');
expect(response, 'hello');
});
}