OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library service_describer_apptests; | 5 library service_describer_apptests; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo_apptest/apptest.dart'; | 9 import 'package:mojo_apptest/apptest.dart'; |
10 import 'package:mojo/application.dart'; | 10 import 'package:mojo/application.dart'; |
(...skipping 30 matching lines...) Expand all Loading... | |
41 var ed = echo_service.EchoServiceStub.serviceDescription; | 41 var ed = echo_service.EchoServiceStub.serviceDescription; |
42 | 42 |
43 Function identity = (v) => v; | 43 Function identity = (v) => v; |
44 | 44 |
45 // Top-level Mojom Interfaces must match. | 45 // Top-level Mojom Interfaces must match. |
46 mojom_types.MojomInterface a = | 46 mojom_types.MojomInterface a = |
47 (await sd.getTopLevelInterface()).mojomInterface; | 47 (await sd.getTopLevelInterface()).mojomInterface; |
48 mojom_types.MojomInterface b = ed.getTopLevelInterface(identity); | 48 mojom_types.MojomInterface b = ed.getTopLevelInterface(identity); |
49 _compare(a, b); | 49 _compare(a, b); |
50 | 50 |
51 String interfaceID = "echo_service_EchoService__"; | |
52 mojom_types.MojomInterface c = | |
53 (await sd.getTypeDefinition(interfaceID)).type.interfaceType; | |
54 mojom_types.MojomInterface d = | |
55 ed.getTypeDefinition(interfaceID, identity).interfaceType; | |
56 _compare(a, c); | |
57 _compare(c, d); | |
alexfandrianto
2016/03/02 05:27:12
Does this part of the test need to be removed? If
rudominer
2016/03/03 01:09:36
OK here is what I did: I switched this test to que
| |
58 | |
59 // Check that the mojom type definitions match between mappings. | 51 // Check that the mojom type definitions match between mappings. |
60 // For simplicity, check in a shallow manner. | 52 // For simplicity, check in a shallow manner. |
61 var actualDescriptions = (await sd.getAllTypeDefinitions()).definitions; | 53 var actualDescriptions = (await sd.getAllTypeDefinitions()).definitions; |
62 var expectedDescriptions = ed.getAllTypeDefinitions(identity); | 54 var expectedDescriptions = ed.getAllTypeDefinitions(identity); |
63 actualDescriptions.keys.forEach((String key) { | 55 actualDescriptions.keys.forEach((String key) { |
64 var a = actualDescriptions[key]; | 56 var a = actualDescriptions[key]; |
65 var e = expectedDescriptions[key]; | 57 var e = expectedDescriptions[key]; |
66 expect(e, isNotNull); | 58 expect(e, isNotNull); |
67 expect(a.runtimeType, equals(e.runtimeType)); | 59 expect(a.runtimeType, equals(e.runtimeType)); |
68 }); | 60 }); |
(...skipping 29 matching lines...) Expand all Loading... | |
98 expect(methodA.parameters.fields.length, | 90 expect(methodA.parameters.fields.length, |
99 equals(methodB.parameters.fields.length)); | 91 equals(methodB.parameters.fields.length)); |
100 mojom_types.MojomStruct responseA = methodA.responseParams; | 92 mojom_types.MojomStruct responseA = methodA.responseParams; |
101 mojom_types.MojomStruct responseB = methodB.responseParams; | 93 mojom_types.MojomStruct responseB = methodB.responseParams; |
102 expect(responseA == null, equals(responseB == null)); | 94 expect(responseA == null, equals(responseB == null)); |
103 if (responseA != null) { | 95 if (responseA != null) { |
104 expect(responseA.fields.length, equals(responseB.fields.length)); | 96 expect(responseA.fields.length, equals(responseB.fields.length)); |
105 } | 97 } |
106 }); | 98 }); |
107 } | 99 } |
OLD | NEW |