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/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" |
| 9 #include "content/child/thread_safe_sender.h" |
8 #include "content/common/indexed_db/indexed_db_key.h" | 10 #include "content/common/indexed_db/indexed_db_key.h" |
| 11 #include "ipc/ipc_sync_message_filter.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/WebKit/public/platform/WebData.h" | 13 #include "third_party/WebKit/public/platform/WebData.h" |
11 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" | 14 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" |
12 | 15 |
13 using WebKit::WebData; | 16 using WebKit::WebData; |
14 using WebKit::WebIDBCallbacks; | 17 using WebKit::WebIDBCallbacks; |
15 using WebKit::WebIDBDatabase; | 18 using WebKit::WebIDBDatabase; |
16 using WebKit::WebIDBDatabaseError; | 19 using WebKit::WebIDBDatabaseError; |
17 using WebKit::WebIDBKey; | 20 using WebKit::WebIDBKey; |
18 using WebKit::WebVector; | 21 using WebKit::WebVector; |
(...skipping 17 matching lines...) Expand all Loading... |
36 | 39 |
37 } // namespace | 40 } // namespace |
38 | 41 |
39 TEST(IndexedDBDispatcherTest, ValueSizeTest) { | 42 TEST(IndexedDBDispatcherTest, ValueSizeTest) { |
40 const std::vector<char> data(kMaxIDBValueSizeInBytes + 1); | 43 const std::vector<char> data(kMaxIDBValueSizeInBytes + 1); |
41 const WebData value(&data.front(), data.size()); | 44 const WebData value(&data.front(), data.size()); |
42 const int32 ipc_dummy_id = -1; | 45 const int32 ipc_dummy_id = -1; |
43 const int64 transaction_id = 1; | 46 const int64 transaction_id = 1; |
44 const int64 object_store_id = 2; | 47 const int64 object_store_id = 2; |
45 | 48 |
| 49 scoped_refptr<base::MessageLoopProxy> message_loop_proxy( |
| 50 base::MessageLoopProxy::current()); |
| 51 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter( |
| 52 new IPC::SyncMessageFilter(NULL)); |
| 53 scoped_refptr<ThreadSafeSender> thread_safe_sender(new ThreadSafeSender( |
| 54 message_loop_proxy, sync_message_filter)); |
| 55 |
46 MockCallbacks callbacks; | 56 MockCallbacks callbacks; |
47 IndexedDBDispatcher dispatcher; | 57 IndexedDBDispatcher dispatcher(thread_safe_sender); |
48 IndexedDBKey key(0, WebIDBKey::NumberType); | 58 IndexedDBKey key(0, WebIDBKey::NumberType); |
49 dispatcher.RequestIDBDatabasePut(ipc_dummy_id, | 59 dispatcher.RequestIDBDatabasePut(ipc_dummy_id, |
50 transaction_id, | 60 transaction_id, |
51 object_store_id, | 61 object_store_id, |
52 value, | 62 value, |
53 key, | 63 key, |
54 WebIDBDatabase::AddOrUpdate, | 64 WebIDBDatabase::AddOrUpdate, |
55 &callbacks, | 65 &callbacks, |
56 WebVector<long long>(), | 66 WebVector<long long>(), |
57 WebVector<WebVector<WebIDBKey> >()); | 67 WebVector<WebVector<WebIDBKey> >()); |
58 | 68 |
59 EXPECT_TRUE(callbacks.error_seen()); | 69 EXPECT_TRUE(callbacks.error_seen()); |
60 } | 70 } |
61 | 71 |
62 } // namespace content | 72 } // namespace content |
OLD | NEW |