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

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

Issue 311263012: Remove 'as dynamic' cast after typed_mock fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('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.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_analysis.dart'; 8 import 'package:analysis_server/src/operation/operation_analysis.dart';
9 import 'package:analysis_server/src/operation/operation.dart'; 9 import 'package:analysis_server/src/operation/operation.dart';
10 import 'package:analysis_server/src/operation/operation_queue.dart'; 10 import 'package:analysis_server/src/operation/operation_queue.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 expect(queue.isEmpty, isFalse); 47 expect(queue.isEmpty, isFalse);
48 }); 48 });
49 }); 49 });
50 50
51 group('take', () { 51 group('take', () {
52 test('empty', () { 52 test('empty', () {
53 expect(queue.take(), isNull); 53 expect(queue.take(), isNull);
54 }); 54 });
55 55
56 test('use operation priorities', () { 56 test('use operation priorities', () {
57 // TODO(scheglov) update 'typed_mock' to make 'any*' fields dynamic 57 when(server.isPriorityContext(anyObject)).thenReturn(false);
58 when(server.isPriorityContext(anyObject as dynamic)).thenReturn(false);
59 var analysisContext = new AnalysisContextMock(); 58 var analysisContext = new AnalysisContextMock();
60 var operationA = mockOperation(ServerOperationPriority.SEARCH); 59 var operationA = mockOperation(ServerOperationPriority.SEARCH);
61 var operationB = mockOperation(ServerOperationPriority.REFACTORING); 60 var operationB = mockOperation(ServerOperationPriority.REFACTORING);
62 var operationC = new PerformAnalysisOperation(analysisContext, false); 61 var operationC = new PerformAnalysisOperation(analysisContext, false);
63 queue.add(operationA); 62 queue.add(operationA);
64 queue.add(operationB); 63 queue.add(operationB);
65 queue.add(operationC); 64 queue.add(operationC);
66 expect(queue.take(), operationC); 65 expect(queue.take(), operationC);
67 expect(queue.take(), operationA); 66 expect(queue.take(), operationA);
68 expect(queue.take(), operationB); 67 expect(queue.take(), operationB);
69 expect(queue.take(), isNull); 68 expect(queue.take(), isNull);
70 }); 69 });
71 70
72 test('continue analysis first', () { 71 test('continue analysis first', () {
73 // TODO(scheglov) update 'typed_mock' to make 'any*' fields dynamic 72 when(server.isPriorityContext(anyObject)).thenReturn(false);
74 when(server.isPriorityContext(anyObject as dynamic)).thenReturn(false);
75 var analysisContext = new AnalysisContextMock(); 73 var analysisContext = new AnalysisContextMock();
76 var operationA = new PerformAnalysisOperation(analysisContext, false); 74 var operationA = new PerformAnalysisOperation(analysisContext, false);
77 var operationB = new PerformAnalysisOperation(analysisContext, true); 75 var operationB = new PerformAnalysisOperation(analysisContext, true);
78 queue.add(operationA); 76 queue.add(operationA);
79 queue.add(operationB); 77 queue.add(operationB);
80 expect(queue.take(), operationB); 78 expect(queue.take(), operationB);
81 expect(queue.take(), operationA); 79 expect(queue.take(), operationA);
82 expect(queue.take(), isNull); 80 expect(queue.take(), isNull);
83 }); 81 });
84 82
(...skipping 29 matching lines...) Expand all
114 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 112 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
115 } 113 }
116 114
117 class ServerOperationMock extends TypedMock implements ServerOperation { 115 class ServerOperationMock extends TypedMock implements ServerOperation {
118 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 116 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
119 } 117 }
120 118
121 class AnalysisServerMock extends TypedMock implements AnalysisServer { 119 class AnalysisServerMock extends TypedMock implements AnalysisServer {
122 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 120 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
123 } 121 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698