| OLD | NEW | 
|---|
| 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/group.dart'; | 
| 15 import '../../backend/metadata.dart'; | 15 import '../../backend/metadata.dart'; | 
|  | 16 import '../../backend/test.dart'; | 
| 16 import '../../backend/test_platform.dart'; | 17 import '../../backend/test_platform.dart'; | 
| 17 import '../../util/cancelable_future.dart'; | 18 import '../../util/cancelable_future.dart'; | 
| 18 import '../../util/multi_channel.dart'; | 19 import '../../util/multi_channel.dart'; | 
| 19 import '../../util/remote_exception.dart'; | 20 import '../../util/remote_exception.dart'; | 
| 20 import '../../util/stack_trace_mapper.dart'; | 21 import '../../util/stack_trace_mapper.dart'; | 
| 21 import '../../utils.dart'; | 22 import '../../utils.dart'; | 
| 22 import '../application_exception.dart'; | 23 import '../application_exception.dart'; | 
| 23 import '../environment.dart'; | 24 import '../environment.dart'; | 
| 24 import '../load_exception.dart'; | 25 import '../load_exception.dart'; | 
| 25 import '../runner_suite.dart'; | 26 import '../runner_suite.dart'; | 
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 252 | 253 | 
| 253   /// Deserializes [group] into a concrete [Group] class. | 254   /// Deserializes [group] into a concrete [Group] class. | 
| 254   Group _deserializeGroup(MultiChannel suiteChannel, | 255   Group _deserializeGroup(MultiChannel suiteChannel, | 
| 255       StackTraceMapper mapper, Map group) { | 256       StackTraceMapper mapper, Map group) { | 
| 256     var metadata = new Metadata.deserialize(group['metadata']); | 257     var metadata = new Metadata.deserialize(group['metadata']); | 
| 257     return new Group(group['name'], group['entries'].map((entry) { | 258     return new Group(group['name'], group['entries'].map((entry) { | 
| 258       if (entry['type'] == 'group') { | 259       if (entry['type'] == 'group') { | 
| 259         return _deserializeGroup(suiteChannel, mapper, entry); | 260         return _deserializeGroup(suiteChannel, mapper, entry); | 
| 260       } | 261       } | 
| 261 | 262 | 
| 262       var testMetadata = new Metadata.deserialize(entry['metadata']); | 263       return _deserializeTest(suiteChannel, mapper, entry); | 
| 263       var testChannel = suiteChannel.virtualChannel(entry['channel']); | 264     }), | 
| 264       return new IframeTest(entry['name'], testMetadata, testChannel, | 265         metadata: metadata, | 
| 265           mapper: mapper); | 266         setUpAll: _deserializeTest(suiteChannel, mapper, group['setUpAll']), | 
| 266     }), metadata: metadata); | 267         tearDownAll: | 
|  | 268             _deserializeTest(suiteChannel, mapper, group['tearDownAll'])); | 
|  | 269   } | 
|  | 270 | 
|  | 271   /// Deserializes [test] into a concrete [Test] class. | 
|  | 272   /// | 
|  | 273   /// Returns `null` if [test] is `null`. | 
|  | 274   Test _deserializeTest(MultiChannel suiteChannel, StackTraceMapper mapper, | 
|  | 275       Map test) { | 
|  | 276     if (test == null) return null; | 
|  | 277 | 
|  | 278     var metadata = new Metadata.deserialize(test['metadata']); | 
|  | 279     var testChannel = suiteChannel.virtualChannel(test['channel']); | 
|  | 280     return new IframeTest(test['name'], metadata, testChannel, | 
|  | 281         mapper: mapper); | 
| 267   } | 282   } | 
| 268 | 283 | 
| 269   /// An implementation of [Environment.displayPause]. | 284   /// An implementation of [Environment.displayPause]. | 
| 270   CancelableFuture _displayPause() { | 285   CancelableFuture _displayPause() { | 
| 271     if (_pauseCompleter != null) return _pauseCompleter.future; | 286     if (_pauseCompleter != null) return _pauseCompleter.future; | 
| 272 | 287 | 
| 273     _pauseCompleter = new CancelableCompleter(() { | 288     _pauseCompleter = new CancelableCompleter(() { | 
| 274       _channel.sink.add({"command": "resume"}); | 289       _channel.sink.add({"command": "resume"}); | 
| 275       _pauseCompleter = null; | 290       _pauseCompleter = null; | 
| 276     }); | 291     }); | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 307 | 322 | 
| 308   final Uri observatoryUrl; | 323   final Uri observatoryUrl; | 
| 309 | 324 | 
| 310   final Uri remoteDebuggerUrl; | 325   final Uri remoteDebuggerUrl; | 
| 311 | 326 | 
| 312   _BrowserEnvironment(this._manager, this.observatoryUrl, | 327   _BrowserEnvironment(this._manager, this.observatoryUrl, | 
| 313       this.remoteDebuggerUrl); | 328       this.remoteDebuggerUrl); | 
| 314 | 329 | 
| 315   CancelableFuture displayPause() => _manager._displayPause(); | 330   CancelableFuture displayPause() => _manager._displayPause(); | 
| 316 } | 331 } | 
| OLD | NEW | 
|---|