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 'dart:io' show Directory, File; | 7 import 'dart:io' show Directory, File; |
8 | 8 |
9 import 'compiler_configuration.dart' show CommandArtifact; | 9 import 'compiler_configuration.dart' show CommandArtifact; |
10 | 10 |
11 // TODO(ahe): Remove this import, we can precompute all the values required | 11 // TODO(ahe): Remove this import, we can precompute all the values required |
12 // from TestSuite once the refactoring is complete. | 12 // from TestSuite once the refactoring is complete. |
13 import 'test_suite.dart' show TestSuite, TestUtils; | 13 import 'test_suite.dart' show TestSuite, TestUtils; |
14 | 14 |
15 import 'test_runner.dart' show Command, CommandBuilder; | 15 import 'test_runner.dart' show Command, CommandBuilder; |
16 | 16 |
17 /// Describes the commands to run a given test case or its compiled output. | 17 /// Describes the commands to run a given test case or its compiled output. |
18 /// | 18 /// |
19 /// A single runtime configuration object exists per test suite, and is thus | 19 /// A single runtime configuration object exists per test suite, and is thus |
20 /// shared between multiple test cases, it should not be mutated after | 20 /// shared between multiple test cases, it should not be mutated after |
21 /// construction. | 21 /// construction. |
22 // | 22 // |
23 // TODO(ahe): I expect this class will become abstract very soon. | 23 // TODO(ahe): I expect this class will become abstract very soon. |
24 class RuntimeConfiguration { | 24 class RuntimeConfiguration { |
25 // TODO(ahe): Remove this constructor and move the switch to | 25 // TODO(ahe): Remove this constructor and move the switch to |
26 // test_options.dart. We probably want to store an instance of | 26 // test_options.dart. We probably want to store an instance of |
27 // [RuntimeConfiguration] in [configuration] there. | 27 // [RuntimeConfiguration] in [configuration] there. |
28 factory RuntimeConfiguration(Map<String, dynamic> configuration) { | 28 factory RuntimeConfiguration(Map<String, dynamic> configuration) { |
29 String runtime = configuration['runtime']; | 29 var runtime = configuration['runtime'] as String; |
30 bool useBlobs = configuration['use_blobs']; | 30 var useBlobs = configuration['use_blobs'] as bool; |
31 | 31 |
32 switch (runtime) { | 32 switch (runtime) { |
33 case 'ContentShellOnAndroid': | 33 case 'ContentShellOnAndroid': |
34 case 'DartiumOnAndroid': | 34 case 'DartiumOnAndroid': |
35 case 'chrome': | 35 case 'chrome': |
36 case 'chromeOnAndroid': | 36 case 'chromeOnAndroid': |
37 case 'dartium': | 37 case 'dartium': |
38 case 'ff': | 38 case 'ff': |
39 case 'firefox': | 39 case 'firefox': |
40 case 'ie11': | 40 case 'ie11': |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 List<Command> computeRuntimeCommands( | 336 List<Command> computeRuntimeCommands( |
337 TestSuite suite, | 337 TestSuite suite, |
338 CommandBuilder commandBuilder, | 338 CommandBuilder commandBuilder, |
339 CommandArtifact artifact, | 339 CommandArtifact artifact, |
340 List<String> arguments, | 340 List<String> arguments, |
341 Map<String, String> environmentOverrides) { | 341 Map<String, String> environmentOverrides) { |
342 String executable = suite.dartVmBinaryFileName; | 342 String executable = suite.dartVmBinaryFileName; |
343 return selfCheckers | 343 return selfCheckers |
344 .map((String tester) => commandBuilder.getVmBatchCommand( | 344 .map((String tester) => commandBuilder.getVmBatchCommand( |
345 executable, tester, arguments, environmentOverrides, | 345 executable, tester, arguments, environmentOverrides, |
346 checked: suite.configuration['checked'])) | 346 checked: suite.configuration['checked'] as bool)) |
347 .toList(); | 347 .toList(); |
348 } | 348 } |
349 | 349 |
350 @override | 350 @override |
351 bool get shouldSkipNegativeTests => true; | 351 bool get shouldSkipNegativeTests => true; |
352 } | 352 } |
353 | 353 |
354 /// Temporary runtime configuration for browser runtimes that haven't been | 354 /// Temporary runtime configuration for browser runtimes that haven't been |
355 /// migrated yet. | 355 /// migrated yet. |
356 // TODO(ahe): Remove this class. | 356 // TODO(ahe): Remove this class. |
357 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 357 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
358 List<Command> computeRuntimeCommands( | 358 List<Command> computeRuntimeCommands( |
359 TestSuite suite, | 359 TestSuite suite, |
360 CommandBuilder commandBuilder, | 360 CommandBuilder commandBuilder, |
361 CommandArtifact artifact, | 361 CommandArtifact artifact, |
362 List<String> arguments, | 362 List<String> arguments, |
363 Map<String, String> environmentOverrides) { | 363 Map<String, String> environmentOverrides) { |
364 throw "Unimplemented runtime '$runtimeType'"; | 364 throw "Unimplemented runtime '$runtimeType'"; |
365 } | 365 } |
366 } | 366 } |
OLD | NEW |