Chromium Code Reviews

Unified Diff: lib/src/backend/test_platform.dart

Issue 1004013002: Add support for evaluating platform selectors. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: lib/src/backend/test_platform.dart
diff --git a/lib/src/runner/test_platform.dart b/lib/src/backend/test_platform.dart
similarity index 51%
rename from lib/src/runner/test_platform.dart
rename to lib/src/backend/test_platform.dart
index 406dad0cefc4ebef5222cde9bb661282007de23d..b2eaa1ee1c5a69bc2d02f64b56b467112aba8710 100644
--- a/lib/src/runner/test_platform.dart
+++ b/lib/src/backend/test_platform.dart
@@ -2,14 +2,20 @@
// 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 unittest.backend.test_platform;
+
// TODO(nweiz): support pluggable platforms.
/// An enum of all platforms on which tests can run.
class TestPlatform {
+ // When adding new platforms, be sure to update the baseline and derived
+ // variable tests in test/backend/platform_selector/evaluate_test.
+
/// The command-line Dart VM.
- static const vm = const TestPlatform._("VM", "vm");
+ static const vm = const TestPlatform._("VM", "vm", isDartVm: true);
/// Google Chrome.
- static const chrome = const TestPlatform._("Chrome", "chrome");
+ static const chrome = const TestPlatform._("Chrome", "chrome",
+ isBrowser: true, isDart2js: true, isBlink: true);
Bob Nystrom 2015/03/16 16:54:26 Firefox, Safari, IE, et. al.?
nweiz 2015/03/24 01:03:28 This enum is also used for telling other APIs whic
/// A list of all instances of [TestPlatform].
static const all = const [vm, chrome];
@@ -27,7 +33,20 @@ class TestPlatform {
/// The identifier used to look up the platform.
final String identifier;
- const TestPlatform._(this.name, this.identifier);
+ /// Whether this platform runs the Dart VM in any capacity.
+ final bool isDartVm;
+
+ /// Whether this platform is a browser.
+ final bool isBrowser;
+
+ /// Whether this platform runs Dart compiled with dart2js.
+ final bool isDart2js;
Bob Nystrom 2015/03/16 16:54:26 What about DDC? Should this name be more generic?
nweiz 2015/03/24 01:03:28 Changed to "js".
+
+ /// Whether this platform uses the Blink rendering engine.
+ final bool isBlink;
+
+ const TestPlatform._(this.name, this.identifier, {this.isDartVm: false,
+ this.isBrowser: false, this.isDart2js: false, this.isBlink: false});
String toString() => name;
}

Powered by Google App Engine