Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

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

Issue 1379203002: Refactor groups to pipe them through to the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/backend/group.dart ('k') | lib/src/backend/metadata.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/invoker.dart
diff --git a/lib/src/backend/invoker.dart b/lib/src/backend/invoker.dart
index 0dc42c9fa9fd4fe37d960f4df299d02fa1a8fa5f..644e49c8c82b040f63b32031ec1e6bd19c53d3ab 100644
--- a/lib/src/backend/invoker.dart
+++ b/lib/src/backend/invoker.dart
@@ -14,13 +14,15 @@ import 'closed_exception.dart';
import 'live_test.dart';
import 'live_test_controller.dart';
import 'metadata.dart';
+import 'operating_system.dart';
import 'outstanding_callback_counter.dart';
import 'state.dart';
import 'suite.dart';
import 'test.dart';
+import 'test_platform.dart';
/// A test in this isolate.
-class LocalTest implements Test {
+class LocalTest extends Test {
final String name;
final Metadata metadata;
@@ -36,11 +38,9 @@ class LocalTest implements Test {
return invoker.liveTest;
}
- Test change({String name, Metadata metadata}) {
- if (name == name && metadata == this.metadata) return this;
- if (name == null) name = this.name;
- if (metadata == null) metadata = this.metadata;
- return new LocalTest(name, metadata, _body);
+ Test forPlatform(TestPlatform platform, {OperatingSystem os}) {
+ if (!metadata.testOn.evaluate(platform, os: os)) return null;
+ return new LocalTest(name, metadata.forPlatform(platform, os: os), _body);
}
}
@@ -83,9 +83,6 @@ class Invoker {
/// The test being run.
LocalTest get _test => liveTest.test as LocalTest;
- /// The test metadata merged with the suite metadata.
- final Metadata metadata;
-
/// The outstanding callback counter for the current zone.
OutstandingCallbackCounter get _outstandingCallbacks {
var counter = Zone.current[_counterKey];
@@ -120,8 +117,7 @@ class Invoker {
/// This will be `null` until the test starts running.
Timer _timeoutTimer;
- Invoker._(Suite suite, LocalTest test)
- : metadata = suite.metadata.merge(test.metadata) {
+ Invoker._(Suite suite, LocalTest test) {
_controller = new LiveTestController(
suite, test, _onRun, _onCloseCompleter.complete);
}
@@ -205,7 +201,8 @@ class Invoker {
if (liveTest.isComplete) return;
if (_timeoutTimer != null) _timeoutTimer.cancel();
- var timeout = metadata.timeout.apply(new Duration(seconds: 30));
+ var timeout = liveTest.test.metadata.timeout
+ .apply(new Duration(seconds: 30));
if (timeout == null) return;
_timeoutTimer = _invokerZone.createTimer(timeout,
Zone.current.bindCallback(() {
« no previous file with comments | « lib/src/backend/group.dart ('k') | lib/src/backend/metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698