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

Unified Diff: pkg/analysis_server/test/operation/operation_queue_test.dart

Issue 988593002: Don't send notifications for disposed contexts. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/operation/operation_queue_test.dart
diff --git a/pkg/analysis_server/test/operation/operation_queue_test.dart b/pkg/analysis_server/test/operation/operation_queue_test.dart
index 09a8afd60033176f04f290973e42a61054fa5d3b..e2ed0f54e1beb65a0ff6c3e67c3101ed540dad50 100644
--- a/pkg/analysis_server/test/operation/operation_queue_test.dart
+++ b/pkg/analysis_server/test/operation/operation_queue_test.dart
@@ -61,6 +61,22 @@ class ServerOperationQueueTest {
expect(queue.isEmpty, true);
}
+ void test_contextRemoved() {
+ var contextA = new AnalysisContextMock();
+ var contextB = new AnalysisContextMock();
+ var opA1 = new _ContextOperationMock(contextA);
+ var opA2 = new _ContextOperationMock(contextA);
+ var opB1 = new _ContextOperationMock(contextB);
+ var opB2 = new _ContextOperationMock(contextB);
+ queue.add(opA1);
+ queue.add(opB1);
+ queue.add(opA2);
+ queue.add(opB2);
+ queue.contextRemoved(contextA);
+ expect(queue.take(), same(opB1));
+ expect(queue.take(), same(opB2));
+ }
+
void test_isEmpty_false() {
var operation = mockOperation(ServerOperationPriority.ANALYSIS);
queue.add(operation);
@@ -147,6 +163,19 @@ class ServerOperationQueueTest {
}
}
+class _ContextOperationMock extends TypedMock implements ServerOperation {
scheglov 2015/03/06 00:37:23 We could merge this class with _ServerOperationMoc
Paul Berry 2015/03/06 01:11:09 Done.
+ final AnalysisContext context;
+
+ _ContextOperationMock(this.context);
+
+ @override
+ ServerOperationPriority get priority {
+ return ServerOperationPriority.ANALYSIS_NOTIFICATION;
+ }
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
class _ServerOperationMock extends TypedMock implements ServerOperation {
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

Powered by Google App Engine
This is Rietveld 408576698