Chromium Code Reviews| Index: mojo/dart/apptests/dart_apptests/lib/src/service_describer_apptests.dart |
| diff --git a/mojo/dart/apptests/dart_apptests/lib/src/service_describer_apptests.dart b/mojo/dart/apptests/dart_apptests/lib/src/service_describer_apptests.dart |
| index ccafe587a1ebc3b73dfd978727c9a250073a79f9..b334d38d841292a4a8abd2633500ef221bca7f48 100644 |
| --- a/mojo/dart/apptests/dart_apptests/lib/src/service_describer_apptests.dart |
| +++ b/mojo/dart/apptests/dart_apptests/lib/src/service_describer_apptests.dart |
| @@ -13,8 +13,8 @@ import 'package:mojo/core.dart'; |
| import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' |
| as service_describer; |
| -import 'package:_mojo_for_test_only/test/echo_service.mojom.dart' |
| - as echo_service; |
| +import 'package:_mojo_for_test_only/test/pingpong_service.mojom.dart' |
| + as pingpong_service; |
| // Tests that demonstrate that a service describer is able to obtain the same |
| // mojom type information present in a service's service description. |
| @@ -22,23 +22,23 @@ import 'package:_mojo_for_test_only/test/echo_service.mojom.dart' |
| // described by a mojo application without importing any of their mojom files. |
| tests(Application application, String url) { |
| group('Service Describer Apptests', () { |
| - test('Echo Service Verification', () async { |
| + test('PingPong Service Verification', () async { |
| var serviceDescriberProxy = |
| new service_describer.ServiceDescriberProxy.connectToService( |
| - application, "mojo:dart_echo_with_service_describer"); |
| + application, "mojo:dart_pingpong"); |
| var serviceDescriptionProxy = |
| new service_describer.ServiceDescriptionProxy.unbound(); |
| await serviceDescriberProxy.ptr |
|
zra
2016/03/03 16:52:36
What is the value being dropped here?
This should
rudominer
2016/03/03 22:46:14
Done (as modified by our discussion over hangouts.
|
| - .describeService("test::EchoService", serviceDescriptionProxy); |
| + .describeService("test::PingPongService", serviceDescriptionProxy); |
| expect(serviceDescriptionProxy.impl, isNotNull); |
| expect(serviceDescriptionProxy.ptr, isNotNull); |
| // Compare the service description obtained by the service describer and |
| - // the expected description taken from the echo service import. |
| + // the expected description taken from the pingpong service import. |
| var sd = serviceDescriptionProxy.ptr; |
|
zra
2016/03/03 16:52:36
Dart style is to use more descriptive variable nam
rudominer
2016/03/03 22:46:14
Done.
|
| - var ed = echo_service.EchoServiceStub.serviceDescription; |
| + var ed = pingpong_service.PingPongServiceStub.serviceDescription; |
| Function identity = (v) => v; |
| @@ -48,13 +48,18 @@ tests(Application application, String url) { |
| mojom_types.MojomInterface b = ed.getTopLevelInterface(identity); |
|
zra
2016/03/03 16:52:37
ditto
|
| _compare(a, b); |
| - String interfaceID = "echo_service_EchoService__"; |
| - mojom_types.MojomInterface c = |
| - (await sd.getTypeDefinition(interfaceID)).type.interfaceType; |
| - mojom_types.MojomInterface d = |
| - ed.getTypeDefinition(interfaceID, identity).interfaceType; |
| - _compare(a, c); |
| - _compare(c, d); |
| + // Get the type key for the type of the first parameter of the |
| + // first method of the interface. |
| + mojom_types.MojomMethod setClientMethod = a.methods[0]; |
| + mojom_types.StructField firstParam = setClientMethod.parameters.fields[0]; |
| + String typeKey = firstParam.type.typeReference.typeKey; |
| + |
| + // Use getTypeDefinition() to get the type and check that it |
| + // is named "PingPongClient". |
| + mojom_types.MojomInterface pingPongClientInterface = |
| + (await sd.getTypeDefinition(typeKey)).type.interfaceType; |
| + expect(pingPongClientInterface.declData.shortName, |
| + equals("PingPongClient")); |
| // Check that the mojom type definitions match between mappings. |
| // For simplicity, check in a shallow manner. |
| @@ -69,6 +74,7 @@ tests(Application application, String url) { |
| await serviceDescriptionProxy.close(); |
| await serviceDescriberProxy.close(); |
| + |
|
alexfandrianto
2016/03/03 02:26:23
optional: remove
rudominer
2016/03/03 22:46:14
Done.
|
| }); |
| }); |
| } |