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

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

Issue 214933002: Clean-up and progress on analysis server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/domain_context_test.dart ('k') | no next file » | 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 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 12 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/channel.dart'; 13 import 'package:analysis_server/src/channel.dart';
12 import 'package:analysis_server/src/protocol.dart'; 14 import 'package:analysis_server/src/protocol.dart';
13 import 'package:unittest/matcher.dart'; 15 import 'package:unittest/matcher.dart';
14 16
15 /** 17 /**
16 * Answer the absolute path the the SDK relative to the currently running 18 * Answer the absolute path the the SDK relative to the currently running
17 * script or throw an exception if it cannot be found. 19 * script or throw an exception if it cannot be found.
18 */ 20 */
19 String get sdkPath { 21 String get sdkPath {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 StreamController<Response> responseController = new StreamController<Response> (); 77 StreamController<Response> responseController = new StreamController<Response> ();
76 StreamController<Notification> notificationController = new StreamController<N otification>(); 78 StreamController<Notification> notificationController = new StreamController<N otification>();
77 79
78 List<Response> responsesReceived = []; 80 List<Response> responsesReceived = [];
79 List<Notification> notificationsReceived = []; 81 List<Notification> notificationsReceived = [];
80 82
81 MockServerChannel() { 83 MockServerChannel() {
82 } 84 }
83 85
84 @override 86 @override
85 void listen(void onRequest(Request request), {void onError(), void onDone()}) { 87 void listen(void onRequest(Request request), {Function onError, void onDone()} ) {
86 requestController.stream.listen(onRequest, onError: onError, onDone: onDone) ; 88 requestController.stream.listen(onRequest, onError: onError, onDone: onDone) ;
87 } 89 }
88 90
89 @override 91 @override
90 void sendNotification(Notification notification) { 92 void sendNotification(Notification notification) {
91 notificationsReceived.add(notification); 93 notificationsReceived.add(notification);
92 // Wrap send notification in future to simulate websocket 94 // Wrap send notification in future to simulate websocket
93 new Future(() => notificationController.add(notification)); 95 new Future(() => notificationController.add(notification));
94 } 96 }
95 97
(...skipping 10 matching lines...) Expand all
106 responsesReceived.add(response); 108 responsesReceived.add(response);
107 // Wrap send response in future to simulate websocket 109 // Wrap send response in future to simulate websocket
108 new Future(() => responseController.add(response)); 110 new Future(() => responseController.add(response));
109 } 111 }
110 112
111 void expectMsgCount({responseCount: 0, notificationCount: 0}) { 113 void expectMsgCount({responseCount: 0, notificationCount: 0}) {
112 expect(responsesReceived, hasLength(responseCount)); 114 expect(responsesReceived, hasLength(responseCount));
113 expect(notificationsReceived, hasLength(notificationCount)); 115 expect(notificationsReceived, hasLength(notificationCount));
114 } 116 }
115 } 117 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_context_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698