OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/indexed_db/indexed_db_dispatcher.h" | 7 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
8 #include "content/common/indexed_db/indexed_db_key.h" | 8 #include "content/common/indexed_db/indexed_db_key.h" |
9 #include "content/public/common/serialized_script_value.h" | 9 #include "content/public/common/serialized_script_value.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
14 | 14 |
15 using WebKit::WebVector; | 15 using WebKit::WebVector; |
16 using WebKit::WebString; | 16 using WebKit::WebString; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class FakeWebIDBTransaction : public WebKit::WebIDBTransaction { | 20 class FakeWebIDBTransaction : public WebKit::WebIDBTransaction { |
21 public: | 21 public: |
22 FakeWebIDBTransaction() {} | 22 FakeWebIDBTransaction() {} |
23 }; | 23 }; |
24 | 24 |
25 // TODO(alecflett): Reenable this test when IDB code in webkit | 25 // TODO(alecflett): Reenable this test when IDB code in webkit |
26 // enforces size limits. See http://crbug.com/160577 | 26 // enforces size limits. See http://crbug.com/160577 |
27 TEST(IndexedDBDispatcherTest, DISABLED_ValueSizeTest) { | 27 TEST(IndexedDBDispatcherTest, DISABLED_ValueSizeTest) { |
28 string16 data; | 28 string16 data; |
29 data.resize(kMaxIDBValueSizeInBytes / sizeof(char16) + 1, 'x'); | 29 data.resize(kMaxIDBValueSizeInBytes / sizeof(char16) + 1, 'x'); |
30 const bool kIsNull = false; | 30 WebKit::WebVector<unsigned char> value; |
31 const bool kIsInvalid = false; | |
32 const SerializedScriptValue value(kIsNull, kIsInvalid, data); | |
33 const int32 ipc_dummy_id = -1; | 31 const int32 ipc_dummy_id = -1; |
darin (slow to review)
2013/01/11 00:48:06
nit: constants are usually formatted as kFooBar
| |
32 const int64 transaction_id = 1; | |
33 const int64 object_store_id = 2; | |
34 | 34 |
35 { | 35 { |
36 IndexedDBDispatcher dispatcher; | 36 IndexedDBDispatcher dispatcher; |
37 IndexedDBKey key; | 37 IndexedDBKey key; |
38 key.SetNumber(0); | 38 key.SetNumber(0); |
39 dispatcher.RequestIDBObjectStorePut( | 39 dispatcher.RequestIDBDatabasePut( |
40 value, | 40 ipc_dummy_id, |
41 transaction_id, | |
42 object_store_id, | |
43 &value, | |
41 key, | 44 key, |
42 WebKit::WebIDBObjectStore::AddOrUpdate, | 45 WebKit::WebIDBDatabase::AddOrUpdate, |
43 static_cast<WebKit::WebIDBCallbacks*>(NULL), | 46 static_cast<WebKit::WebIDBCallbacks*>(NULL), |
44 ipc_dummy_id, | |
45 FakeWebIDBTransaction(), | |
46 WebVector<long long>(), | 47 WebVector<long long>(), |
47 WebVector<WebVector<WebKit::WebIDBKey> >()); | 48 WebVector<WebVector<WebKit::WebIDBKey> >()); |
48 } | 49 } |
49 } | 50 } |
50 | 51 |
51 } // namespace content | 52 } // namespace content |
OLD | NEW |