Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.integration.analysis; | 5 library test.integration.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 * True if we are currently printing out messages exchanged with the server. | 510 * True if we are currently printing out messages exchanged with the server. |
| 511 */ | 511 */ |
| 512 bool _debuggingStdio = false; | 512 bool _debuggingStdio = false; |
| 513 | 513 |
| 514 /** | 514 /** |
| 515 * True if we've received bad data from the server, and we are aborting the | 515 * True if we've received bad data from the server, and we are aborting the |
| 516 * test. | 516 * test. |
| 517 */ | 517 */ |
| 518 bool _receivedBadDataFromServer = false; | 518 bool _receivedBadDataFromServer = false; |
| 519 | 519 |
| 520 Server._(this._process); | 520 /** |
| 521 * Stopwatch that we use to generate timing information for debug output. | |
| 522 */ | |
| 523 Stopwatch _time = new Stopwatch(); | |
| 524 | |
| 525 Server._(this._process) { | |
| 526 _time.start(); | |
| 527 } | |
| 521 | 528 |
| 522 /** | 529 /** |
| 523 * Get a stream which will receive notifications of the given event type. | 530 * Get a stream which will receive notifications of the given event type. |
| 524 * The values delivered to the stream will be the contents of the 'params' | 531 * The values delivered to the stream will be the contents of the 'params' |
| 525 * field of the notification message. | 532 * field of the notification message. |
| 526 */ | 533 */ |
| 527 Stream onNotification(String event) { | 534 Stream onNotification(String event) { |
| 528 Stream notificationStream = _notificationStreams[event]; | 535 Stream notificationStream = _notificationStreams[event]; |
| 529 if (notificationStream == null) { | 536 if (notificationStream == null) { |
| 530 StreamController notificationController = new StreamController(); | 537 StreamController notificationController = new StreamController(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 new Future.delayed(new Duration(seconds: 1), expectAsync(() { | 702 new Future.delayed(new Duration(seconds: 1), expectAsync(() { |
| 696 fail('Bad data received from server'); | 703 fail('Bad data received from server'); |
| 697 })); | 704 })); |
| 698 } | 705 } |
| 699 | 706 |
| 700 /** | 707 /** |
| 701 * Record a message that was exchanged with the server, and print it out if | 708 * Record a message that was exchanged with the server, and print it out if |
| 702 * [debugStdio] has been called. | 709 * [debugStdio] has been called. |
| 703 */ | 710 */ |
| 704 void _recordStdio(String line) { | 711 void _recordStdio(String line) { |
| 712 double elapsedTime = _time.elapsedTicks.toDouble() / | |
| 713 _time.frequency.toDouble(); | |
|
scheglov
2014/07/30 18:46:15
Do you need toDouble() here?
3 / 2 already gives 1
| |
| 714 line = "$elapsedTime: $line"; | |
| 705 if (_debuggingStdio) { | 715 if (_debuggingStdio) { |
| 706 print(line); | 716 print(line); |
| 707 } | 717 } |
| 708 _recordedStdio.add(line); | 718 _recordedStdio.add(line); |
| 709 } | 719 } |
| 710 } | 720 } |
| OLD | NEW |