OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:mojo/bindings.dart' as bindings; | 10 import 'package:mojo/bindings.dart' as bindings; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 625 |
626 mojom_types.UserDefinedType udt = testValidationDescriptor[interfaceID]; | 626 mojom_types.UserDefinedType udt = testValidationDescriptor[interfaceID]; |
627 Expect.isNotNull(udt); | 627 Expect.isNotNull(udt); |
628 | 628 |
629 mojom_types.MojomInterface mi = udt.interfaceType; | 629 mojom_types.MojomInterface mi = udt.interfaceType; |
630 Expect.isNotNull(mi); | 630 Expect.isNotNull(mi); |
631 | 631 |
632 _checkMojomInterface(mi, shortName, fullIdentifier, methodMap); | 632 _checkMojomInterface(mi, shortName, fullIdentifier, methodMap); |
633 | 633 |
634 // The proxy and stub need to have a valid serviceDescription. | 634 // The proxy and stub need to have a valid serviceDescription. |
635 var bcti_p = new validation.BoundsCheckTestInterfaceProxy.unbound().impl; | 635 var boundsCheckProxyImpl = |
636 var bcti_s = new validation.BoundsCheckTestInterfaceStub.unbound(); | 636 new validation.BoundsCheckTestInterfaceProxy.unbound().impl; |
| 637 var boundsCheckStubDescription = |
| 638 validation.BoundsCheckTestInterfaceStub.serviceDescription; |
637 | 639 |
638 _checkServiceDescription( | 640 _checkServiceDescription( |
639 bcti_p.serviceDescription, interfaceID, shortName, fullIdentifier, | 641 boundsCheckProxyImpl.serviceDescription, interfaceID, shortName, |
640 methodMap); | 642 fullIdentifier, methodMap); |
641 _checkServiceDescription( | 643 _checkServiceDescription( |
642 bcti_s.serviceDescription, interfaceID, shortName, fullIdentifier, | 644 boundsCheckStubDescription, interfaceID, shortName, fullIdentifier, |
643 methodMap); | 645 methodMap); |
644 } | 646 } |
645 | 647 |
646 _checkServiceDescription(service_describer.ServiceDescription sd, | 648 _checkServiceDescription(service_describer.ServiceDescription sd, |
647 String interfaceID, String shortName, String fullIdentifier, | 649 String interfaceID, String shortName, String fullIdentifier, |
648 Map<int, String> methodMap) { | 650 Map<int, String> methodMap) { |
649 // Check the top level interface, which must pass _checkMojomInterface. | 651 // Check the top level interface, which must pass _checkMojomInterface. |
650 mojom_types.MojomInterface mi = sd.getTopLevelInterface(); | 652 Function identity = (v) => v; |
| 653 mojom_types.MojomInterface mi = sd.getTopLevelInterface(identity); |
651 _checkMojomInterface(mi, shortName, fullIdentifier, methodMap); | 654 _checkMojomInterface(mi, shortName, fullIdentifier, methodMap); |
652 | 655 |
653 // Try out sd.GetTypeDefinition with the given interfaceID. | 656 // Try out sd.GetTypeDefinition with the given interfaceID. |
654 mojom_types.UserDefinedType udt = sd.getTypeDefinition(interfaceID); | 657 mojom_types.UserDefinedType udt = sd.getTypeDefinition(interfaceID, identity); |
655 Expect.isNotNull(udt.interfaceType); | 658 Expect.isNotNull(udt.interfaceType); |
656 _checkMojomInterface(udt.interfaceType, shortName, fullIdentifier, methodMap); | 659 _checkMojomInterface(udt.interfaceType, shortName, fullIdentifier, methodMap); |
657 | 660 |
658 // Check all type definitions. Reflect-wise, all data inside should match the | 661 // Check all type definitions. Reflect-wise, all data inside should match the |
659 // imported Descriptor. | 662 // imported Descriptor. |
660 var actualDescriptions = sd.getAllTypeDefinitions(); | 663 var actualDescriptions = sd.getAllTypeDefinitions(identity); |
661 var expectedDescriptions = validation.getAllMojomTypeDefinitions(); | 664 var expectedDescriptions = validation.getAllMojomTypeDefinitions(); |
662 Expect.mapEquals(actualDescriptions, expectedDescriptions); | 665 Expect.mapEquals(actualDescriptions, expectedDescriptions); |
663 } | 666 } |
664 | 667 |
665 _checkMojomInterface(mojom_types.MojomInterface mi, String shortName, | 668 _checkMojomInterface(mojom_types.MojomInterface mi, String shortName, |
666 String fullIdentifier, Map<int, String> methodMap) { | 669 String fullIdentifier, Map<int, String> methodMap) { |
667 // check the generated short name. | 670 // check the generated short name. |
668 Expect.isNotNull(mi.declData); | 671 Expect.isNotNull(mi.declData); |
669 Expect.equals(mi.declData.shortName, shortName); | 672 Expect.equals(mi.declData.shortName, shortName); |
670 Expect.equals(mi.declData.fullIdentifier, fullIdentifier); | 673 Expect.equals(mi.declData.fullIdentifier, fullIdentifier); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 testValidateMojomTypes(); | 733 testValidateMojomTypes(); |
731 testCamelCase(); | 734 testCamelCase(); |
732 testSerializeErrorMessage(); | 735 testSerializeErrorMessage(); |
733 await testEnums(); | 736 await testEnums(); |
734 await testCallResponse(); | 737 await testCallResponse(); |
735 await testAwaitCallResponse(); | 738 await testAwaitCallResponse(); |
736 await runOnClosedTest(); | 739 await runOnClosedTest(); |
737 await testRegression551(); | 740 await testRegression551(); |
738 await testServiceName(); | 741 await testServiceName(); |
739 } | 742 } |
OLD | NEW |