| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.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 pub_tests; | 5 library pub_tests; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 Future<Map> _jsonRpcRequest(String method, [Map params]) { | 449 Future<Map> _jsonRpcRequest(String method, [Map params]) { |
| 450 var id = _rpcId++; | 450 var id = _rpcId++; |
| 451 var message = { | 451 var message = { |
| 452 "jsonrpc": "2.0", | 452 "jsonrpc": "2.0", |
| 453 "method": method, | 453 "method": method, |
| 454 "id": id | 454 "id": id |
| 455 }; | 455 }; |
| 456 if (params != null) message["params"] = params; | 456 if (params != null) message["params"] = params; |
| 457 _webSocket.add(JSON.encode(message)); | 457 _webSocket.add(JSON.encode(message)); |
| 458 | 458 |
| 459 return Chain.track(_webSocketBroadcastStream | 459 return _webSocketBroadcastStream |
| 460 .firstWhere((response) => response["id"] == id)).then((value) { | 460 .firstWhere((response) => response["id"] == id).then((value) { |
| 461 currentSchedule.addDebugInfo( | 461 currentSchedule.addDebugInfo( |
| 462 "Web Socket request $method with params $params\n" | 462 "Web Socket request $method with params $params\n" |
| 463 "Result: $value"); | 463 "Result: $value"); |
| 464 | 464 |
| 465 expect(value["id"], equals(id)); | 465 expect(value["id"], equals(id)); |
| 466 return value; | 466 return value; |
| 467 }); | 467 }); |
| 468 } | 468 } |
| 469 | 469 |
| 470 /// Returns a [Future] that completes to a URL string for the server serving | 470 /// Returns a [Future] that completes to a URL string for the server serving |
| (...skipping 19 matching lines...) Expand all Loading... |
| 490 /// included. Unlike [getServerUrl], this should only be called after the ports | 490 /// included. Unlike [getServerUrl], this should only be called after the ports |
| 491 /// are known. | 491 /// are known. |
| 492 String _getServerUrlSync([String root, String path]) { | 492 String _getServerUrlSync([String root, String path]) { |
| 493 if (root == null) root = 'web'; | 493 if (root == null) root = 'web'; |
| 494 expect(_ports, contains(root)); | 494 expect(_ports, contains(root)); |
| 495 var url = "http://localhost:${_ports[root]}"; | 495 var url = "http://localhost:${_ports[root]}"; |
| 496 if (path != null) url = "$url/$path"; | 496 if (path != null) url = "$url/$path"; |
| 497 return url; | 497 return url; |
| 498 } | 498 } |
| 499 | 499 |
| OLD | NEW |