| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 augmentedArgs.addAll(arguments); | 238 augmentedArgs.addAll(arguments); |
| 237 | 239 |
| 238 return <Command>[ | 240 return <Command>[ |
| 239 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, | 241 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, |
| 240 augmentedArgs, environmentOverrides) | 242 augmentedArgs, environmentOverrides) |
| 241 ]; | 243 ]; |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 | 246 |
| 245 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { | 247 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 248 final bool useBlobs; |
| 249 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
| 250 |
| 246 List<Command> computeRuntimeCommands( | 251 List<Command> computeRuntimeCommands( |
| 247 TestSuite suite, | 252 TestSuite suite, |
| 248 CommandBuilder commandBuilder, | 253 CommandBuilder commandBuilder, |
| 249 CommandArtifact artifact, | 254 CommandArtifact artifact, |
| 250 List<String> arguments, | 255 List<String> arguments, |
| 251 Map<String, String> environmentOverrides) { | 256 Map<String, String> environmentOverrides) { |
| 252 String script = artifact.filename; | 257 String script = artifact.filename; |
| 253 String type = artifact.mimeType; | 258 String type = artifact.mimeType; |
| 254 if (script != null && type != 'application/dart-precompiled') { | 259 if (script != null && type != 'application/dart-precompiled') { |
| 255 throw "dart_precompiled cannot run files of type '$type'."; | 260 throw "dart_precompiled cannot run files of type '$type'."; |
| 256 } | 261 } |
| 257 | 262 |
| 258 var augmentedArgs = new List(); | 263 var augmentedArgs = new List(); |
| 259 augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}"); | 264 augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}"); |
| 265 if (useBlobs) { |
| 266 augmentedArgs.add("--use_blobs"); |
| 267 } |
| 260 augmentedArgs.addAll(arguments); | 268 augmentedArgs.addAll(arguments); |
| 261 | 269 |
| 262 return <Command>[ | 270 return <Command>[ |
| 263 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 271 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, |
| 264 augmentedArgs, environmentOverrides) | 272 augmentedArgs, environmentOverrides) |
| 265 ]; | 273 ]; |
| 266 } | 274 } |
| 267 } | 275 } |
| 268 | 276 |
| 269 /// Temporary runtime configuration for browser runtimes that haven't been | 277 /// Temporary runtime configuration for browser runtimes that haven't been |
| 270 /// migrated yet. | 278 /// migrated yet. |
| 271 // TODO(ahe): Remove this class. | 279 // TODO(ahe): Remove this class. |
| 272 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 280 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 273 List<Command> computeRuntimeCommands( | 281 List<Command> computeRuntimeCommands( |
| 274 TestSuite suite, | 282 TestSuite suite, |
| 275 CommandBuilder commandBuilder, | 283 CommandBuilder commandBuilder, |
| 276 CommandArtifact artifact, | 284 CommandArtifact artifact, |
| 277 List<String> arguments, | 285 List<String> arguments, |
| 278 Map<String, String> environmentOverrides) { | 286 Map<String, String> environmentOverrides) { |
| 279 throw "Unimplemented runtime '$runtimeType'"; | 287 throw "Unimplemented runtime '$runtimeType'"; |
| 280 } | 288 } |
| 281 } | 289 } |
| OLD | NEW |