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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 if (messageAsMap.containsKey('id')) { | 570 if (messageAsMap.containsKey('id')) { |
| 571 outOfTestExpect(messageAsMap['id'], isString); | 571 outOfTestExpect(messageAsMap['id'], isString); |
| 572 String id = message['id']; | 572 String id = message['id']; |
| 573 Completer completer = _pendingCommands[id]; | 573 Completer completer = _pendingCommands[id]; |
| 574 if (completer == null) { | 574 if (completer == null) { |
| 575 fail('Unexpected response from server: id=$id'); | 575 fail('Unexpected response from server: id=$id'); |
| 576 } else { | 576 } else { |
| 577 _pendingCommands.remove(id); | 577 _pendingCommands.remove(id); |
| 578 } | 578 } |
| 579 if (messageAsMap.containsKey('error')) { | 579 if (messageAsMap.containsKey('error')) { |
| 580 // TODO(paulberry): propagate the error info to the completer. | 580 completer.completeError(messageAsMap['error']); |
|
Paul Berry
2017/02/12 14:39:04
I'd recommend making a new class which represents
devoncarew
2017/02/12 17:52:34
Done.
| |
| 581 completer.completeError(new UnimplementedError( | |
| 582 'Server responded with an error: ${JSON.encode(message)}')); | |
| 583 } else { | 581 } else { |
| 584 completer.complete(messageAsMap['result']); | 582 completer.complete(messageAsMap['result']); |
| 585 } | 583 } |
| 586 // Check that the message is well-formed. We do this after calling | 584 // Check that the message is well-formed. We do this after calling |
| 587 // completer.complete() or completer.completeError() so that we don't | 585 // completer.complete() or completer.completeError() so that we don't |
| 588 // stall the test in the event of an error. | 586 // stall the test in the event of an error. |
| 589 outOfTestExpect(message, isResponse); | 587 outOfTestExpect(message, isResponse); |
| 590 } else { | 588 } else { |
| 591 // Message is a notification. It should have an event and possibly | 589 // Message is a notification. It should have an event and possibly |
| 592 // params. | 590 // params. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 void populateMismatches(item, List<MismatchDescriber> mismatches); | 966 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 969 | 967 |
| 970 /** | 968 /** |
| 971 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 969 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 972 */ | 970 */ |
| 973 MismatchDescriber simpleDescription(String description) => | 971 MismatchDescriber simpleDescription(String description) => |
| 974 (Description mismatchDescription) { | 972 (Description mismatchDescription) { |
| 975 mismatchDescription.add(description); | 973 mismatchDescription.add(description); |
| 976 }; | 974 }; |
| 977 } | 975 } |
| OLD | NEW |