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

Side by Side Diff: lib/src/runner/runner_test.dart

Issue 2066113002: Add location information to the JSON reporter. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: cr Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « lib/src/runner/reporter/json.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:stack_trace/stack_trace.dart';
5 import 'package:stream_channel/stream_channel.dart'; 6 import 'package:stream_channel/stream_channel.dart';
6 7
7 import '../backend/group.dart'; 8 import '../backend/group.dart';
8 import '../backend/live_test.dart'; 9 import '../backend/live_test.dart';
9 import '../backend/live_test_controller.dart'; 10 import '../backend/live_test_controller.dart';
10 import '../backend/metadata.dart'; 11 import '../backend/metadata.dart';
11 import '../backend/operating_system.dart'; 12 import '../backend/operating_system.dart';
12 import '../backend/state.dart'; 13 import '../backend/state.dart';
13 import '../backend/suite.dart'; 14 import '../backend/suite.dart';
14 import '../backend/test.dart'; 15 import '../backend/test.dart';
15 import '../backend/test_platform.dart'; 16 import '../backend/test_platform.dart';
16 import '../util/remote_exception.dart'; 17 import '../util/remote_exception.dart';
17 import '../utils.dart'; 18 import '../utils.dart';
18 19
19 typedef StackTrace _MapTrace(StackTrace trace); 20 typedef StackTrace _MapTrace(StackTrace trace);
20 21
21 /// A test running remotely, controlled by a stream channel. 22 /// A test running remotely, controlled by a stream channel.
22 class RunnerTest extends Test { 23 class RunnerTest extends Test {
23 final String name; 24 final String name;
24 final Metadata metadata; 25 final Metadata metadata;
26 final Trace trace;
25 27
26 /// The channel used to communicate with the test's [IframeListener]. 28 /// The channel used to communicate with the test's [IframeListener].
27 final MultiChannel _channel; 29 final MultiChannel _channel;
28 30
29 /// The function used to reformat errors' stack traces. 31 /// The function used to reformat errors' stack traces.
30 final _MapTrace _mapTrace; 32 final _MapTrace _mapTrace;
31 33
32 RunnerTest(this.name, this.metadata, this._channel, this._mapTrace); 34 RunnerTest(this.name, this.metadata, Trace trace, this._channel,
35 _MapTrace mapTrace)
36 : trace = trace == null ? null : new Trace.from(mapTrace(trace)),
37 _mapTrace = mapTrace;
38
39 RunnerTest._(this.name, this.metadata, this.trace, this._channel,
40 this._mapTrace);
33 41
34 LiveTest load(Suite suite, {Iterable<Group> groups}) { 42 LiveTest load(Suite suite, {Iterable<Group> groups}) {
35 var controller; 43 var controller;
36 var testChannel; 44 var testChannel;
37 controller = new LiveTestController(suite, this, () { 45 controller = new LiveTestController(suite, this, () {
38 controller.setState(const State(Status.running, Result.success)); 46 controller.setState(const State(Status.running, Result.success));
39 47
40 testChannel = _channel.virtualChannel(); 48 testChannel = _channel.virtualChannel();
41 _channel.sink.add({ 49 _channel.sink.add({
42 'command': 'run', 50 'command': 'run',
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 testChannel.sink.add({'command': 'close'}); 88 testChannel.sink.add({'command': 'close'});
81 await controller.completer.future; 89 await controller.completer.future;
82 testChannel.sink.close(); 90 testChannel.sink.close();
83 }); 91 });
84 }, groups: groups); 92 }, groups: groups);
85 return controller.liveTest; 93 return controller.liveTest;
86 } 94 }
87 95
88 Test forPlatform(TestPlatform platform, {OperatingSystem os}) { 96 Test forPlatform(TestPlatform platform, {OperatingSystem os}) {
89 if (!metadata.testOn.evaluate(platform, os: os)) return null; 97 if (!metadata.testOn.evaluate(platform, os: os)) return null;
90 return new RunnerTest( 98 return new RunnerTest._(
91 name, metadata.forPlatform(platform, os: os), _channel, _mapTrace); 99 name,
100 metadata.forPlatform(platform, os: os),
101 trace,
102 _channel,
103 _mapTrace);
92 } 104 }
93 } 105 }
OLDNEW
« no previous file with comments | « lib/src/runner/reporter/json.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698