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

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

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
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.domain.server; 5 library test.domain.server;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/constants.dart'; 8 import 'package:analysis_server/src/constants.dart';
9 import 'package:analysis_server/src/domain_server.dart'; 9 import 'package:analysis_server/src/domain_server.dart';
10 import 'package:analysis_server/src/plugin/server_plugin.dart'; 10 import 'package:analysis_server/src/plugin/server_plugin.dart';
11 import 'package:analysis_server/src/protocol.dart'; 11 import 'package:analysis_server/src/protocol.dart';
12 import 'package:analyzer/file_system/memory_file_system.dart'; 12 import 'package:analyzer/file_system/memory_file_system.dart';
13 import 'package:analyzer/instrumentation/instrumentation.dart'; 13 import 'package:analyzer/instrumentation/instrumentation.dart';
14 import 'package:plugin/manager.dart'; 14 import 'package:plugin/manager.dart';
15 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
16 16
17 import 'mock_sdk.dart'; 17 import 'mock_sdk.dart';
18 import 'mocks.dart'; 18 import 'mocks.dart';
19 import 'utils.dart';
19 20
20 main() { 21 main() {
21 AnalysisServer server; 22 AnalysisServer server;
22 ServerDomainHandler handler; 23 ServerDomainHandler handler;
23 24
25 initializeTestEnvironment();
26
24 setUp(() { 27 setUp(() {
25 var serverChannel = new MockServerChannel(); 28 var serverChannel = new MockServerChannel();
26 var resourceProvider = new MemoryResourceProvider(); 29 var resourceProvider = new MemoryResourceProvider();
27 ExtensionManager manager = new ExtensionManager(); 30 ExtensionManager manager = new ExtensionManager();
28 ServerPlugin serverPlugin = new ServerPlugin(); 31 ServerPlugin serverPlugin = new ServerPlugin();
29 manager.processPlugins([serverPlugin]); 32 manager.processPlugins([serverPlugin]);
30 server = new AnalysisServer(serverChannel, resourceProvider, 33 server = new AnalysisServer(
31 new MockPackageMapProvider(), null, serverPlugin, 34 serverChannel,
32 new AnalysisServerOptions(), new MockSdk(), 35 resourceProvider,
36 new MockPackageMapProvider(),
37 null,
38 serverPlugin,
39 new AnalysisServerOptions(),
40 new MockSdk(),
33 InstrumentationService.NULL_SERVICE); 41 InstrumentationService.NULL_SERVICE);
34 handler = new ServerDomainHandler(server); 42 handler = new ServerDomainHandler(server);
35 }); 43 });
36 44
37 group('ServerDomainHandler', () { 45 group('ServerDomainHandler', () {
38 test('getVersion', () { 46 test('getVersion', () {
39 var request = new ServerGetVersionParams().toRequest('0'); 47 var request = new ServerGetVersionParams().toRequest('0');
40 var response = handler.handleRequest(request); 48 var response = handler.handleRequest(request);
41 expect(response.toJson(), equals({ 49 expect(
42 Response.ID: '0', 50 response.toJson(),
43 Response.RESULT: {VERSION: AnalysisServer.VERSION} 51 equals({
44 })); 52 Response.ID: '0',
53 Response.RESULT: {VERSION: AnalysisServer.VERSION}
54 }));
45 }); 55 });
46 56
47 group('setSubscriptions', () { 57 group('setSubscriptions', () {
48 test('invalid service name', () { 58 test('invalid service name', () {
49 Request request = new Request( 59 Request request = new Request('0', SERVER_SET_SUBSCRIPTIONS, {
50 '0', SERVER_SET_SUBSCRIPTIONS, {SUBSCRIPTIONS: ['noSuchService']}); 60 SUBSCRIPTIONS: ['noSuchService']
61 });
51 var response = handler.handleRequest(request); 62 var response = handler.handleRequest(request);
52 expect(response, isResponseFailure('0')); 63 expect(response, isResponseFailure('0'));
53 }); 64 });
54 65
55 test('success', () { 66 test('success', () {
56 expect(server.serverServices, isEmpty); 67 expect(server.serverServices, isEmpty);
57 // send request 68 // send request
58 Request request = 69 Request request =
59 new ServerSetSubscriptionsParams([ServerService.STATUS]) 70 new ServerSetSubscriptionsParams([ServerService.STATUS])
60 .toRequest('0'); 71 .toRequest('0');
61 var response = handler.handleRequest(request); 72 var response = handler.handleRequest(request);
62 expect(response, isResponseSuccess('0')); 73 expect(response, isResponseSuccess('0'));
63 // set of services has been changed 74 // set of services has been changed
64 expect(server.serverServices, contains(ServerService.STATUS)); 75 expect(server.serverServices, contains(ServerService.STATUS));
65 }); 76 });
66 }); 77 });
67 78
68 test('shutdown', () { 79 test('shutdown', () {
69 expect(server.running, isTrue); 80 expect(server.running, isTrue);
70 // send request 81 // send request
71 var request = new ServerShutdownParams().toRequest('0'); 82 var request = new ServerShutdownParams().toRequest('0');
72 var response = handler.handleRequest(request); 83 var response = handler.handleRequest(request);
73 expect(response, isResponseSuccess('0')); 84 expect(response, isResponseSuccess('0'));
74 // server is down 85 // server is down
75 expect(server.running, isFalse); 86 expect(server.running, isFalse);
76 }); 87 });
77 }); 88 });
78 } 89 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_execution_test.dart ('k') | pkg/analysis_server/test/edit/assists_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698