Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: mojo/dart/test/validation_test.dart

Issue 1043903004: Dart bindings: support struct versioning. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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:mojo.builtin' as builtin; 8 import 'dart:mojo.builtin' as builtin;
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 10
(...skipping 17 matching lines...) Expand all
28 method1(StructA param0) => _complete(); 28 method1(StructA param0) => _complete();
29 method2(StructB param0, StructA param1) => _complete(); 29 method2(StructB param0, StructA param1) => _complete();
30 method3(List<bool> param0) => _complete(); 30 method3(List<bool> param0) => _complete();
31 method4(StructC param0, List<int> param1) => _complete(); 31 method4(StructC param0, List<int> param1) => _complete();
32 method5(StructE param0, MojoDataPipeProducer param1) => _complete(); 32 method5(StructE param0, MojoDataPipeProducer param1) => _complete();
33 method6(List<List<int>> param0) => _complete(); 33 method6(List<List<int>> param0) => _complete();
34 method7(StructF param0, List<List<int>> param1) => _complete(); 34 method7(StructF param0, List<List<int>> param1) => _complete();
35 method8(List<List<String>> param0) => _complete(); 35 method8(List<List<String>> param0) => _complete();
36 method9(List<List<MojoHandle>> param0) => _complete(); 36 method9(List<List<MojoHandle>> param0) => _complete();
37 method10(Map<String, int> param0) => _complete(); 37 method10(Map<String, int> param0) => _complete();
38 method11(StructG param0) => _complete();
38 39
39 Future close({bool nodefer: false}) => _stub.close(nodefer: nodefer); 40 Future close({bool nodefer: false}) => _stub.close(nodefer: nodefer);
40 } 41 }
41 42
42 parser.ValidationParseResult readAndParseTest(String test) { 43 parser.ValidationParseResult readAndParseTest(String test) {
43 List<int> data = builtin.readSync("${test}.data"); 44 List<int> data = builtin.readSync("${test}.data");
44 String input = new Utf8Decoder().convert(data).trim(); 45 String input = new Utf8Decoder().convert(data).trim();
45 return parser.parse(input); 46 return parser.parse(input);
46 } 47 }
47 48
(...skipping 26 matching lines...) Expand all
74 assert(r.isOk); 75 assert(r.isOk);
75 76
76 completer.future.then((_) { 77 completer.future.then((_) {
77 assert(expected == "PASS"); 78 assert(expected == "PASS");
78 conformanceImpl.close(); 79 conformanceImpl.close();
79 pipe.endpoints[0].handle.close(); 80 pipe.endpoints[0].handle.close();
80 handles.forEach((h) => h.close()); 81 handles.forEach((h) => h.close());
81 }); 82 });
82 } 83 }
83 84
84 // TODO(zra, yzshen): Some struct versioning tests (with "mthd11" in their
85 // names) are skipped.
86 Iterable<String> getTestFiles(String path, String prefix) => builtin 85 Iterable<String> getTestFiles(String path, String prefix) => builtin
87 .enumerateFiles(path) 86 .enumerateFiles(path)
88 .where((s) => 87 .where((s) => s.startsWith(prefix) && s.endsWith(".data"))
89 s.startsWith(prefix) && s.endsWith(".data") && !s.contains("mthd11"))
90 .map((s) => s.replaceFirst('.data', '')); 88 .map((s) => s.replaceFirst('.data', ''));
91 89
92 main(List args) { 90 main(List args) {
93 int handle = args[0]; 91 int handle = args[0];
94 String path = args[1]; 92 String path = args[1];
95 93
96 // First test the parser. 94 // First test the parser.
97 parser.parserTests(); 95 parser.parserTests();
98 96
99 // Then run the conformance tests. 97 // Then run the conformance tests.
100 getTestFiles(path, "$path/conformance_").forEach((test) { 98 getTestFiles(path, "$path/conformance_").forEach((test) {
101 runTest(test, readAndParseTest(test), expectedResult(test)); 99 runTest(test, readAndParseTest(test), expectedResult(test));
102 }); 100 });
103 // TODO(zra): Add integration tests when they no longer rely on Client=. 101 // TODO(zra): Add integration tests when they no longer rely on Client=.
104 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698