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

Side by Side Diff: content/child/indexed_db/webidbcursor_impl_unittest.cc

Issue 392263003: Enable WebIDBCursorImplTest.PrefetchTest and AdvancePrefectTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "content/child/indexed_db/indexed_db_dispatcher.h" 7 #include "content/child/indexed_db/indexed_db_dispatcher.h"
8 #include "content/child/indexed_db/indexed_db_key_builders.h" 8 #include "content/child/indexed_db/indexed_db_key_builders.h"
9 #include "content/child/indexed_db/webidbcursor_impl.h" 9 #include "content/child/indexed_db/webidbcursor_impl.h"
10 #include "content/child/thread_safe_sender.h" 10 #include "content/child/thread_safe_sender.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 WebIDBKey null_key_; 131 WebIDBKey null_key_;
132 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 132 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
133 scoped_ptr<MockDispatcher> dispatcher_; 133 scoped_ptr<MockDispatcher> dispatcher_;
134 134
135 private: 135 private:
136 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; 136 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(WebIDBCursorImplTest); 138 DISALLOW_COPY_AND_ASSIGN(WebIDBCursorImplTest);
139 }; 139 };
140 140
141 // Fails under Linux ASAN: crbug.com/389647 141 TEST_F(WebIDBCursorImplTest, PrefetchTest) {
142 #if defined(OS_LINUX)
143 #define MAYBE_PrefetchTest DISABLED_PrefetchTest
144 #else
145 #define MAYBE_PrefetchTest PrefetchTest
146 #endif
147 TEST_F(WebIDBCursorImplTest, MAYBE_PrefetchTest) {
148 const int64 transaction_id = 1; 142 const int64 transaction_id = 1;
149 { 143 {
150 WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId, 144 WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId,
151 transaction_id, 145 transaction_id,
152 thread_safe_sender_.get()); 146 thread_safe_sender_.get());
153 147
154 // Call continue() until prefetching should kick in. 148 // Call continue() until prefetching should kick in.
155 int continue_calls = 0; 149 int continue_calls = 0;
156 EXPECT_EQ(dispatcher_->continue_calls(), 0); 150 EXPECT_EQ(dispatcher_->continue_calls(), 0);
157 for (int i = 0; i < WebIDBCursorImpl::kPrefetchContinueThreshold; ++i) { 151 for (int i = 0; i < WebIDBCursorImpl::kPrefetchContinueThreshold; ++i) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EXPECT_EQ(expected_key, static_cast<int>(web_blob_info.size())); 201 EXPECT_EQ(expected_key, static_cast<int>(web_blob_info.size()));
208 EXPECT_EQ(expected_key++, key.number()); 202 EXPECT_EQ(expected_key++, key.number());
209 } 203 }
210 } 204 }
211 } 205 }
212 206
213 EXPECT_EQ(dispatcher_->destroyed_cursor_id(), 207 EXPECT_EQ(dispatcher_->destroyed_cursor_id(),
214 WebIDBCursorImpl::kInvalidCursorId); 208 WebIDBCursorImpl::kInvalidCursorId);
215 } 209 }
216 210
217 // Fails under Linux ASAN: crbug.com/389647 211 TEST_F(WebIDBCursorImplTest, AdvancePrefetchTest) {
218 #if defined(OS_LINUX)
219 #define MAYBE_AdvancePrefetchTest DISABLED_AdvancePrefetchTest
220 #else
221 #define MAYBE_AdvancePrefetchTest AdvancePrefetchTest
222 #endif
223 TEST_F(WebIDBCursorImplTest, MAYBE_AdvancePrefetchTest) {
224 const int64 transaction_id = 1; 212 const int64 transaction_id = 1;
225 WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId, 213 WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId,
226 transaction_id, 214 transaction_id,
227 thread_safe_sender_.get()); 215 thread_safe_sender_.get());
228 216
229 // Call continue() until prefetching should kick in. 217 // Call continue() until prefetching should kick in.
230 EXPECT_EQ(0, dispatcher_->continue_calls()); 218 EXPECT_EQ(0, dispatcher_->continue_calls());
231 for (int i = 0; i < WebIDBCursorImpl::kPrefetchContinueThreshold; ++i) { 219 for (int i = 0; i < WebIDBCursorImpl::kPrefetchContinueThreshold; ++i) {
232 cursor.continueFunction(null_key_, new MockContinueCallbacks()); 220 cursor.continueFunction(null_key_, new MockContinueCallbacks());
233 } 221 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // The real dispatcher would call cursor->CachedContinue(), so do that: 320 // The real dispatcher would call cursor->CachedContinue(), so do that:
333 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks()); 321 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks());
334 cursor.CachedContinue(callbacks.get()); 322 cursor.CachedContinue(callbacks.get());
335 323
336 // Now the cursor should have reset the rest of the cache. 324 // Now the cursor should have reset the rest of the cache.
337 EXPECT_EQ(1, dispatcher_->reset_calls()); 325 EXPECT_EQ(1, dispatcher_->reset_calls());
338 EXPECT_EQ(1, dispatcher_->last_used_count()); 326 EXPECT_EQ(1, dispatcher_->last_used_count());
339 } 327 }
340 328
341 } // namespace content 329 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698