| OLD | NEW |
| 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/thread_task_runner_handle.h" |
| 6 #include "base/values.h" | 7 #include "base/values.h" |
| 7 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 8 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 8 #include "content/child/indexed_db/indexed_db_key_builders.h" | 9 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| 9 #include "content/child/indexed_db/webidbcursor_impl.h" | 10 #include "content/child/indexed_db/webidbcursor_impl.h" |
| 10 #include "content/child/thread_safe_sender.h" | 11 #include "content/child/thread_safe_sender.h" |
| 11 #include "content/common/indexed_db/indexed_db_key.h" | 12 #include "content/common/indexed_db/indexed_db_key.h" |
| 12 #include "ipc/ipc_sync_message_filter.h" | 13 #include "ipc/ipc_sync_message_filter.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/WebKit/public/platform/WebData.h" | 15 #include "third_party/WebKit/public/platform/WebData.h" |
| 15 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCallbacks.h
" | 16 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCallbacks.h
" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace | 118 } // namespace |
| 118 | 119 |
| 119 class WebIDBCursorImplTest : public testing::Test { | 120 class WebIDBCursorImplTest : public testing::Test { |
| 120 public: | 121 public: |
| 121 WebIDBCursorImplTest() { | 122 WebIDBCursorImplTest() { |
| 122 null_key_.assignNull(); | 123 null_key_.assignNull(); |
| 123 sync_message_filter_ = new IPC::SyncMessageFilter(NULL); | 124 sync_message_filter_ = new IPC::SyncMessageFilter(NULL); |
| 124 thread_safe_sender_ = new ThreadSafeSender( | 125 thread_safe_sender_ = new ThreadSafeSender( |
| 125 base::MessageLoopProxy::current(), sync_message_filter_.get()); | 126 base::ThreadTaskRunnerHandle::Get(), sync_message_filter_.get()); |
| 126 dispatcher_ = | 127 dispatcher_ = |
| 127 make_scoped_ptr(new MockDispatcher(thread_safe_sender_.get())); | 128 make_scoped_ptr(new MockDispatcher(thread_safe_sender_.get())); |
| 128 } | 129 } |
| 129 | 130 |
| 130 protected: | 131 protected: |
| 131 base::MessageLoop message_loop_; | 132 base::MessageLoop message_loop_; |
| 132 WebIDBKey null_key_; | 133 WebIDBKey null_key_; |
| 133 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 134 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 134 scoped_ptr<MockDispatcher> dispatcher_; | 135 scoped_ptr<MockDispatcher> dispatcher_; |
| 135 | 136 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // The real dispatcher would call cursor->CachedContinue(), so do that: | 322 // The real dispatcher would call cursor->CachedContinue(), so do that: |
| 322 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks()); | 323 scoped_ptr<WebIDBCallbacks> callbacks(new MockContinueCallbacks()); |
| 323 cursor.CachedContinue(callbacks.get()); | 324 cursor.CachedContinue(callbacks.get()); |
| 324 | 325 |
| 325 // Now the cursor should have reset the rest of the cache. | 326 // Now the cursor should have reset the rest of the cache. |
| 326 EXPECT_EQ(1, dispatcher_->reset_calls()); | 327 EXPECT_EQ(1, dispatcher_->reset_calls()); |
| 327 EXPECT_EQ(1, dispatcher_->last_used_count()); | 328 EXPECT_EQ(1, dispatcher_->last_used_count()); |
| 328 } | 329 } |
| 329 | 330 |
| 330 } // namespace content | 331 } // namespace content |
| OLD | NEW |