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

Unified Diff: lib/src/runner/load_suite.dart

Issue 1490973003: Clean up the warning for unknown tags. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years 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/runner.dart ('k') | test/runner/tag_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/load_suite.dart
diff --git a/lib/src/runner/load_suite.dart b/lib/src/runner/load_suite.dart
index a83177746f0ddd81202ef33bd62b0a1d644e6c34..cb84a0b5121ee73be5211249f04013de2bc69c7d 100644
--- a/lib/src/runner/load_suite.dart
+++ b/lib/src/runner/load_suite.dart
@@ -39,7 +39,13 @@ class LoadSuite extends RunnerSuite {
///
/// This will return `null` if the suite is unavailable for some reason (for
/// example if an error occurred while loading it).
- final Future<RunnerSuite> suite;
+ Future<RunnerSuite> get suite async => (await _suiteAndZone)?.first;
+
+ /// A future that completes to a pair of [suite] and the load test's [Zone].
+ ///
+ /// This will return `null` if the suite is unavailable for some reason (for
+ /// example if an error occurred while loading it).
+ final Future<Pair<RunnerSuite, Zone>> _suiteAndZone;
/// Returns the test that loads the suite.
///
@@ -71,7 +77,7 @@ class LoadSuite extends RunnerSuite {
return;
}
- completer.complete(suite);
+ completer.complete(new Pair(suite, Zone.current));
invoker.removeOutstandingCallback();
} catch (error, stackTrace) {
registerException(error, stackTrace);
@@ -107,7 +113,8 @@ class LoadSuite extends RunnerSuite {
platform: suite.platform);
}
- LoadSuite._(String name, void body(), this.suite, {TestPlatform platform})
+ LoadSuite._(String name, void body(), this._suiteAndZone,
+ {TestPlatform platform})
: super(const VMEnvironment(), new Group.root([
new LocalTest(name,
new Metadata(timeout: new Timeout(new Duration(minutes: 5))),
@@ -115,17 +122,21 @@ class LoadSuite extends RunnerSuite {
]), platform: platform);
/// A constructor used by [changeSuite].
- LoadSuite._changeSuite(LoadSuite old, Future<RunnerSuite> this.suite)
+ LoadSuite._changeSuite(LoadSuite old, this._suiteAndZone)
: super(const VMEnvironment(), old.group, platform: old.platform);
/// Creates a new [LoadSuite] that's identical to this one, but that
/// transforms [suite] once it's loaded.
///
- /// If [suite] completes to `null`, [change] won't be run.
+ /// If [suite] completes to `null`, [change] won't be run. [change] is run
+ /// within the load test's zone, so any errors or prints it emits will be
+ /// associated with that test.
LoadSuite changeSuite(RunnerSuite change(RunnerSuite suite)) {
- return new LoadSuite._changeSuite(this, suite.then((loadedSuite) {
- if (loadedSuite == null) return null;
- return change(loadedSuite);
+ return new LoadSuite._changeSuite(this, _suiteAndZone.then((pair) {
+ if (pair == null) return null;
+
+ var zone = pair.last;
+ return new Pair(zone.runUnaryGuarded(change, pair.first), zone);
}));
}
« no previous file with comments | « lib/src/runner.dart ('k') | test/runner/tag_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698