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

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

Issue 1830703002: Pass AnalysisOptions into SdkCreator, disable changing afterwards. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | pkg/analyzer/lib/source/embedder.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 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 expect(response.error, isNull); 105 expect(response.error, isNull);
106 channel.expectMsgCount(responseCount: 1, notificationCount: 2); 106 channel.expectMsgCount(responseCount: 1, notificationCount: 2);
107 expect(channel.notificationsReceived[1].event, SERVER_ERROR); 107 expect(channel.notificationsReceived[1].event, SERVER_ERROR);
108 }); 108 });
109 } 109 }
110 110
111 static SocketServer _createSocketServer() { 111 static SocketServer _createSocketServer() {
112 ServerPlugin serverPlugin = new ServerPlugin(); 112 ServerPlugin serverPlugin = new ServerPlugin();
113 ExtensionManager manager = new ExtensionManager(); 113 ExtensionManager manager = new ExtensionManager();
114 manager.processPlugins([serverPlugin]); 114 manager.processPlugins([serverPlugin]);
115 SdkCreator sdkCreator = () => 115 SdkCreator sdkCreator = (_) =>
116 new DirectoryBasedDartSdk(DirectoryBasedDartSdk.defaultSdkDirectory); 116 new DirectoryBasedDartSdk(DirectoryBasedDartSdk.defaultSdkDirectory);
117 return new SocketServer( 117 return new SocketServer(
118 new AnalysisServerOptions(), 118 new AnalysisServerOptions(),
119 sdkCreator, 119 sdkCreator,
120 sdkCreator(), 120 sdkCreator(null),
121 InstrumentationService.NULL_SERVICE, 121 InstrumentationService.NULL_SERVICE,
122 serverPlugin, 122 serverPlugin,
123 null, 123 null,
124 null); 124 null);
125 } 125 }
126 } 126 }
127 127
128 class _MockRequestHandler implements RequestHandler { 128 class _MockRequestHandler implements RequestHandler {
129 final bool futureException; 129 final bool futureException;
130 130
131 _MockRequestHandler(this.futureException); 131 _MockRequestHandler(this.futureException);
132 132
133 @override 133 @override
134 Response handleRequest(Request request) { 134 Response handleRequest(Request request) {
135 if (futureException) { 135 if (futureException) {
136 new Future(throwException); 136 new Future(throwException);
137 return new Response(request.id); 137 return new Response(request.id);
138 } 138 }
139 throw 'mock request exception'; 139 throw 'mock request exception';
140 } 140 }
141 141
142 void throwException() { 142 void throwException() {
143 throw 'mock future exception'; 143 throw 'mock future exception';
144 } 144 }
145 } 145 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | pkg/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698