| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
| 9 import 'mojo:bindings'; | 9 import 'mojo:bindings'; |
| 10 import 'mojo:builtin' as builtin; | 10 import 'mojo:builtin' as builtin; |
| 11 import 'mojo:core'; | 11 import 'mojo:core'; |
| 12 | 12 |
| 13 import 'package:mojo/dart/testing/validation_test_input_parser.dart' as parser; | 13 import 'package:mojo/dart/testing/validation_test_input_parser.dart' as parser; |
| 14 import 'package:mojo/public/interfaces/bindings/tests/validation_test_interfaces
.mojom.dart'; | 14 import 'package:mojo/public/interfaces/bindings/tests/validation_test_interfaces
.mojom.dart'; |
| 15 | 15 |
| 16 class ConformanceTestInterfaceImpl implements ConformanceTestInterface { | 16 class ConformanceTestInterfaceImpl implements ConformanceTestInterface { |
| 17 ConformanceTestInterfaceStub _stub; | 17 ConformanceTestInterfaceBinding _binding; |
| 18 Completer _completer; | 18 Completer _completer; |
| 19 | 19 |
| 20 ConformanceTestInterfaceImpl(this._completer, | 20 ConformanceTestInterfaceImpl(this._completer, |
| 21 MojoMessagePipeEndpoint endpoint) { | 21 MojoMessagePipeEndpoint endpoint) { |
| 22 _stub = new ConformanceTestInterfaceStub.fromEndpoint(endpoint) | 22 _binding = new ConformanceTestInterfaceBinding.fromEndpoint( |
| 23 ..delegate = this | 23 endpoint, delegate: this); |
| 24 ..listen(); | |
| 25 } | 24 } |
| 26 | 25 |
| 27 void _complete() => _completer.complete(null); | 26 void _complete() => _completer.complete(null); |
| 28 | 27 |
| 29 method0(double param0) => _complete(); | 28 method0(double param0) => _complete(); |
| 30 method1(StructA param0) => _complete(); | 29 method1(StructA param0) => _complete(); |
| 31 method2(StructB param0, StructA param1) => _complete(); | 30 method2(StructB param0, StructA param1) => _complete(); |
| 32 method3(List<bool> param0) => _complete(); | 31 method3(List<bool> param0) => _complete(); |
| 33 method4(StructC param0, List<int> param1) => _complete(); | 32 method4(StructC param0, List<int> param1) => _complete(); |
| 34 method5(StructE param0, MojoDataPipeProducer param1) => _complete(); | 33 method5(StructE param0, MojoDataPipeProducer param1) => _complete(); |
| 35 method6(List<List<int>> param0) => _complete(); | 34 method6(List<List<int>> param0) => _complete(); |
| 36 method7(StructF param0, List<List<int>> param1) => _complete(); | 35 method7(StructF param0, List<List<int>> param1) => _complete(); |
| 37 method8(List<List<String>> param0) => _complete(); | 36 method8(List<List<String>> param0) => _complete(); |
| 38 method9(List<List<MojoHandle>> param0) => _complete(); | 37 method9(List<List<MojoHandle>> param0) => _complete(); |
| 39 method10(Map<String, int> param0) => _complete(); | 38 method10(Map<String, int> param0) => _complete(); |
| 40 | 39 |
| 41 void close({bool nodefer : false}) => _stub.close(nodefer: nodefer); | 40 void close({bool nodefer : false}) => _binding.close(nodefer: nodefer); |
| 42 } | 41 } |
| 43 | 42 |
| 44 parser.ValidationParseResult readAndParseTest(String test) { | 43 parser.ValidationParseResult readAndParseTest(String test) { |
| 45 List<int> data = builtin.readSync("${test}.data"); | 44 List<int> data = builtin.readSync("${test}.data"); |
| 46 String input = new Utf8Decoder().convert(data).trim(); | 45 String input = new Utf8Decoder().convert(data).trim(); |
| 47 return parser.parse(input); | 46 return parser.parse(input); |
| 48 } | 47 } |
| 49 | 48 |
| 50 String expectedResult(String test) { | 49 String expectedResult(String test) { |
| 51 List<int> data = builtin.readSync("${test}.expected"); | 50 List<int> data = builtin.readSync("${test}.expected"); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 97 |
| 99 // First test the parser. | 98 // First test the parser. |
| 100 parser.parserTests(); | 99 parser.parserTests(); |
| 101 | 100 |
| 102 // Then run the conformance tests. | 101 // Then run the conformance tests. |
| 103 getTestFiles(path, "$path/conformance_").forEach((test) { | 102 getTestFiles(path, "$path/conformance_").forEach((test) { |
| 104 runTest(test, readAndParseTest(test), expectedResult(test)); | 103 runTest(test, readAndParseTest(test), expectedResult(test)); |
| 105 }); | 104 }); |
| 106 // TODO(zra): Add integration tests when they no longer rely on Client=. | 105 // TODO(zra): Add integration tests when they no longer rely on Client=. |
| 107 } | 106 } |
| OLD | NEW |