Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: pkg/analysis_server/test/mocks.dart

Issue 545323002: Add error condition INVALID_OVERLAY_CHANGE to analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/mocks.dart
diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
index 36eaa3a3c14e55fcadd4acc2fe7c9387b1b4d70e..e8f447c11712d2a7672abeb3bbe88b557c4a93eb 100644
--- a/pkg/analysis_server/test/mocks.dart
+++ b/pkg/analysis_server/test/mocks.dart
@@ -282,28 +282,40 @@ class _IsResponseSuccess extends Matcher {
/**
* A [Matcher] that check that the given [Response] has an expected identifier
- * and has an error.
+ * and has an error. The error code may optionally be checked.
*/
-Matcher isResponseFailure(String id) => new _IsResponseFailure(id);
+Matcher isResponseFailure(String id, [RequestErrorCode code]) =>
+ new _IsResponseFailure(id, code);
/**
* A [Matcher] that check that there are no `error` in a given [Response].
*/
class _IsResponseFailure extends Matcher {
final String _id;
+ final RequestErrorCode _code;
- _IsResponseFailure(this._id);
+ _IsResponseFailure(this._id, this._code);
@override
Description describe(Description description) {
- return description.addDescriptionOf(
+ description = description.add(
'response with identifier "$_id" and an error');
+ if (_code != null) {
+ description = description.add(' with code ${this._code.name}');
+ }
+ return description;
}
@override
bool matches(item, Map matchState) {
Response response = item;
- return response.id == _id && response.error != null;
+ if (response.id != _id || response.error == null) {
+ return false;
+ }
+ if (_code != null && response.error.code != _code) {
+ return false;
+ }
+ return true;
}
@override
@@ -315,6 +327,8 @@ class _IsResponseFailure extends Matcher {
mismatchDescription.add('has identifier "$id"');
if (error == null) {
mismatchDescription.add(' and has no error');
+ } else {
+ mismatchDescription.add(' and has error code ${response.error.code.name}');
}
return mismatchDescription;
}
« no previous file with comments | « pkg/analysis_server/test/integration/protocol_matchers.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698