OLD | NEW |
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.operation.queue; | 5 library test.operation.queue; |
6 | 6 |
7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/context_manager.dart'; |
8 import 'package:analysis_server/src/operation/operation.dart'; | 9 import 'package:analysis_server/src/operation/operation.dart'; |
9 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 10 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
10 import 'package:analysis_server/src/operation/operation_queue.dart'; | 11 import 'package:analysis_server/src/operation/operation_queue.dart'; |
11 import 'package:analysis_server/src/services/search/search_engine.dart'; | 12 import 'package:analysis_server/src/services/search/search_engine.dart'; |
12 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
13 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
14 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
16 import 'package:typed_mock/typed_mock.dart'; | 17 import 'package:typed_mock/typed_mock.dart'; |
17 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
32 return operation; | 33 return operation; |
33 } | 34 } |
34 | 35 |
35 class AnalysisContextMock extends TypedMock implements InternalAnalysisContext { | 36 class AnalysisContextMock extends TypedMock implements InternalAnalysisContext { |
36 List<Source> prioritySources = <Source>[]; | 37 List<Source> prioritySources = <Source>[]; |
37 | 38 |
38 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 39 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
39 } | 40 } |
40 | 41 |
41 class AnalysisServerMock extends TypedMock implements AnalysisServer { | 42 class AnalysisServerMock extends TypedMock implements AnalysisServer { |
42 | |
43 @override | 43 @override |
44 final ResourceProvider resourceProvider; | 44 final ResourceProvider resourceProvider; |
45 | 45 |
46 @override | 46 @override |
47 final SearchEngine searchEngine; | 47 final SearchEngine searchEngine; |
48 | 48 |
49 AnalysisServerMock({this.resourceProvider, this.searchEngine}); | 49 AnalysisServerMock({this.resourceProvider, this.searchEngine}); |
50 | 50 |
51 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 51 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
52 } | 52 } |
53 | 53 |
54 class ServerContextManagerMock extends TypedMock | 54 class ServerContextManagerMock extends TypedMock implements ContextManager { |
55 implements ServerContextManager { | |
56 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 55 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
57 } | 56 } |
58 | 57 |
59 @reflectiveTest | 58 @reflectiveTest |
60 class ServerOperationQueueTest { | 59 class ServerOperationQueueTest { |
61 ServerOperationQueue queue = new ServerOperationQueue(); | 60 ServerOperationQueue queue = new ServerOperationQueue(); |
62 | 61 |
63 void test_clear() { | 62 void test_clear() { |
64 var operationA = mockOperation(ServerOperationPriority.ANALYSIS); | 63 var operationA = mockOperation(ServerOperationPriority.ANALYSIS); |
65 var operationB = mockOperation(ServerOperationPriority.ANALYSIS_CONTINUE); | 64 var operationB = mockOperation(ServerOperationPriority.ANALYSIS_CONTINUE); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return ServerOperationPriority.ANALYSIS_NOTIFICATION; | 204 return ServerOperationPriority.ANALYSIS_NOTIFICATION; |
206 } | 205 } |
207 | 206 |
208 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 207 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
209 | 208 |
210 @override | 209 @override |
211 bool shouldBeDiscardedOnSourceChange(Source source) { | 210 bool shouldBeDiscardedOnSourceChange(Source source) { |
212 return source == this.source; | 211 return source == this.source; |
213 } | 212 } |
214 } | 213 } |
OLD | NEW |