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

Side by Side Diff: pkg/analysis_server/test/index/index_test.dart

Issue 346963006: Index Dart/HTML units after analysis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 6 years, 6 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.index; 5 library test.index;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' show Directory; 8 import 'dart:io' show Directory;
9 9
10 import 'package:analysis_server/src/index/index.dart'; 10 import 'package:analysis_server/src/index/index.dart';
11 import 'package:analysis_server/src/resource.dart'; 11 import 'package:analysis_server/src/resource.dart';
12 import 'package:analyzer/src/generated/ast.dart'; 12 import 'package:analyzer/src/generated/ast.dart';
13 import 'package:analyzer/src/generated/element.dart'; 13 import 'package:analyzer/src/generated/element.dart';
14 import 'package:analyzer/src/generated/engine.dart'; 14 import 'package:analyzer/src/generated/engine.dart';
15 import 'package:analyzer/src/generated/html.dart'; 15 import 'package:analyzer/src/generated/html.dart';
16 import 'package:analyzer/src/generated/index.dart'; 16 import 'package:analyzer/src/generated/index.dart';
17 import 'package:analyzer/src/generated/sdk.dart'; 17 import 'package:analyzer/src/generated/sdk.dart';
18 import 'package:analyzer/src/generated/source_io.dart'; 18 import 'package:analyzer/src/generated/source_io.dart';
19 import 'package:unittest/unittest.dart'; 19 import 'package:unittest/unittest.dart';
20 20
21 import '../mocks.dart'; 21 import '../mocks.dart';
22 import '../reflective_tests.dart'; 22 import '../reflective_tests.dart';
23 import 'store/single_source_container.dart'; 23 import 'store/single_source_container.dart';
24 import 'store/memory_node_manager.dart';
24 25
25 26
26 main() { 27 main() {
27 groupSep = ' | '; 28 groupSep = ' | ';
28 group('ServerIndex', () { 29 group('LocalIndex', () {
29 runReflectiveTests(_LocalSplitIndexTest); 30 runReflectiveTests(LocalIndexTest);
30 }); 31 });
31 } 32 }
32 33
33 34
34 void _assertElementNames(List<Location> locations, List expected) { 35 void _assertElementNames(List<Location> locations, List expected) {
35 expect(_toElementNames(locations), unorderedEquals(expected)); 36 expect(_toElementNames(locations), unorderedEquals(expected));
36 } 37 }
37 38
38 39
39 Iterable<String> _toElementNames(List<Location> locations) { 40 Iterable<String> _toElementNames(List<Location> locations) {
40 return locations.map((loc) => loc.element.name); 41 return locations.map((loc) => loc.element.name);
41 } 42 }
42 43
43 44
44 @ReflectiveTestCase() 45 @ReflectiveTestCase()
45 class _LocalSplitIndexTest { 46 class LocalIndexTest {
46 static final DartSdk SDK = new MockSdk(); 47 static final DartSdk SDK = new MockSdk();
47 48
48 AnalysisContext context; 49 AnalysisContext context;
49 LocalSplitIndex index; 50 LocalIndex index;
50 Directory indexDirectory; 51 Directory indexDirectory;
51 MemoryResourceProvider provider = new MemoryResourceProvider(); 52 MemoryResourceProvider provider = new MemoryResourceProvider();
52 53
53 void setUp() { 54 void setUp() {
54 // prepare Index 55 // prepare Index
55 indexDirectory = Directory.systemTemp.createTempSync( 56 indexDirectory = Directory.systemTemp.createTempSync(
56 'AnalysisServer_index'); 57 'AnalysisServer_index');
57 index = new LocalSplitIndex(indexDirectory); 58 index = new LocalIndex(new MemoryNodeManager());
58 // prepare AnalysisContext 59 // prepare AnalysisContext
59 context = AnalysisEngine.instance.createAnalysisContext(); 60 context = AnalysisEngine.instance.createAnalysisContext();
60 context.sourceFactory = new SourceFactory(<UriResolver>[new DartUriResolver( 61 context.sourceFactory = new SourceFactory(<UriResolver>[new DartUriResolver(
61 SDK), new ResourceUriResolver(provider)]); 62 SDK), new ResourceUriResolver(provider)]);
62 } 63 }
63 64
64 void tearDown() { 65 void tearDown() {
65 indexDirectory.delete(recursive: true); 66 indexDirectory.delete(recursive: true);
66 index = null; 67 index = null;
67 context = null; 68 context = null;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 */ 195 */
195 class _RecordingRelationshipCallback extends RelationshipCallback { 196 class _RecordingRelationshipCallback extends RelationshipCallback {
196 List<Location> locations; 197 List<Location> locations;
197 198
198 @override 199 @override
199 void hasRelationships(Element element, Relationship relationship, 200 void hasRelationships(Element element, Relationship relationship,
200 List<Location> locations) { 201 List<Location> locations) {
201 this.locations = locations; 202 this.locations = locations;
202 } 203 }
203 } 204 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_server_test.dart ('k') | pkg/analysis_server/test/index/store/memory_node_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698