OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library runtime_configuration; | 5 library runtime_configuration; |
6 | 6 |
7 import 'compiler_configuration.dart' show CommandArtifact; | 7 import 'compiler_configuration.dart' show CommandArtifact; |
8 | 8 |
9 // TODO(ahe): Remove this import, we can precompute all the values required | 9 // TODO(ahe): Remove this import, we can precompute all the values required |
10 // from TestSuite once the refactoring is complete. | 10 // from TestSuite once the refactoring is complete. |
11 import 'test_suite.dart' show TestSuite; | 11 import 'test_suite.dart' show TestSuite; |
12 | 12 |
13 import 'test_runner.dart' show Command, CommandBuilder; | 13 import 'test_runner.dart' show Command, CommandBuilder; |
14 | 14 |
15 // TODO(ahe): I expect this class will become abstract very soon. | 15 // TODO(ahe): I expect this class will become abstract very soon. |
16 class RuntimeConfiguration { | 16 class RuntimeConfiguration { |
17 // TODO(ahe): Remove this constructor and move the switch to | 17 // TODO(ahe): Remove this constructor and move the switch to |
18 // test_options.dart. We probably want to store an instance of | 18 // test_options.dart. We probably want to store an instance of |
19 // [RuntimeConfiguration] in [configuration] there. | 19 // [RuntimeConfiguration] in [configuration] there. |
20 factory RuntimeConfiguration(Map configuration) { | 20 factory RuntimeConfiguration(Map configuration) { |
21 String runtime = configuration['runtime']; | 21 String runtime = configuration['runtime']; |
| 22 bool useBlobs = configuration['use_blobs']; |
| 23 |
22 switch (runtime) { | 24 switch (runtime) { |
23 case 'ContentShellOnAndroid': | 25 case 'ContentShellOnAndroid': |
24 case 'DartiumOnAndroid': | 26 case 'DartiumOnAndroid': |
25 case 'chrome': | 27 case 'chrome': |
26 case 'chromeOnAndroid': | 28 case 'chromeOnAndroid': |
27 case 'dartium': | 29 case 'dartium': |
28 case 'ff': | 30 case 'ff': |
29 case 'firefox': | 31 case 'firefox': |
30 case 'ie11': | 32 case 'ie11': |
31 case 'ie10': | 33 case 'ie10': |
(...skipping 13 matching lines...) Expand all Loading... |
45 case 'none': | 47 case 'none': |
46 return new NoneRuntimeConfiguration(); | 48 return new NoneRuntimeConfiguration(); |
47 | 49 |
48 case 'vm': | 50 case 'vm': |
49 return new StandaloneDartRuntimeConfiguration(); | 51 return new StandaloneDartRuntimeConfiguration(); |
50 | 52 |
51 case 'dart_product': | 53 case 'dart_product': |
52 return new DartProductRuntimeConfiguration(); | 54 return new DartProductRuntimeConfiguration(); |
53 | 55 |
54 case 'dart_precompiled': | 56 case 'dart_precompiled': |
55 return new DartPrecompiledRuntimeConfiguration(); | 57 return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); |
56 | 58 |
57 case 'drt': | 59 case 'drt': |
58 return new DrtRuntimeConfiguration(); | 60 return new DrtRuntimeConfiguration(); |
59 | 61 |
60 default: | 62 default: |
61 throw "Unknown runtime '$runtime'"; | 63 throw "Unknown runtime '$runtime'"; |
62 } | 64 } |
63 } | 65 } |
64 | 66 |
65 RuntimeConfiguration._subclass(); | 67 RuntimeConfiguration._subclass(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 augmentedArgs.addAll(arguments); | 239 augmentedArgs.addAll(arguments); |
238 | 240 |
239 return <Command>[ | 241 return <Command>[ |
240 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, | 242 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, |
241 augmentedArgs, environmentOverrides) | 243 augmentedArgs, environmentOverrides) |
242 ]; | 244 ]; |
243 } | 245 } |
244 } | 246 } |
245 | 247 |
246 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { | 248 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 249 final bool useBlobs; |
| 250 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
| 251 |
247 List<Command> computeRuntimeCommands( | 252 List<Command> computeRuntimeCommands( |
248 TestSuite suite, | 253 TestSuite suite, |
249 CommandBuilder commandBuilder, | 254 CommandBuilder commandBuilder, |
250 CommandArtifact artifact, | 255 CommandArtifact artifact, |
251 List<String> arguments, | 256 List<String> arguments, |
252 Map<String, String> environmentOverrides) { | 257 Map<String, String> environmentOverrides) { |
253 String script = artifact.filename; | 258 String script = artifact.filename; |
254 String type = artifact.mimeType; | 259 String type = artifact.mimeType; |
255 if (script != null && type != 'application/dart-precompiled') { | 260 if (script != null && type != 'application/dart-precompiled') { |
256 throw "dart_precompiled cannot run files of type '$type'."; | 261 throw "dart_precompiled cannot run files of type '$type'."; |
257 } | 262 } |
258 | 263 |
259 var augmentedArgs = new List(); | 264 var augmentedArgs = new List(); |
260 augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}"); | 265 augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}"); |
| 266 if (useBlobs) { |
| 267 augmentedArgs.add("--use_blobs"); |
| 268 } |
261 augmentedArgs.addAll(arguments); | 269 augmentedArgs.addAll(arguments); |
262 | 270 |
263 return <Command>[ | 271 return <Command>[ |
264 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 272 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, |
265 augmentedArgs, environmentOverrides) | 273 augmentedArgs, environmentOverrides) |
266 ]; | 274 ]; |
267 } | 275 } |
268 } | 276 } |
269 | 277 |
270 /// Temporary runtime configuration for browser runtimes that haven't been | 278 /// Temporary runtime configuration for browser runtimes that haven't been |
271 /// migrated yet. | 279 /// migrated yet. |
272 // TODO(ahe): Remove this class. | 280 // TODO(ahe): Remove this class. |
273 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 281 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
274 List<Command> computeRuntimeCommands( | 282 List<Command> computeRuntimeCommands( |
275 TestSuite suite, | 283 TestSuite suite, |
276 CommandBuilder commandBuilder, | 284 CommandBuilder commandBuilder, |
277 CommandArtifact artifact, | 285 CommandArtifact artifact, |
278 List<String> arguments, | 286 List<String> arguments, |
279 Map<String, String> environmentOverrides) { | 287 Map<String, String> environmentOverrides) { |
280 throw "Unimplemented runtime '$runtimeType'"; | 288 throw "Unimplemented runtime '$runtimeType'"; |
281 } | 289 } |
282 } | 290 } |
OLD | NEW |