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/message_loop/message_loop_proxy.h" | 6 #include "base/single_thread_task_runner.h" |
| 7 #include "base/thread_task_runner_handle.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
8 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 9 #include "content/child/indexed_db/indexed_db_dispatcher.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 "content/common/indexed_db/indexed_db_key_range.h" | 13 #include "content/common/indexed_db/indexed_db_key_range.h" |
13 #include "content/common/indexed_db/indexed_db_messages.h" | 14 #include "content/common/indexed_db/indexed_db_messages.h" |
14 #include "ipc/ipc_sync_message_filter.h" | 15 #include "ipc/ipc_sync_message_filter.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/WebKit/public/platform/WebBlobInfo.h" | 17 #include "third_party/WebKit/public/platform/WebBlobInfo.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 58 |
58 private: | 59 private: |
59 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); | 60 DISALLOW_COPY_AND_ASSIGN(MockDispatcher); |
60 }; | 61 }; |
61 | 62 |
62 } // namespace | 63 } // namespace |
63 | 64 |
64 class IndexedDBDispatcherTest : public testing::Test { | 65 class IndexedDBDispatcherTest : public testing::Test { |
65 public: | 66 public: |
66 IndexedDBDispatcherTest() | 67 IndexedDBDispatcherTest() |
67 : message_loop_proxy_(base::MessageLoopProxy::current()), | 68 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
68 sync_message_filter_(new IPC::SyncMessageFilter(NULL)), | 69 sync_message_filter_(new IPC::SyncMessageFilter(NULL)), |
69 thread_safe_sender_(new ThreadSafeSender(message_loop_proxy_.get(), | 70 thread_safe_sender_(new ThreadSafeSender(task_runner_.get(), |
70 sync_message_filter_.get())) {} | 71 sync_message_filter_.get())) {} |
71 | 72 |
72 void TearDown() override { blink::WebHeap::collectAllGarbageForTesting(); } | 73 void TearDown() override { blink::WebHeap::collectAllGarbageForTesting(); } |
73 | 74 |
74 protected: | 75 protected: |
75 base::MessageLoop message_loop_; | 76 base::MessageLoop message_loop_; |
76 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 77 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
77 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; | 78 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
78 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 79 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
79 | 80 |
80 private: | 81 private: |
81 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcherTest); | 82 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcherTest); |
82 }; | 83 }; |
83 | 84 |
84 TEST_F(IndexedDBDispatcherTest, ValueSizeTest) { | 85 TEST_F(IndexedDBDispatcherTest, ValueSizeTest) { |
85 const std::vector<char> data(kMaxIDBValueSizeInBytes + 1); | 86 const std::vector<char> data(kMaxIDBValueSizeInBytes + 1); |
86 const WebData value(&data.front(), data.size()); | 87 const WebData value(&data.front(), data.size()); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 cursor1_transaction_id); | 342 cursor1_transaction_id); |
342 | 343 |
343 EXPECT_EQ(2, cursor1->reset_count()); | 344 EXPECT_EQ(2, cursor1->reset_count()); |
344 EXPECT_EQ(0, cursor2->reset_count()); | 345 EXPECT_EQ(0, cursor2->reset_count()); |
345 | 346 |
346 cursor1.reset(); | 347 cursor1.reset(); |
347 cursor2.reset(); | 348 cursor2.reset(); |
348 } | 349 } |
349 | 350 |
350 } // namespace content | 351 } // namespace content |
OLD | NEW |