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

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

Issue 337943002: Adjust server for API changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug Created 6 years, 6 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/protocol_test.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 test.socket.server; 5 library test.socket.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'mocks.dart'; 9 import 'mocks.dart';
10 10
(...skipping 10 matching lines...) Expand all
21 SocketServerTest.createAnalysisServer_alreadyStarted); 21 SocketServerTest.createAnalysisServer_alreadyStarted);
22 }); 22 });
23 } 23 }
24 24
25 class SocketServerTest { 25 class SocketServerTest {
26 static Future createAnalysisServer_successful() { 26 static Future createAnalysisServer_successful() {
27 SocketServer server = new SocketServer(); 27 SocketServer server = new SocketServer();
28 MockServerChannel channel = new MockServerChannel(); 28 MockServerChannel channel = new MockServerChannel();
29 server.createAnalysisServer(channel); 29 server.createAnalysisServer(channel);
30 channel.expectMsgCount(notificationCount: 1); 30 channel.expectMsgCount(notificationCount: 1);
31 expect(channel.notificationsReceived[0].event, NOTIFICATION_CONNECTED); 31 expect(channel.notificationsReceived[0].event, SERVER_CONNECTED);
32 expect(channel.notificationsReceived[0].params, isEmpty); 32 expect(channel.notificationsReceived[0].params, isEmpty);
33 return channel.sendRequest( 33 return channel.sendRequest(
34 new Request('0', METHOD_SHUTDOWN) 34 new Request('0', SERVER_SHUTDOWN)
35 ).then((Response response) { 35 ).then((Response response) {
36 expect(response.id, equals('0')); 36 expect(response.id, equals('0'));
37 expect(response.error, isNull); 37 expect(response.error, isNull);
38 channel.expectMsgCount(responseCount: 1, notificationCount: 1); 38 channel.expectMsgCount(responseCount: 1, notificationCount: 1);
39 }); 39 });
40 } 40 }
41 41
42 static void createAnalysisServer_alreadyStarted() { 42 static void createAnalysisServer_alreadyStarted() {
43 SocketServer server = new SocketServer(); 43 SocketServer server = new SocketServer();
44 MockServerChannel channel1 = new MockServerChannel(); 44 MockServerChannel channel1 = new MockServerChannel();
45 MockServerChannel channel2 = new MockServerChannel(); 45 MockServerChannel channel2 = new MockServerChannel();
46 server.createAnalysisServer(channel1); 46 server.createAnalysisServer(channel1);
47 expect(channel1.notificationsReceived[0].event, NOTIFICATION_CONNECTED); 47 expect(channel1.notificationsReceived[0].event, SERVER_CONNECTED);
48 expect(channel1.notificationsReceived[0].params, isEmpty); 48 expect(channel1.notificationsReceived[0].params, isEmpty);
49 server.createAnalysisServer(channel2); 49 server.createAnalysisServer(channel2);
50 channel1.expectMsgCount(notificationCount: 1); 50 channel1.expectMsgCount(notificationCount: 1);
51 channel2.expectMsgCount(responseCount: 1); 51 channel2.expectMsgCount(responseCount: 1);
52 expect(channel2.responsesReceived[0].id, equals('')); 52 expect(channel2.responsesReceived[0].id, equals(''));
53 expect(channel2.responsesReceived[0].error, isNotNull); 53 expect(channel2.responsesReceived[0].error, isNotNull);
54 expect(channel2.responsesReceived[0].error.code, equals( 54 expect(channel2.responsesReceived[0].error.code, equals(
55 RequestError.CODE_SERVER_ALREADY_STARTED)); 55 RequestError.CODE_SERVER_ALREADY_STARTED));
56 channel2.sendRequest(new Request('0', METHOD_SHUTDOWN)).then((Response respo nse) { 56 channel2.sendRequest(new Request('0', SERVER_SHUTDOWN)).then((Response respo nse) {
57 expect(response.id, equals('0')); 57 expect(response.id, equals('0'));
58 expect(response.error, isNotNull); 58 expect(response.error, isNotNull);
59 expect(response.error.code, equals( 59 expect(response.error.code, equals(
60 RequestError.CODE_SERVER_ALREADY_STARTED)); 60 RequestError.CODE_SERVER_ALREADY_STARTED));
61 channel2.expectMsgCount(responseCount: 2); 61 channel2.expectMsgCount(responseCount: 2);
62 }); 62 });
63 } 63 }
64 } 64 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/protocol_test.dart ('k') | pkg/analysis_server/test/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698