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

Side by Side Diff: lib/src/runner/browser/browser_manager.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 unified diff | Download patch
« no previous file with comments | « lib/src/runner.dart ('k') | lib/src/runner/browser/iframe_listener.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 library test.runner.browser.browser_manager; 5 library test.runner.browser.browser_manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:async/async.dart'; 10 import 'package:async/async.dart';
11 import 'package:http_parser/http_parser.dart'; 11 import 'package:http_parser/http_parser.dart';
12 import 'package:pool/pool.dart'; 12 import 'package:pool/pool.dart';
13 13
14 import '../../backend/group.dart';
14 import '../../backend/metadata.dart'; 15 import '../../backend/metadata.dart';
16 import '../../backend/suite_entry.dart';
15 import '../../backend/test_platform.dart'; 17 import '../../backend/test_platform.dart';
16 import '../../util/cancelable_future.dart'; 18 import '../../util/cancelable_future.dart';
17 import '../../util/multi_channel.dart'; 19 import '../../util/multi_channel.dart';
18 import '../../util/remote_exception.dart'; 20 import '../../util/remote_exception.dart';
19 import '../../util/stack_trace_mapper.dart'; 21 import '../../util/stack_trace_mapper.dart';
20 import '../../utils.dart'; 22 import '../../utils.dart';
21 import '../application_exception.dart'; 23 import '../application_exception.dart';
22 import '../environment.dart'; 24 import '../environment.dart';
23 import '../load_exception.dart'; 25 import '../load_exception.dart';
24 import '../runner_suite.dart'; 26 import '../runner_suite.dart';
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 236 }
235 237
236 if (response["type"] == "error") { 238 if (response["type"] == "error") {
237 closeIframe(); 239 closeIframe();
238 var asyncError = RemoteException.deserialize(response["error"]); 240 var asyncError = RemoteException.deserialize(response["error"]);
239 await new Future.error( 241 await new Future.error(
240 new LoadException(path, asyncError.error), 242 new LoadException(path, asyncError.error),
241 asyncError.stackTrace); 243 asyncError.stackTrace);
242 } 244 }
243 245
244 return new RunnerSuite(await _environment, response["tests"].map((test) { 246 return new RunnerSuite(
245 var testMetadata = new Metadata.deserialize(test['metadata']); 247 await _environment,
246 var testChannel = suiteChannel.virtualChannel(test['channel']); 248 _deserializeEntries(suiteChannel, mapper, response["entries"]),
247 return new IframeTest(test['name'], testMetadata, testChannel, 249 platform: _platform,
248 mapper: mapper); 250 metadata: metadata,
249 }), platform: _platform, metadata: metadata, path: path, 251 path: path,
250 onClose: () => closeIframe()); 252 onClose: () => closeIframe());
251 } 253 }
252 254
255 /// Deserializes [entries] into concrete [SuiteEntry] subclasses.
256 Iterable<SuiteEntry> _deserializeEntries(MultiChannel suiteChannel,
257 Mapper mapper, List<Map> entries) {
258 return entries.map((entry) {
259 var metadata = new Metadata.deserialize(entry['metadata']);
260 if (entry['type'] == 'group') {
261 return new Group(
262 entry['name'],
263 metadata,
264 _deserializeEntries(suiteChannel, mapper, entry['entries']));
265 } else {
266 var testChannel = suiteChannel.virtualChannel(entry['channel']);
267 return new IframeTest(entry['name'], metadata, testChannel,
268 mapper: mapper);
269 }
270 });
271 }
272
253 /// An implementation of [Environment.displayPause]. 273 /// An implementation of [Environment.displayPause].
254 CancelableFuture _displayPause() { 274 CancelableFuture _displayPause() {
255 if (_pauseCompleter != null) return _pauseCompleter.future; 275 if (_pauseCompleter != null) return _pauseCompleter.future;
256 276
257 _pauseCompleter = new CancelableCompleter(() { 277 _pauseCompleter = new CancelableCompleter(() {
258 _channel.sink.add({"command": "resume"}); 278 _channel.sink.add({"command": "resume"});
259 _pauseCompleter = null; 279 _pauseCompleter = null;
260 }); 280 });
261 281
262 _channel.sink.add({"command": "displayPause"}); 282 _channel.sink.add({"command": "displayPause"});
(...skipping 28 matching lines...) Expand all
291 311
292 final Uri observatoryUrl; 312 final Uri observatoryUrl;
293 313
294 final Uri remoteDebuggerUrl; 314 final Uri remoteDebuggerUrl;
295 315
296 _BrowserEnvironment(this._manager, this.observatoryUrl, 316 _BrowserEnvironment(this._manager, this.observatoryUrl,
297 this.remoteDebuggerUrl); 317 this.remoteDebuggerUrl);
298 318
299 CancelableFuture displayPause() => _manager._displayPause(); 319 CancelableFuture displayPause() => _manager._displayPause();
300 } 320 }
OLDNEW
« no previous file with comments | « lib/src/runner.dart ('k') | lib/src/runner/browser/iframe_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698