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/message_loop/message_loop_proxy.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #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" | 9 #include "content/child/thread_safe_sender.h" |
10 #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" | 11 #include "ipc/ipc_sync_message_filter.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/WebKit/public/platform/WebData.h" | 13 #include "third_party/WebKit/public/platform/WebData.h" |
14 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" | 14 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" |
15 | 15 |
16 using WebKit::WebData; | 16 using blink::WebData; |
17 using WebKit::WebIDBCallbacks; | 17 using blink::WebIDBCallbacks; |
18 using WebKit::WebIDBDatabase; | 18 using blink::WebIDBDatabase; |
19 using WebKit::WebIDBDatabaseError; | 19 using blink::WebIDBDatabaseError; |
20 using WebKit::WebIDBKey; | 20 using blink::WebIDBKey; |
21 using WebKit::WebVector; | 21 using blink::WebVector; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 namespace { | 24 namespace { |
25 | 25 |
26 class MockCallbacks : public WebIDBCallbacks { | 26 class MockCallbacks : public WebIDBCallbacks { |
27 public: | 27 public: |
28 MockCallbacks() : error_seen_(false) {} | 28 MockCallbacks() : error_seen_(false) {} |
29 | 29 |
30 virtual void onError(const WebIDBDatabaseError&) OVERRIDE { | 30 virtual void onError(const WebIDBDatabaseError&) OVERRIDE { |
31 error_seen_ = true; | 31 error_seen_ = true; |
(...skipping 16 matching lines...) Expand all Loading... |
48 | 48 |
49 scoped_refptr<base::MessageLoopProxy> message_loop_proxy( | 49 scoped_refptr<base::MessageLoopProxy> message_loop_proxy( |
50 base::MessageLoopProxy::current()); | 50 base::MessageLoopProxy::current()); |
51 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter( | 51 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter( |
52 new IPC::SyncMessageFilter(NULL)); | 52 new IPC::SyncMessageFilter(NULL)); |
53 scoped_refptr<ThreadSafeSender> thread_safe_sender(new ThreadSafeSender( | 53 scoped_refptr<ThreadSafeSender> thread_safe_sender(new ThreadSafeSender( |
54 message_loop_proxy.get(), sync_message_filter.get())); | 54 message_loop_proxy.get(), sync_message_filter.get())); |
55 | 55 |
56 MockCallbacks callbacks; | 56 MockCallbacks callbacks; |
57 IndexedDBDispatcher dispatcher(thread_safe_sender.get()); | 57 IndexedDBDispatcher dispatcher(thread_safe_sender.get()); |
58 IndexedDBKey key(0, WebKit::WebIDBKeyTypeNumber); | 58 IndexedDBKey key(0, blink::WebIDBKeyTypeNumber); |
59 dispatcher.RequestIDBDatabasePut(ipc_dummy_id, | 59 dispatcher.RequestIDBDatabasePut(ipc_dummy_id, |
60 transaction_id, | 60 transaction_id, |
61 object_store_id, | 61 object_store_id, |
62 value, | 62 value, |
63 key, | 63 key, |
64 WebIDBDatabase::AddOrUpdate, | 64 WebIDBDatabase::AddOrUpdate, |
65 &callbacks, | 65 &callbacks, |
66 WebVector<long long>(), | 66 WebVector<long long>(), |
67 WebVector<WebVector<WebIDBKey> >()); | 67 WebVector<WebVector<WebIDBKey> >()); |
68 | 68 |
69 EXPECT_TRUE(callbacks.error_seen()); | 69 EXPECT_TRUE(callbacks.error_seen()); |
70 } | 70 } |
71 | 71 |
72 } // namespace content | 72 } // namespace content |
OLD | NEW |