Index: tools/testing/dart/runtime_configuration.dart |
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart |
index c57ba6584059e4ec1b175808adca40f335f53083..20b991b1a51337512daf3d623f80ee5ce6f1b049 100644 |
--- a/tools/testing/dart/runtime_configuration.dart |
+++ b/tools/testing/dart/runtime_configuration.dart |
@@ -2,86 +2,80 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library runtime_configuration; |
- |
-import 'dart:io' show Directory, File; |
- |
-import 'compiler_configuration.dart' show CommandArtifact; |
+import 'dart:io'; |
+import 'compiler_configuration.dart'; |
+import 'configuration.dart'; |
// TODO(ahe): Remove this import, we can precompute all the values required |
// from TestSuite once the refactoring is complete. |
-import 'test_suite.dart' show TestSuite, TestUtils; |
- |
-import 'test_runner.dart' show Command, CommandBuilder; |
+import 'test_suite.dart'; |
+import 'test_runner.dart'; |
/// Describes the commands to run a given test case or its compiled output. |
/// |
/// A single runtime configuration object exists per test suite, and is thus |
/// shared between multiple test cases, it should not be mutated after |
/// construction. |
-// |
-// TODO(ahe): I expect this class will become abstract very soon. |
-class RuntimeConfiguration { |
- // TODO(ahe): Remove this constructor and move the switch to |
- // test_options.dart. We probably want to store an instance of |
- // [RuntimeConfiguration] in [configuration] there. |
- factory RuntimeConfiguration(Map<String, dynamic> configuration) { |
- var runtime = configuration['runtime'] as String; |
- var useBlobs = configuration['use_blobs'] as bool; |
- |
- switch (runtime) { |
- case 'ContentShellOnAndroid': |
- case 'DartiumOnAndroid': |
- case 'chrome': |
- case 'chromeOnAndroid': |
- case 'dartium': |
- case 'ff': |
- case 'firefox': |
- case 'ie11': |
- case 'ie10': |
- case 'ie9': |
- case 'opera': |
- case 'safari': |
- case 'safarimobilesim': |
+abstract class RuntimeConfiguration { |
+ factory RuntimeConfiguration(Configuration configuration) { |
+ switch (configuration.runtime) { |
+ case Runtime.contentShellOnAndroid: |
+ case Runtime.dartiumOnAndroid: |
+ case Runtime.chrome: |
+ case Runtime.chromeOnAndroid: |
+ case Runtime.dartium: |
+ case Runtime.firefox: |
+ case Runtime.ie11: |
+ case Runtime.ie10: |
+ case Runtime.ie9: |
+ case Runtime.opera: |
+ case Runtime.safari: |
+ case Runtime.safariMobileSim: |
// TODO(ahe): Replace this with one or more browser runtimes. |
return new DummyRuntimeConfiguration(); |
- case 'jsshell': |
+ case Runtime.jsshell: |
return new JsshellRuntimeConfiguration(); |
- case 'd8': |
+ case Runtime.d8: |
return new D8RuntimeConfiguration(); |
- case 'none': |
+ case Runtime.none: |
return new NoneRuntimeConfiguration(); |
- case 'vm': |
+ case Runtime.vm: |
return new StandaloneDartRuntimeConfiguration(); |
- case 'flutter': |
+ case Runtime.flutter: |
return new StandaloneFlutterEngineConfiguration(); |
- case 'dart_precompiled': |
- if (configuration['system'] == 'android') { |
- return new DartPrecompiledAdbRuntimeConfiguration(useBlobs: useBlobs); |
+ case Runtime.dartPrecompiled: |
+ if (configuration.system == System.android) { |
+ return new DartPrecompiledAdbRuntimeConfiguration( |
+ useBlobs: configuration.useBlobs); |
+ } else { |
+ return new DartPrecompiledRuntimeConfiguration( |
+ useBlobs: configuration.useBlobs); |
} |
- return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); |
+ break; |
- case 'drt': |
+ case Runtime.drt: |
return new DrtRuntimeConfiguration(); |
- case 'self_check': |
+ case Runtime.selfCheck: |
return new SelfCheckRuntimeConfiguration(); |
- |
- default: |
- throw "Unknown runtime '$runtime'"; |
} |
+ |
+ throw "unreachable"; |
} |
RuntimeConfiguration._subclass(); |
- int computeTimeoutMultiplier( |
- {String mode, bool isChecked: false, bool isReload: false, String arch}) { |
+ int timeoutMultiplier( |
+ {Mode mode, |
+ bool isChecked: false, |
+ bool isReload: false, |
+ Architecture arch}) { |
return 1; |
} |
@@ -176,25 +170,30 @@ class JsshellRuntimeConfiguration extends CommandLineJavaScriptRuntime { |
class DartVmRuntimeConfiguration extends RuntimeConfiguration { |
DartVmRuntimeConfiguration() : super._subclass(); |
- int computeTimeoutMultiplier( |
- {String mode, bool isChecked: false, bool isReload: false, String arch}) { |
- int multiplier = 1; |
+ int timeoutMultiplier( |
+ {Mode mode, |
+ bool isChecked: false, |
+ bool isReload: false, |
+ Architecture arch}) { |
+ var multiplier = 1; |
+ |
switch (arch) { |
- case 'simarm': |
- case 'arm': |
- case 'simarmv6': |
- case 'armv6': |
- case ' simarmv5te': |
- case 'armv5te': |
- case 'simmips': |
- case 'mips': |
- case 'simarm64': |
- case 'simdbc': |
- case 'simdbc64': |
+ case Architecture.simarm: |
+ case Architecture.arm: |
+ case Architecture.simarmv6: |
+ case Architecture.armv6: |
+ case Architecture.simarmv5te: |
+ case Architecture.armv5te: |
+ case Architecture.simmips: |
+ case Architecture.mips: |
+ case Architecture.simarm64: |
+ case Architecture.simdbc: |
+ case Architecture.simdbc64: |
multiplier *= 4; |
break; |
} |
- if (mode == 'debug') { |
+ |
+ if (mode.isDebug) { |
multiplier *= 2; |
if (isReload) { |
multiplier *= 2; |
@@ -207,14 +206,17 @@ class DartVmRuntimeConfiguration extends RuntimeConfiguration { |
/// Runtime configuration for Content Shell. We previously used a similar |
/// program named Dump Render Tree, hence the name. |
class DrtRuntimeConfiguration extends DartVmRuntimeConfiguration { |
- int computeTimeoutMultiplier( |
- {String mode, bool isChecked: false, bool isReload: false, String arch}) { |
+ int timeoutMultiplier( |
+ {Mode mode, |
+ bool isChecked: false, |
+ bool isReload: false, |
+ Architecture arch}) { |
return 4 // Allow additional time for browser testing to run. |
// TODO(ahe): We might need to distinguish between DRT for running |
// JavaScript and Dart code. I'm not convinced the inherited timeout |
// multiplier is relevant for JavaScript. |
* |
- super.computeTimeoutMultiplier( |
+ super.timeoutMultiplier( |
mode: mode, isChecked: isChecked, isReload: isReload); |
} |
} |
@@ -343,7 +345,7 @@ class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration { |
return selfCheckers |
.map((String tester) => commandBuilder.getVmBatchCommand( |
executable, tester, arguments, environmentOverrides, |
- checked: suite.configuration['checked'] as bool)) |
+ checked: suite.configuration.isChecked)) |
.toList(); |
} |