| 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:http_parser/http_parser.dart'; | 10 import 'package:http_parser/http_parser.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 /// at once. | 42 /// at once. |
| 43 final _pool = new Pool(8); | 43 final _pool = new Pool(8); |
| 44 | 44 |
| 45 /// The ID of the next suite to be loaded. | 45 /// The ID of the next suite to be loaded. |
| 46 /// | 46 /// |
| 47 /// This is used to ensure that the suites can be referred to consistently | 47 /// This is used to ensure that the suites can be referred to consistently |
| 48 /// across the client and server. | 48 /// across the client and server. |
| 49 int _suiteId = 0; | 49 int _suiteId = 0; |
| 50 | 50 |
| 51 /// Whether the channel to the browser has closed. | 51 /// Whether the channel to the browser has closed. |
| 52 bool _closed; | 52 bool _closed = false; |
| 53 | 53 |
| 54 /// Creates a new BrowserManager that communicates with [browser] over | 54 /// Creates a new BrowserManager that communicates with [browser] over |
| 55 /// [webSocket]. | 55 /// [webSocket]. |
| 56 BrowserManager(this.browser, CompatibleWebSocket webSocket) | 56 BrowserManager(this.browser, CompatibleWebSocket webSocket) |
| 57 : _channel = new MultiChannel( | 57 : _channel = new MultiChannel( |
| 58 webSocket.map(JSON.decode), | 58 webSocket.map(JSON.decode), |
| 59 mapSink(webSocket, JSON.encode)) { | 59 mapSink(webSocket, JSON.encode)) { |
| 60 _channel.stream.listen(null, onDone: () => _closed = true); | 60 _channel.stream.listen(null, onDone: () => _closed = true); |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 return new Suite(response["tests"].map((test) { | 143 return new Suite(response["tests"].map((test) { |
| 144 var testMetadata = new Metadata.deserialize(test['metadata']); | 144 var testMetadata = new Metadata.deserialize(test['metadata']); |
| 145 var testChannel = suiteChannel.virtualChannel(test['channel']); | 145 var testChannel = suiteChannel.virtualChannel(test['channel']); |
| 146 return new IframeTest(test['name'], testMetadata, testChannel, | 146 return new IframeTest(test['name'], testMetadata, testChannel, |
| 147 mapper: mapper); | 147 mapper: mapper); |
| 148 }), platform: browser, metadata: metadata, path: path, | 148 }), platform: browser, metadata: metadata, path: path, |
| 149 onClose: () => closeIframe()); | 149 onClose: () => closeIframe()); |
| 150 } | 150 } |
| 151 } | 151 } |
| OLD | NEW |