OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:async' show | |
6 Future; | |
7 | |
8 import '../service_tests.dart' show | |
9 BuildSnapshotRule, | |
10 CcRule, | |
11 CompileServiceRule, | |
12 CopyRule, | |
13 RunSnapshotsRule, | |
14 ServiceTest; | |
15 | |
16 const String thisDirectory = 'tests/service_tests/multiple_services'; | |
17 | |
18 const List<String> sharedIdlFiles = const <String>[ | |
19 'service_one.idl', | |
20 'service_two.idl', | |
21 ]; | |
22 | |
23 const List<String> sharedDartFiles = const <String>[ | |
24 'service_one_impl.dart', | |
25 'service_two_impl.dart', | |
26 ]; | |
27 | |
28 const List<String> sharedCCFiles = const <String>[ | |
29 'cc/service_one.cc', | |
30 'cc/service_two.cc', | |
31 'cc/struct.cc', | |
32 'cc/unicode.cc', | |
33 ]; | |
34 | |
35 class MultipleServicesTest extends ServiceTest { | |
36 MultipleServicesTest() | |
37 : super('multiple_services'); | |
38 | |
39 String get mainFile => 'multiple_services.dart'; | |
40 String get mainPath => '$outputDirectory/multiple_services.dart'; | |
41 String get snapshotPath => '$outputDirectory/multiple_services.snapshot'; | |
42 String get executablePath => '$outputDirectory/multiple_services'; | |
43 | |
44 Future<Null> prepare() async { | |
45 rules.add(new CopyRule(thisDirectory, outputDirectory, [mainFile])); | |
46 rules.add(new CopyRule(thisDirectory, outputDirectory, sharedDartFiles)); | |
47 | |
48 for (String idl in sharedIdlFiles) { | |
49 rules.add(new CompileServiceRule('$thisDirectory/$idl', outputDirectory)); | |
50 } | |
51 | |
52 rules.add(new CcRule( | |
53 executable: executablePath, | |
54 includePaths: [outputDirectory], | |
55 sources: ['$thisDirectory/multiple_services_test.cc'] | |
56 ..addAll(sharedCCFiles.map((path) => '$outputDirectory/$path')))); | |
57 | |
58 rules.add(new BuildSnapshotRule(mainPath, snapshotPath)); | |
59 | |
60 rules.add(new RunSnapshotsRule(executablePath, [snapshotPath])); | |
61 } | |
62 } | |
63 | |
64 class MultipleSnapshotsTest extends ServiceTest { | |
65 MultipleSnapshotsTest() | |
66 : super('multiple_snapshots'); | |
67 | |
68 String get serviceOnePath => '$outputDirectory/service_one_impl.dart'; | |
69 String get snapshotOnePath => '$outputDirectory/service_one.snapshot'; | |
70 | |
71 String get serviceTwoPath => '$outputDirectory/service_two_impl.dart'; | |
72 String get snapshotTwoPath => '$outputDirectory/service_two.snapshot'; | |
73 | |
74 String get executablePath => '$outputDirectory/multiple_snapshots'; | |
75 | |
76 Future<Null> prepare() async { | |
77 rules.add(new CopyRule(thisDirectory, outputDirectory, sharedDartFiles)); | |
78 | |
79 for (String idl in sharedIdlFiles) { | |
80 rules.add(new CompileServiceRule('$thisDirectory/$idl', outputDirectory)); | |
81 } | |
82 | |
83 rules.add(new CcRule( | |
84 executable: executablePath, | |
85 includePaths: [outputDirectory], | |
86 sources: ['$thisDirectory/multiple_snapshots_test.cc'] | |
87 ..addAll(sharedCCFiles.map((path) => '$outputDirectory/$path')))); | |
88 | |
89 rules.add(new BuildSnapshotRule(serviceOnePath, snapshotOnePath)); | |
90 rules.add(new BuildSnapshotRule(serviceTwoPath, snapshotTwoPath)); | |
91 | |
92 rules.add(new RunSnapshotsRule( | |
93 executablePath, [snapshotOnePath, snapshotTwoPath])); | |
94 } | |
95 } | |
96 | |
97 final List<ServiceTest> serviceTests = <ServiceTest>[ | |
98 new MultipleServicesTest(), | |
99 new MultipleSnapshotsTest(), | |
100 ]; | |
OLD | NEW |