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

Side by Side Diff: pkg/analysis_server/test/mocks.dart

Issue 297203003: Use only block Dartdoc comments in analysis_server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/declarative_tests.dart ('k') | pkg/analysis_server/test/test_all.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 mocks; 5 library mocks;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 @MirrorsUsed(targets: 'mocks', override: '*') 10 @MirrorsUsed(targets: 'mocks', override: '*')
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 { Function onError, void onDone(), bool cancelOnError}) => 83 { Function onError, void onDone(), bool cancelOnError}) =>
84 stream.listen(onData, onError: onError, onDone: onDone, 84 stream.listen(onData, onError: onError, onDone: onDone,
85 cancelOnError: cancelOnError); 85 cancelOnError: cancelOnError);
86 86
87 Stream<T> where(bool test(T)) => stream.where(test); 87 Stream<T> where(bool test(T)) => stream.where(test);
88 88
89 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 89 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
90 } 90 }
91 91
92 class NoResponseException implements Exception { 92 class NoResponseException implements Exception {
93 /// The request that was not responded to. 93 /**
94 * The request that was not responded to.
95 */
94 final Request request; 96 final Request request;
95 97
96 NoResponseException(this.request); 98 NoResponseException(this.request);
97 99
98 String toString() { 100 String toString() {
99 return "NoResponseException after request ${request.toJson()}"; 101 return "NoResponseException after request ${request.toJson()}";
100 } 102 }
101 } 103 }
102 104
103 /** 105 /**
(...skipping 15 matching lines...) Expand all
119 requestController.stream.listen(onRequest, onError: onError, onDone: onDone) ; 121 requestController.stream.listen(onRequest, onError: onError, onDone: onDone) ;
120 } 122 }
121 123
122 @override 124 @override
123 void sendNotification(Notification notification) { 125 void sendNotification(Notification notification) {
124 notificationsReceived.add(notification); 126 notificationsReceived.add(notification);
125 // Wrap send notification in future to simulate websocket 127 // Wrap send notification in future to simulate websocket
126 new Future(() => notificationController.add(notification)); 128 new Future(() => notificationController.add(notification));
127 } 129 }
128 130
129 /// Simulate request/response pair 131 /**
132 * Simulate request/response pair.
133 */
130 Future<Response> sendRequest(Request request) { 134 Future<Response> sendRequest(Request request) {
131 var id = request.id; 135 var id = request.id;
132 // Wrap send request in future to simulate websocket 136 // Wrap send request in future to simulate websocket
133 new Future(() => requestController.add(request)); 137 new Future(() => requestController.add(request));
134 pumpEventQueue().then((_) => responseController.addError( 138 pumpEventQueue().then((_) => responseController.addError(
135 new NoResponseException(request))); 139 new NoResponseException(request)));
136 return responseController.stream.firstWhere((response) => response.id == id 140 return responseController.stream.firstWhere((response) => response.id == id
137 ); 141 );
138 } 142 }
139 143
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 196 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
193 } 197 }
194 198
195 /** 199 /**
196 * A mock [Source]. Particularly useful when all that is needed is the 200 * A mock [Source]. Particularly useful when all that is needed is the
197 * encoding. 201 * encoding.
198 */ 202 */
199 class MockSource extends Mock implements Source { 203 class MockSource extends Mock implements Source {
200 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 204 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
201 } 205 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/declarative_tests.dart ('k') | pkg/analysis_server/test/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698