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

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

Issue 3001413002: Remove uses of the old plugin model from the analysis server (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « pkg/analysis_server/test/services/correction/assist_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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
8 import 'package:analysis_server/protocol/protocol_constants.dart'; 8 import 'package:analysis_server/protocol/protocol_constants.dart';
9 import 'package:analysis_server/protocol/protocol_generated.dart'; 9 import 'package:analysis_server/protocol/protocol_generated.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/plugin/server_plugin.dart';
12 import 'package:analysis_server/src/socket_server.dart'; 11 import 'package:analysis_server/src/socket_server.dart';
13 import 'package:analyzer/file_system/physical_file_system.dart'; 12 import 'package:analyzer/file_system/physical_file_system.dart';
14 import 'package:analyzer/instrumentation/instrumentation.dart'; 13 import 'package:analyzer/instrumentation/instrumentation.dart';
15 import 'package:analyzer/src/dart/sdk/sdk.dart'; 14 import 'package:analyzer/src/dart/sdk/sdk.dart';
16 import 'package:analyzer/src/generated/sdk.dart'; 15 import 'package:analyzer/src/generated/sdk.dart';
17 import 'package:plugin/manager.dart';
18 import 'package:test/test.dart'; 16 import 'package:test/test.dart';
19 17
20 import 'mocks.dart'; 18 import 'mocks.dart';
21 19
22 main() { 20 main() {
23 group('SocketServer', () { 21 group('SocketServer', () {
24 test('createAnalysisServer_successful', 22 test('createAnalysisServer_successful',
25 SocketServerTest.createAnalysisServer_successful); 23 SocketServerTest.createAnalysisServer_successful);
26 test('createAnalysisServer_alreadyStarted', 24 test('createAnalysisServer_alreadyStarted',
27 SocketServerTest.createAnalysisServer_alreadyStarted); 25 SocketServerTest.createAnalysisServer_alreadyStarted);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 expect(response.id, equals('0')); 103 expect(response.id, equals('0'));
106 expect(response.error, isNull); 104 expect(response.error, isNull);
107 channel.expectMsgCount(responseCount: 1, notificationCount: 2); 105 channel.expectMsgCount(responseCount: 1, notificationCount: 2);
108 expect(channel.notificationsReceived[1].event, SERVER_NOTIFICATION_ERROR); 106 expect(channel.notificationsReceived[1].event, SERVER_NOTIFICATION_ERROR);
109 }); 107 });
110 } 108 }
111 109
112 static SocketServer _createSocketServer() { 110 static SocketServer _createSocketServer() {
113 PhysicalResourceProvider resourceProvider = 111 PhysicalResourceProvider resourceProvider =
114 PhysicalResourceProvider.INSTANCE; 112 PhysicalResourceProvider.INSTANCE;
115 ServerPlugin serverPlugin = new ServerPlugin();
116 ExtensionManager manager = new ExtensionManager();
117 manager.processPlugins([serverPlugin]);
118 return new SocketServer( 113 return new SocketServer(
119 new AnalysisServerOptions(), 114 new AnalysisServerOptions(),
120 new DartSdkManager('', false), 115 new DartSdkManager('', false),
121 new FolderBasedDartSdk(resourceProvider, 116 new FolderBasedDartSdk(resourceProvider,
122 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)), 117 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)),
123 InstrumentationService.NULL_SERVICE, 118 InstrumentationService.NULL_SERVICE,
124 null, 119 null,
125 serverPlugin,
126 null, 120 null,
127 null); 121 null);
128 } 122 }
129 } 123 }
130 124
131 class _MockRequestHandler implements RequestHandler { 125 class _MockRequestHandler implements RequestHandler {
132 final bool futureException; 126 final bool futureException;
133 127
134 _MockRequestHandler(this.futureException); 128 _MockRequestHandler(this.futureException);
135 129
136 @override 130 @override
137 Response handleRequest(Request request) { 131 Response handleRequest(Request request) {
138 if (futureException) { 132 if (futureException) {
139 new Future(throwException); 133 new Future(throwException);
140 return new Response(request.id); 134 return new Response(request.id);
141 } 135 }
142 throw 'mock request exception'; 136 throw 'mock request exception';
143 } 137 }
144 138
145 void throwException() { 139 void throwException() {
146 throw 'mock future exception'; 140 throw 'mock future exception';
147 } 141 }
148 } 142 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/correction/assist_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698