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

Side by Side Diff: lib/src/runner/browser/suite.dart

Issue 1664433002: Support shelf 0.7.0. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 10 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/browser/static/host.dart ('k') | lib/src/util/multi_channel.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 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:async/async.dart'; 7 import 'package:async/async.dart';
8 import 'package:stream_channel/stream_channel.dart';
8 9
9 import '../../backend/group.dart'; 10 import '../../backend/group.dart';
10 import '../../backend/metadata.dart'; 11 import '../../backend/metadata.dart';
11 import '../../backend/test.dart'; 12 import '../../backend/test.dart';
12 import '../../backend/test_platform.dart'; 13 import '../../backend/test_platform.dart';
13 import '../../util/multi_channel.dart';
14 import '../../util/remote_exception.dart'; 14 import '../../util/remote_exception.dart';
15 import '../../util/stack_trace_mapper.dart'; 15 import '../../util/stack_trace_mapper.dart';
16 import '../../util/stream_channel.dart';
17 import '../../utils.dart'; 16 import '../../utils.dart';
18 import '../environment.dart'; 17 import '../environment.dart';
19 import '../load_exception.dart'; 18 import '../load_exception.dart';
20 import '../runner_suite.dart'; 19 import '../runner_suite.dart';
21 import 'iframe_test.dart'; 20 import 'iframe_test.dart';
22 21
23 /// Loads a [RunnerSuite] for a browser. 22 /// Loads a [RunnerSuite] for a browser.
24 /// 23 ///
25 /// [channel] should connect to the iframe containing the suite, which should 24 /// [channel] should connect to the iframe containing the suite, which should
26 /// eventually emit a message containing the suite's test information. 25 /// eventually emit a message containing the suite's test information.
(...skipping 17 matching lines...) Expand all
44 // 43 //
45 // Start this canceled because we don't want it to start ticking until we get 44 // Start this canceled because we don't want it to start ticking until we get
46 // some response from the iframe. 45 // some response from the iframe.
47 var timer = new RestartableTimer(new Duration(seconds: 3), () { 46 var timer = new RestartableTimer(new Duration(seconds: 3), () {
48 controller.setDebugging(true); 47 controller.setDebugging(true);
49 })..cancel(); 48 })..cancel();
50 49
51 // Even though [channel] is probably a [MultiChannel] already, create a 50 // Even though [channel] is probably a [MultiChannel] already, create a
52 // nested MultiChannel because the iframe will be using a channel wrapped 51 // nested MultiChannel because the iframe will be using a channel wrapped
53 // within the host's channel. 52 // within the host's channel.
54 var suiteChannel = new MultiChannel(channel.stream.map((message) { 53 var suiteChannel = new MultiChannel(channel.changeStream((stream) {
55 // Whenever we get a message, no matter which child channel it's for, we the 54 return stream.map((message) {
56 // browser is still running code which means the using isn't debugging. 55 // Whenever we get a message, no matter which child channel it's for, we t he
57 if (controller != null) { 56 // browser is still running code which means the using isn't debugging.
58 timer.reset(); 57 if (controller != null) {
59 controller.setDebugging(false); 58 timer.reset();
60 } 59 controller.setDebugging(false);
60 }
61 61
62 return message; 62 return message;
63 }), channel.sink); 63 });
64 }));
64 65
65 var response = await _getResponse(suiteChannel.stream) 66 var response = await _getResponse(suiteChannel.stream)
66 .timeout(new Duration(minutes: 1), onTimeout: () { 67 .timeout(new Duration(minutes: 1), onTimeout: () {
67 suiteChannel.sink.close(); 68 suiteChannel.sink.close();
68 throw new LoadException( 69 throw new LoadException(
69 path, 70 path,
70 "Timed out waiting for the test suite to connect."); 71 "Timed out waiting for the test suite to connect.");
71 }); 72 });
72 73
73 try { 74 try {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 /// Returns `null` if [test] is `null`. 157 /// Returns `null` if [test] is `null`.
157 Test _deserializeTest(MultiChannel suiteChannel, Map test, 158 Test _deserializeTest(MultiChannel suiteChannel, Map test,
158 [StackTraceMapper mapper]) { 159 [StackTraceMapper mapper]) {
159 if (test == null) return null; 160 if (test == null) return null;
160 161
161 var metadata = new Metadata.deserialize(test['metadata']); 162 var metadata = new Metadata.deserialize(test['metadata']);
162 var testChannel = suiteChannel.virtualChannel(test['channel']); 163 var testChannel = suiteChannel.virtualChannel(test['channel']);
163 return new IframeTest(test['name'], metadata, testChannel, 164 return new IframeTest(test['name'], metadata, testChannel,
164 mapper: mapper); 165 mapper: mapper);
165 } 166 }
OLDNEW
« no previous file with comments | « lib/src/runner/browser/static/host.dart ('k') | lib/src/util/multi_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698