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

Side by Side Diff: pkg/analysis_server/test/operation/operation_queue_test.dart

Issue 1115843003: restructure internal request to implement CompletionRequest API, (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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.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/operation/operation.dart'; 8 import 'package:analysis_server/src/operation/operation.dart';
9 import 'package:analysis_server/src/operation/operation_analysis.dart'; 9 import 'package:analysis_server/src/operation/operation_analysis.dart';
10 import 'package:analysis_server/src/operation/operation_queue.dart'; 10 import 'package:analysis_server/src/operation/operation_queue.dart';
11 import 'package:analysis_server/src/services/search/search_engine.dart';
11 import 'package:analyzer/src/generated/engine.dart'; 12 import 'package:analyzer/src/generated/engine.dart';
12 import 'package:analyzer/src/generated/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; 14 import 'package:test_reflective_loader/test_reflective_loader.dart';
14 import 'package:typed_mock/typed_mock.dart'; 15 import 'package:typed_mock/typed_mock.dart';
15 import 'package:unittest/unittest.dart'; 16 import 'package:unittest/unittest.dart';
16 17
17 import '../mocks.dart'; 18 import '../mocks.dart';
18 19
19 main() { 20 main() {
20 groupSep = ' | '; 21 groupSep = ' | ';
21 defineReflectiveTests(ServerOperationQueueTest); 22 defineReflectiveTests(ServerOperationQueueTest);
22 } 23 }
23 24
24 /** 25 /**
25 * Return a [ServerOperation] mock with the given priority. 26 * Return a [ServerOperation] mock with the given priority.
26 */ 27 */
27 ServerOperation mockOperation(ServerOperationPriority priority) { 28 ServerOperation mockOperation(ServerOperationPriority priority) {
28 ServerOperation operation = new _ServerOperationMock(); 29 ServerOperation operation = new _ServerOperationMock();
29 when(operation.priority).thenReturn(priority); 30 when(operation.priority).thenReturn(priority);
30 return operation; 31 return operation;
31 } 32 }
32 33
33 class AnalysisContextMock extends TypedMock implements InternalAnalysisContext { 34 class AnalysisContextMock extends TypedMock implements InternalAnalysisContext {
34 List<Source> prioritySources = <Source>[]; 35 List<Source> prioritySources = <Source>[];
35 36
36 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 37 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
37 } 38 }
38 39
39 class AnalysisServerMock extends TypedMock implements AnalysisServer { 40 class AnalysisServerMock extends TypedMock implements AnalysisServer {
41
42 @override
43 final SearchEngine searchEngine;
44
45 AnalysisServerMock({this.searchEngine});
46
40 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 47 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
41 } 48 }
42 49
43 class ServerContextManagerMock extends TypedMock 50 class ServerContextManagerMock extends TypedMock
44 implements ServerContextManager { 51 implements ServerContextManager {
45 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 52 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
46 } 53 }
47 54
48 @reflectiveTest 55 @reflectiveTest
49 class ServerOperationQueueTest { 56 class ServerOperationQueueTest {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return ServerOperationPriority.ANALYSIS_NOTIFICATION; 201 return ServerOperationPriority.ANALYSIS_NOTIFICATION;
195 } 202 }
196 203
197 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 204 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
198 205
199 @override 206 @override
200 bool shouldBeDiscardedOnSourceChange(Source source) { 207 bool shouldBeDiscardedOnSourceChange(Source source) {
201 return source == this.source; 208 return source == this.source;
202 } 209 }
203 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698