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

Unified Diff: pkg/analysis_server/test/index/page_node_manager_test.dart

Issue 329633002: Some clean ups for caching tests. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/index/lru_cache_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/index/page_node_manager_test.dart
diff --git a/pkg/analysis_server/test/index/page_node_manager_test.dart b/pkg/analysis_server/test/index/page_node_manager_test.dart
index 9578f72cfe2cdb99a76cc7b6b4279423ef2057e0..b2e2eaeeaeab777284d1dd93a79b084f3b2ce3be 100644
--- a/pkg/analysis_server/test/index/page_node_manager_test.dart
+++ b/pkg/analysis_server/test/index/page_node_manager_test.dart
@@ -83,11 +83,19 @@ _treeWithPageNodeManager() {
@ReflectiveTestCase()
class _CachingNodeManagerTest {
- NodeManager<int, String, int> delegate = new _NodeManagerMock<int, String, int>();
+ _NodeManagerMock<int, String, int> delegate = new _NodeManagerMock<int,
+ String, int>();
NodeManager<int, String, int> manager;
void setUp() {
+ when(delegate.writeIndex).thenReturn((key, value) {
+ delegate.writeIndex(key, value);
+ });
+ when(delegate.writeLeaf).thenReturn((key, value) {
+ delegate.writeLeaf(key, value);
+ });
manager = new CachingNodeManager<int, String, int>(delegate, 4, 4);
+ resetInteractions(delegate);
}
void test_maxIndexKeys() {
@@ -161,11 +169,7 @@ class _CachingNodeManagerTest {
manager.writeIndex(3, data);
manager.writeIndex(4, data);
manager.writeIndex(1, data);
- // TODO(scheglov) method pointers don't work with mocks
- // TODO(scheglov) add resetInteractions(mock)
- // TODO(scheglov) verifyZeroInteractions() should accept 'dynamic'
-// verifyZeroInteractions(delegate as TypedMock);
- verify(delegate.writeIndex(anyInt, anyObject)).never();
+ verifyZeroInteractions(delegate);
// only 4 nodes can be cached, 5-th one cause write to the delegate
manager.writeIndex(5, data);
verify(delegate.writeIndex(2, data)).once();
@@ -178,11 +182,7 @@ class _CachingNodeManagerTest {
manager.writeLeaf(3, data);
manager.writeLeaf(4, data);
manager.writeLeaf(1, data);
- // TODO(scheglov) method pointers don't work with mocks
- // TODO(scheglov) add resetInteractions(mock)
- // TODO(scheglov) verifyZeroInteractions() should accept 'dynamic'
-// verifyZeroInteractions(delegate as TypedMock);
- verify(delegate.writeLeaf(anyInt, anyObject)).never();
+ verifyZeroInteractions(delegate);
// only 4 nodes can be cached, 5-th one cause write to the delegate
manager.writeLeaf(5, data);
verify(delegate.writeLeaf(2, data)).once();
@@ -290,7 +290,8 @@ class _MemoryPageManagerTest {
-class _NodeManagerMock<K, V, N> extends TypedMock implements NodeManager<K, V, N> {
+class _NodeManagerMock<K, V, N> extends TypedMock implements NodeManager<K, V,
+ N> {
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
« no previous file with comments | « pkg/analysis_server/test/index/lru_cache_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698