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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..383ad3f8786c335f7d3d95190e5a7851849b8145 |
--- /dev/null |
+++ b/dart/tools/testing/dart/runtime_configuration.dart |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// 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; |
+ |
+// 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 configuration) { |
+ String runtime = configuration['runtime']; |
+ switch (runtime) { |
+ case 'ContentShellOnAndroid': |
+ 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': |
+ case 'vm': |
+ return new RuntimeConfiguration._subclass(); |
+ case 'drt': |
+ return new DrtRuntimeConfiguration(); |
+ default: |
+ throw "Unknown runtime '$runtime'"; |
+ } |
+ } |
+ |
+ RuntimeConfiguration._subclass(); |
+ |
+ int computeTimeoutMultiplier({ |
+ bool isDebug: false, |
+ bool isChecked: false, |
+ String arch}) { |
+ int multiplier = 1; |
+ switch (arch) { |
+ case 'simarm': |
+ case 'arm': |
+ case 'simmips': |
+ case 'mips': |
+ multiplier *= 4; |
+ break; |
+ } |
+ if (isDebug) { |
+ multiplier *= 2; |
+ } |
+ return multiplier; |
+ } |
+} |
+ |
+class DrtRuntimeConfiguration extends RuntimeConfiguration { |
+ DrtRuntimeConfiguration() |
+ : super._subclass(); |
+ |
+ int computeTimeoutMultiplier({ |
+ bool isDebug: false, |
+ bool isChecked: false, |
+ String arch}) { |
+ return 4 // Allow additional time for browser testing to run. |
+ * super.computeTimeoutMultiplier( |
+ isDebug: isDebug, isChecked: isChecked); |
+ } |
+} |