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

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

Issue 907183002: Fix notifications for nested packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/lib/src/analysis_server.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
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.analysis_server; 5 library test.analysis_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 server.setAnalysisRoots('0', ['/foo'], [], {}); 129 server.setAnalysisRoots('0', ['/foo'], [], {});
130 AnalysisContext context; 130 AnalysisContext context;
131 return pumpEventQueue().then((_) { 131 return pumpEventQueue().then((_) {
132 context = server.getAnalysisContext('/foo/bar.dart'); 132 context = server.getAnalysisContext('/foo/bar.dart');
133 server.setAnalysisRoots('1', [], [], {}); 133 server.setAnalysisRoots('1', [], [], {});
134 }).then((_) => pumpEventQueue()).then((_) { 134 }).then((_) => pumpEventQueue()).then((_) {
135 expect(context.isDisposed, isTrue); 135 expect(context.isDisposed, isTrue);
136 }); 136 });
137 } 137 }
138 138
139 test_getAnalysisContext_nested() {
140 String dir1Path = '/dir1';
141 String dir2Path = dir1Path + '/dir2';
142 String filePath = dir2Path + '/file.dart';
143 Folder dir1 = resourceProvider.newFolder(dir1Path);
144 Folder dir2 = resourceProvider.newFolder(dir2Path);
145 resourceProvider.newFile(filePath, 'library lib;');
146
147 AnalysisContext context1 = AnalysisEngine.instance.createAnalysisContext();
148 AnalysisContext context2 = AnalysisEngine.instance.createAnalysisContext();
149 server.folderMap[dir1] = context1;
150 server.folderMap[dir2] = context2;
151
152 expect(server.getAnalysisContext(filePath), context2);
153 }
154
155 test_getAnalysisContext_simple() {
156 String dirPath = '/dir';
157 String filePath = dirPath + '/file.dart';
158 Folder dir = resourceProvider.newFolder(dirPath);
159 resourceProvider.newFile(filePath, 'library lib;');
160
161 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
162 server.folderMap[dir] = context;
163
164 expect(server.getAnalysisContext(filePath), context);
165 }
166
139 Future test_contextsChangedEvent() { 167 Future test_contextsChangedEvent() {
140 resourceProvider.newFolder('/foo'); 168 resourceProvider.newFolder('/foo');
141 169
142 bool wasAdded = false; 170 bool wasAdded = false;
143 bool wasChanged = false; 171 bool wasChanged = false;
144 bool wasRemoved = false; 172 bool wasRemoved = false;
145 server.onContextsChanged.listen((ContextsChangedEvent event) { 173 server.onContextsChanged.listen((ContextsChangedEvent event) {
146 wasAdded = event.added.length == 1; 174 wasAdded = event.added.length == 1;
147 if (wasAdded) { 175 if (wasAdded) {
148 expect(event.added[0], isNotNull); 176 expect(event.added[0], isNotNull);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 @override 409 @override
382 Response handleRequest(Request request) { 410 Response handleRequest(Request request) {
383 if (request.method == 'echo') { 411 if (request.method == 'echo') {
384 return new Response(request.id, result: { 412 return new Response(request.id, result: {
385 'echo': true 413 'echo': true
386 }); 414 });
387 } 415 }
388 return null; 416 return null;
389 } 417 }
390 } 418 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698