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

Side by Side Diff: pkg/analysis_server/test/integration/server_domain_int_test.dart

Issue 458453003: Split up server_domain_int_test.dart; regularize integration test directories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library test.integration.server.domain;
6
7 import 'dart:async';
8
9 import 'package:analysis_testing/reflective_tests.dart';
10 import 'package:unittest/unittest.dart';
11
12 import 'integration_tests.dart';
13
14 @ReflectiveTestCase()
15 class ServerDomainIntegrationTest extends AbstractAnalysisServerIntegrationTest
16 {
17 test_getVersion() {
18 return sendServerGetVersion();
19 }
20
21 test_shutdown() {
22 return sendServerShutdown().then((_) {
23 return new Future.delayed(new Duration(seconds: 1)).then((_) {
24 sendServerGetVersion().then((_) {
25 fail('Server still alive after server.shutdown');
26 });
27 // Give the server time to respond before terminating the test.
28 return new Future.delayed(new Duration(seconds: 1));
29 });
30 });
31 }
32
33 test_setSubscriptions() {
34 bool statusReceived = false;
35 Completer analysisBegun = new Completer();
36 onServerStatus.listen((_) {
37 statusReceived = true;
38 });
39 onAnalysisErrors.listen((_) {
40 if (!analysisBegun.isCompleted) {
41 analysisBegun.complete();
42 }
43 });
44 return sendServerSetSubscriptions([]).then((_) {
45 String pathname = sourcePath('test.dart');
46 writeFile(pathname, '''
47 main() {
48 var x;
49 }''');
50 standardAnalysisSetup(subscribeStatus: false);
51 // Analysis should begin, but no server.status notification should be
52 // received.
53 return analysisBegun.future.then((_) {
54 expect(statusReceived, isFalse);
55 return sendServerSetSubscriptions(['STATUS']).then((_) {
56 // Tickle test.dart just in case analysis has already completed.
57 writeFile(pathname, '''
58 main() {
59 var y;
60 }''');
61 // Analysis should eventually complete, and we should be notified
62 // about it.
63 return analysisFinished;
64 });
65 });
66 });
67 }
68
69 test_setSubscriptions_invalidService() {
70 // TODO(paulberry): verify that if an invalid service is specified, the
71 // current subscriptions are unchanged.
72 return sendServerSetSubscriptions(['bogus'], checkTypes: false).then((_) {
73 fail('setSubscriptions should have produced an error');
74 }, onError: (error) {
75 // The expected error occurred.
76 });
77 }
78
79 test_connected() {
80 expect(serverConnectedParams, isNull);
81 }
82
83 test_error() {
84 // TODO(paulberry): how do we test the 'server.error' notification given
85 // that this notification should only occur in the event of a server bug?
86 }
87
88 test_status() {
89 // After we kick off analysis, we should get one server.status message with
90 // analyzing=true, and another server.status message after that with
91 // analyzing=false.
92 Completer analysisBegun = new Completer();
93 Completer analysisFinished = new Completer();
94 onServerStatus.listen((params) {
95 if (params['analysis'] != null) {
96 if (params['analysis']['analyzing']) {
97 expect(analysisBegun.isCompleted, isFalse);
98 analysisBegun.complete();
99 } else {
100 expect(analysisFinished.isCompleted, isFalse);
101 analysisFinished.complete();
102 }
103 }
104 });
105 writeFile(sourcePath('test.dart'), '''
106 main() {
107 var x;
108 }''');
109 standardAnalysisSetup();
110 expect(analysisBegun.isCompleted, isFalse);
111 expect(analysisFinished.isCompleted, isFalse);
112 return analysisBegun.future.then((_) {
113 expect(analysisFinished.isCompleted, isFalse);
114 return analysisFinished.future;
115 });
116 }
117 }
118
119 main() {
120 runReflectiveTests(ServerDomainIntegrationTest);
121 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/server/test_all.dart ('k') | pkg/analysis_server/test/integration/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698