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

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

Issue 621383002: Change integration test send...() methods to use structured objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reintroduce type checking of server responses Created 6 years, 2 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
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.integration.analysis; 5 library test.integration.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:analysis_server/src/constants.dart'; 12 import 'package:analysis_server/src/constants.dart';
13 import 'package:analysis_server/src/protocol.dart';
13 import 'package:path/path.dart'; 14 import 'package:path/path.dart';
14 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
15 16
16 import 'integration_test_methods.dart'; 17 import 'integration_test_methods.dart';
17 import 'protocol_matchers.dart'; 18 import 'protocol_matchers.dart';
18 19
19 /** 20 /**
20 * Base class for analysis server integration tests. 21 * Base class for analysis server integration tests.
21 */ 22 */
22 abstract class AbstractAnalysisServerIntegrationTest extends 23 abstract class AbstractAnalysisServerIntegrationTest extends
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 /** 91 /**
91 * Send the server an 'analysis.setAnalysisRoots' command directing it to 92 * Send the server an 'analysis.setAnalysisRoots' command directing it to
92 * analyze [sourceDirectory]. If [subscribeStatus] is true (the default), 93 * analyze [sourceDirectory]. If [subscribeStatus] is true (the default),
93 * then also enable [SERVER_STATUS] notifications so that [analysisFinished] 94 * then also enable [SERVER_STATUS] notifications so that [analysisFinished]
94 * can be used. 95 * can be used.
95 */ 96 */
96 Future standardAnalysisSetup({bool subscribeStatus: true}) { 97 Future standardAnalysisSetup({bool subscribeStatus: true}) {
97 List<Future> futures = <Future>[]; 98 List<Future> futures = <Future>[];
98 if (subscribeStatus) { 99 if (subscribeStatus) {
99 futures.add(sendServerSetSubscriptions(['STATUS'])); 100 futures.add(sendServerSetSubscriptions([ServerService.STATUS]));
100 } 101 }
101 futures.add(sendAnalysisSetAnalysisRoots([sourceDirectory.path], [])); 102 futures.add(sendAnalysisSetAnalysisRoots([sourceDirectory.path], []));
102 return Future.wait(futures); 103 return Future.wait(futures);
103 } 104 }
104 105
105 /** 106 /**
106 * Return a future which will complete when a 'server.status' notification is 107 * Return a future which will complete when a 'server.status' notification is
107 * received from the server with 'analyzing' set to false. 108 * received from the server with 'analyzing' set to false.
108 * 109 *
109 * The future will only be completed by 'server.status' notifications that are 110 * The future will only be completed by 'server.status' notifications that are
(...skipping 26 matching lines...) Expand all
136 137
137 /** 138 /**
138 * Print out any messages exchanged with the server. If some messages have 139 * Print out any messages exchanged with the server. If some messages have
139 * already been exchanged with the server, they are printed out immediately. 140 * already been exchanged with the server, they are printed out immediately.
140 */ 141 */
141 void debugStdio() { 142 void debugStdio() {
142 server.debugStdio(); 143 server.debugStdio();
143 } 144 }
144 145
145 @override 146 @override
146 Future sendServerSetSubscriptions(List<String> subscriptions, {bool 147 Future sendServerSetSubscriptions(List<ServerService> subscriptions) {
147 checkTypes: true}) { 148 _subscribedToServerStatus = subscriptions.contains(ServerService.STATUS);
148 _subscribedToServerStatus = subscriptions.contains('STATUS'); 149 return super.sendServerSetSubscriptions(subscriptions);
149 return super.sendServerSetSubscriptions(subscriptions, checkTypes:
150 checkTypes);
151 } 150 }
152 151
153 /** 152 /**
154 * The server is automatically started before every test, and a temporary 153 * The server is automatically started before every test, and a temporary
155 * [sourceDirectory] is created. 154 * [sourceDirectory] is created.
156 */ 155 */
157 Future setUp() { 156 Future setUp() {
158 sourceDirectory = Directory.systemTemp.createTempSync('analysisServer'); 157 sourceDirectory = Directory.systemTemp.createTempSync('analysisServer');
159 158
160 onAnalysisErrors.listen((params) { 159 onAnalysisErrors.listen((params) {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 */ 828 */
830 void _recordStdio(String line) { 829 void _recordStdio(String line) {
831 double elapsedTime = _time.elapsedTicks / _time.frequency; 830 double elapsedTime = _time.elapsedTicks / _time.frequency;
832 line = "$elapsedTime: $line"; 831 line = "$elapsedTime: $line";
833 if (_debuggingStdio) { 832 if (_debuggingStdio) {
834 print(line); 833 print(line);
835 } 834 }
836 _recordedStdio.add(line); 835 _recordedStdio.add(line);
837 } 836 }
838 } 837 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698