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

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

Issue 426923002: Start running the analysis server integration tests by changing the name to end with _test.dart (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « pkg/analysis_server/test/integration/server_domain_int_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
(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_server/src/constants.dart';
10 import 'package:analysis_testing/reflective_tests.dart';
11 import 'package:unittest/unittest.dart';
12
13 import 'integration_tests.dart';
14
15 @ReflectiveTestCase()
16 class ServerDomainIntegrationTest extends AbstractAnalysisServerIntegrationTest
17 {
18 test_getVersion() {
19 return server.send(SERVER_GET_VERSION, null).then((response) {
20 expect(response, isServerGetVersionResult);
21 });
22 }
23
24 fail_test_shutdown() {
25 // TODO(paulberry): fix the server so that it passes this test.
26 return server.send(SERVER_SHUTDOWN, null).then((response) {
27 expect(response, isNull);
28 return new Future.delayed(new Duration(seconds: 1)).then((_) {
29 server.send(SERVER_GET_VERSION, null).then((_) {
30 fail('Server still alive after server.shutdown');
31 });
32 // Give the server time to respond before terminating the test.
33 return new Future.delayed(new Duration(seconds: 1));
34 });
35 });
36 }
37
38 fail_test_setSubscriptions() {
39 // TODO(paulberry): fix the server so that it passes this test.
40 bool statusReceived = false;
41 Completer analysisBegun = new Completer();
42 server.onNotification(SERVER_STATUS).listen((_) {
43 statusReceived = true;
44 });
45 server.onNotification(ANALYSIS_ERRORS).listen((_) {
46 if (!analysisBegun.isCompleted) {
47 analysisBegun.complete();
48 }
49 });
50 return server_setSubscriptions([]).then((response) {
51 expect(response, isNull);
52 writeFile('test.dart', '''
53 main() {
54 var x;
55 }''');
56 setAnalysisRoots(['']);
57 // Analysis should begin, but no server.status notification should be
58 // received.
59 return analysisBegun.future.then((_) {
60 expect(statusReceived, isFalse);
61 return server_setSubscriptions(['STATUS']).then((_) {
62 // Tickle test.dart just in case analysis has already completed.
63 writeFile('test.dart', '''
64 main() {
65 var y;
66 }''');
67 // Analysis should eventually complete, and we should be notified
68 // about it.
69 return analysisFinished;
70 });
71 });
72 });
73 }
74
75 test_setSubscriptions_invalidService() {
76 // TODO(paulberry): verify that if an invalid service is specified, the
77 // current subscriptions are unchanged.
78 return server_setSubscriptions(['bogus']).then((_) {
79 fail('setSubscriptions should have produced an error');
80 }, onError: (error) {
81 // The expected error occurred.
82 });
83 }
84
85 test_connected() {
86 Completer receivedConnected = new Completer();
87 server.onNotification(SERVER_CONNECTED).listen((params) {
88 expect(receivedConnected.isCompleted, isFalse);
89 receivedConnected.complete();
90 expect(params, isNull);
91 });
92 return receivedConnected.future;
93 }
94
95 test_error() {
96 // TODO(paulberry): how do we test the 'server.error' notification given
97 // that this notification should only occur in the event of a server bug?
98 }
99
100 test_status() {
101 // TODO(paulberry): spec says that server.status is not subscribed to by
102 // default, but currently it's behaving as though it is.
103
104 // After we kick off analysis, we should get one server.status message with
105 // analyzing=true, and another server.status message after that with
106 // analyzing=false.
107 Completer analysisBegun = new Completer();
108 Completer analysisFinished = new Completer();
109 server.onNotification(SERVER_STATUS).listen((params) {
110 expect(params, isServerStatusParams);
111 if (params['analysis'] != null) {
112 if (params['analysis']['analyzing']) {
113 expect(analysisBegun.isCompleted, isFalse);
114 analysisBegun.complete();
115 } else {
116 expect(analysisFinished.isCompleted, isFalse);
117 analysisFinished.complete();
118 }
119 }
120 });
121 writeFile('test.dart', '''
122 main() {
123 var x;
124 }''');
125 setAnalysisRoots(['']);
126 expect(analysisBegun.isCompleted, isFalse);
127 expect(analysisFinished.isCompleted, isFalse);
128 return analysisBegun.future.then((_) {
129 expect(analysisFinished.isCompleted, isFalse);
130 return analysisFinished.future;
131 });
132 }
133 }
134
135 main() {
136 runReflectiveTests(ServerDomainIntegrationTest);
137 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/server_domain_int_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698