| Index: dart/tools/testing/dart/runtime_configuration.dart
|
| diff --git a/dart/tools/testing/dart/runtime_configuration.dart b/dart/tools/testing/dart/runtime_configuration.dart
|
| index 383ad3f8786c335f7d3d95190e5a7851849b8145..fd30dd9931b165908781672498d332ab5ec5a407 100644
|
| --- a/dart/tools/testing/dart/runtime_configuration.dart
|
| +++ b/dart/tools/testing/dart/runtime_configuration.dart
|
| @@ -2,7 +2,19 @@
|
| // 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 compiler_configuration;
|
| +library runtime_configuration;
|
| +
|
| +import 'compiler_configuration.dart' show
|
| + CommandArtifact;
|
| +
|
| +// 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;
|
| +
|
| +import 'test_runner.dart' show
|
| + Command,
|
| + CommandBuilder;
|
|
|
| // TODO(ahe): I expect this class will become abstract very soon.
|
| class RuntimeConfiguration {
|
| @@ -16,20 +28,31 @@ class RuntimeConfiguration {
|
| case 'DartiumOnAndroid':
|
| case 'chrome':
|
| case 'chromeOnAndroid':
|
| - case 'd8':
|
| case 'dartium':
|
| case 'ff':
|
| case 'firefox':
|
| case 'ie10':
|
| case 'ie9':
|
| - case 'jsshell':
|
| - case 'none':
|
| case 'opera':
|
| case 'safari':
|
| + // TODO(ahe): Replace this with one or more browser runtimes.
|
| + return new DummyRuntimeConfiguration();
|
| +
|
| + case 'jsshell':
|
| + return new JsshellRuntimeConfiguration();
|
| +
|
| + case 'd8':
|
| + return new D8RuntimeConfiguration();
|
| +
|
| + case 'none':
|
| + return new NoneRuntimeConfiguration();
|
| +
|
| case 'vm':
|
| - return new RuntimeConfiguration._subclass();
|
| + return new StandaloneDartRuntimeConfiguration();
|
| +
|
| case 'drt':
|
| return new DrtRuntimeConfiguration();
|
| +
|
| default:
|
| throw "Unknown runtime '$runtime'";
|
| }
|
| @@ -41,6 +64,95 @@ class RuntimeConfiguration {
|
| bool isDebug: false,
|
| bool isChecked: false,
|
| String arch}) {
|
| + return 1;
|
| + }
|
| +
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + // TODO(ahe): Make this method abstract.
|
| + throw "Unimplemented runtime '$runtimeType'";
|
| + }
|
| +}
|
| +
|
| +/// The 'none' runtime configuration.
|
| +class NoneRuntimeConfiguration extends RuntimeConfiguration {
|
| + NoneRuntimeConfiguration()
|
| + : super._subclass();
|
| +
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + return <Command>[];
|
| + }
|
| +}
|
| +
|
| +class CommandLineJavaScriptRuntime extends RuntimeConfiguration {
|
| + final String moniker;
|
| +
|
| + CommandLineJavaScriptRuntime(this.moniker)
|
| + : super._subclass();
|
| +
|
| + void checkArtifact(CommandArtifact artifact) {
|
| + String type = artifact.mimeType;
|
| + if (type != 'application/javascript') {
|
| + throw "Runtime '$moniker' cannot run files of type '$type'.";
|
| + }
|
| + }
|
| +}
|
| +
|
| +/// Chrome/V8-based development shell (d8).
|
| +class D8RuntimeConfiguration extends CommandLineJavaScriptRuntime {
|
| + D8RuntimeConfiguration()
|
| + : super('d8');
|
| +
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + // TODO(ahe): Avoid duplication of this method between d8 and jsshell.
|
| + checkArtifact(artifact);
|
| + return <Command>[
|
| + commandBuilder.getJSCommandlineCommand(
|
| + moniker, suite.d8FileName, arguments, environmentOverrides)];
|
| + }
|
| +}
|
| +
|
| +/// Firefox/SpiderMonkey-based development shell (jsshell).
|
| +class JsshellRuntimeConfiguration extends CommandLineJavaScriptRuntime {
|
| + JsshellRuntimeConfiguration()
|
| + : super('jsshell');
|
| +
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + checkArtifact(artifact);
|
| + return <Command>[
|
| + commandBuilder.getJSCommandlineCommand(
|
| + moniker, suite.jsShellFileName, arguments, environmentOverrides)];
|
| + }
|
| +}
|
| +
|
| +/// Common runtime configuration for runtimes based on the Dart VM.
|
| +class DartVmRuntimeConfiguration extends RuntimeConfiguration {
|
| + DartVmRuntimeConfiguration()
|
| + : super._subclass();
|
| +
|
| + int computeTimeoutMultiplier({
|
| + bool isDebug: false,
|
| + bool isChecked: false,
|
| + String arch}) {
|
| int multiplier = 1;
|
| switch (arch) {
|
| case 'simarm':
|
| @@ -57,16 +169,50 @@ class RuntimeConfiguration {
|
| }
|
| }
|
|
|
| -class DrtRuntimeConfiguration extends RuntimeConfiguration {
|
| - DrtRuntimeConfiguration()
|
| - : super._subclass();
|
| -
|
| +/// Runtime configuration for Content Shell. We previously used a similar
|
| +/// program named Dump Render Tree, hence the name.
|
| +class DrtRuntimeConfiguration extends DartVmRuntimeConfiguration {
|
| int computeTimeoutMultiplier({
|
| bool isDebug: false,
|
| bool isChecked: false,
|
| String arch}) {
|
| return 4 // Allow additional time for browser testing to run.
|
| + // TODO(ahe): We might need to distinquish between DRT for running
|
| + // JavaScript and Dart code. I'm not convinced the inherited timeout
|
| + // multiplier is relevant for JavaScript.
|
| * super.computeTimeoutMultiplier(
|
| isDebug: isDebug, isChecked: isChecked);
|
| }
|
| }
|
| +
|
| +/// The standalone Dart VM binary, "dart" or "dart.exe".
|
| +class StandaloneDartRuntimeConfiguration extends DartVmRuntimeConfiguration {
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + String script = artifact.filename;
|
| + String type = artifact.mimeType;
|
| + if (script != null && type != 'application/dart') {
|
| + throw "Dart VM cannot run files of type '$type'.";
|
| + }
|
| + return <Command>[commandBuilder.getVmCommand(
|
| + suite.dartVmBinaryFileName, arguments, environmentOverrides)];
|
| + }
|
| +}
|
| +
|
| +/// Temporary runtime configuration for browser runtimes that haven't been
|
| +/// migrated yet.
|
| +// TODO(ahe): Remove this class.
|
| +class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration {
|
| + List<Command> computeRuntimeCommands(
|
| + TestSuite suite,
|
| + CommandBuilder commandBuilder,
|
| + CommandArtifact artifact,
|
| + List<String> arguments,
|
| + Map<String, String> environmentOverrides) {
|
| + throw "Unimplemented runtime '$runtimeType'";
|
| + }
|
| +}
|
|
|