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

Unified Diff: trunk/src/content/child/indexed_db/webidbcursor_impl_unittest.cc

Issue 126263003: Revert 243344 "IndexedDB: Fix cursor prefetching edge cases" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | « trunk/src/content/child/indexed_db/webidbcursor_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/child/indexed_db/webidbcursor_impl_unittest.cc
===================================================================
--- trunk/src/content/child/indexed_db/webidbcursor_impl_unittest.cc (revision 243358)
+++ trunk/src/content/child/indexed_db/webidbcursor_impl_unittest.cc (working copy)
@@ -30,8 +30,6 @@
: IndexedDBDispatcher(thread_safe_sender),
prefetch_calls_(0),
last_prefetch_count_(0),
- reset_calls_(0),
- last_used_count_(0),
advance_calls_(0),
continue_calls_(0),
destroyed_cursor_id_(0) {}
@@ -44,13 +42,6 @@
callbacks_.reset(callbacks);
}
- virtual void RequestIDBCursorPrefetchReset(int used_prefetches,
- int unused_prefetches,
- int32 ipc_cursor_id) OVERRIDE {
- ++reset_calls_;
- last_used_count_ = used_prefetches;
- }
-
virtual void RequestIDBCursorAdvance(unsigned long count,
WebIDBCallbacks* callbacks,
int32 ipc_cursor_id) OVERRIDE {
@@ -71,18 +62,14 @@
}
int prefetch_calls() { return prefetch_calls_; }
- int last_prefetch_count() { return last_prefetch_count_; }
- int reset_calls() { return reset_calls_; }
- int last_used_count() { return last_used_count_; }
int advance_calls() { return advance_calls_; }
int continue_calls() { return continue_calls_; }
+ int last_prefetch_count() { return last_prefetch_count_; }
int32 destroyed_cursor_id() { return destroyed_cursor_id_; }
private:
int prefetch_calls_;
int last_prefetch_count_;
- int reset_calls_;
- int last_used_count_;
int advance_calls_;
int continue_calls_;
int32 destroyed_cursor_id_;
@@ -260,47 +247,4 @@
dispatcher_->continue_calls());
}
-TEST_F(WebIDBCursorImplTest, PrefetchReset) {
- WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId,
- thread_safe_sender_.get());
-
- // Call continue() until prefetching should kick in.
- int continue_calls = 0;
- EXPECT_EQ(dispatcher_->continue_calls(), 0);
- for (int i = 0; i < WebIDBCursorImpl::kPrefetchContinueThreshold; ++i) {
- cursor.continueFunction(null_key_, new MockContinueCallbacks());
- EXPECT_EQ(++continue_calls, dispatcher_->continue_calls());
- EXPECT_EQ(0, dispatcher_->prefetch_calls());
- }
-
- // Initiate the prefetch
- cursor.continueFunction(null_key_, new MockContinueCallbacks());
- EXPECT_EQ(continue_calls, dispatcher_->continue_calls());
- EXPECT_EQ(1, dispatcher_->prefetch_calls());
- EXPECT_EQ(0, dispatcher_->reset_calls());
-
- // Now invalidate it
- cursor.ResetPrefetchCache();
-
- // No reset should have been sent since nothing has been received yet.
- EXPECT_EQ(0, dispatcher_->reset_calls());
-
- // Fill the prefetch cache as requested.
- int prefetch_count = dispatcher_->last_prefetch_count();
- std::vector<IndexedDBKey> keys(prefetch_count);
- std::vector<IndexedDBKey> primary_keys(prefetch_count);
- std::vector<WebData> values(prefetch_count);
- cursor.SetPrefetchData(keys, primary_keys, values);
-
- // No reset should have been sent since prefetch data hasn't been used.
- EXPECT_EQ(0, dispatcher_->reset_calls());
-
- // The real dispatcher would call cursor->CachedContinue(), so do that:
- cursor.CachedContinue(new MockContinueCallbacks());
-
- // Now the cursor should have reset the rest of the cache.
- EXPECT_EQ(1, dispatcher_->reset_calls());
- EXPECT_EQ(1, dispatcher_->last_used_count());
-}
-
} // namespace content
« no previous file with comments | « trunk/src/content/child/indexed_db/webidbcursor_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698