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
3 // found in the LICENSE file.
5 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h"
7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h"
12 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore()
13 : IndexedDBBackingStore(NULL
/* indexed_db_factory */,
14 GURL("http://localhost:81"),
16 NULL
/* request_context */,
17 scoped_ptr
<LevelDBDatabase
>(),
18 scoped_ptr
<LevelDBComparator
>(),
19 NULL
/* task_runner */) {
21 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore(
22 IndexedDBFactory
* factory
,
23 base::SequencedTaskRunner
* task_runner
)
24 : IndexedDBBackingStore(factory
,
25 GURL("http://localhost:81"),
27 NULL
/* request_context */,
28 scoped_ptr
<LevelDBDatabase
>(),
29 scoped_ptr
<LevelDBComparator
>(),
32 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {}
34 std::vector
<base::string16
> IndexedDBFakeBackingStore::GetDatabaseNames(
36 *s
= leveldb::Status::OK();
37 return std::vector
<base::string16
>();
39 leveldb::Status
IndexedDBFakeBackingStore::GetIDBDatabaseMetaData(
40 const base::string16
& name
,
41 IndexedDBDatabaseMetadata
*,
43 return leveldb::Status::OK();
46 leveldb::Status
IndexedDBFakeBackingStore::CreateIDBDatabaseMetaData(
47 const base::string16
& name
,
48 const base::string16
& version
,
51 return leveldb::Status::OK();
53 bool IndexedDBFakeBackingStore::UpdateIDBDatabaseIntVersion(Transaction
*,
58 leveldb::Status
IndexedDBFakeBackingStore::DeleteDatabase(
59 const base::string16
& name
) {
60 return leveldb::Status::OK();
63 leveldb::Status
IndexedDBFakeBackingStore::CreateObjectStore(
66 int64 object_store_id
,
67 const base::string16
& name
,
68 const IndexedDBKeyPath
&,
69 bool auto_increment
) {
70 return leveldb::Status::OK();
73 leveldb::Status
IndexedDBFakeBackingStore::DeleteObjectStore(
74 Transaction
* transaction
,
76 int64 object_store_id
) {
77 return leveldb::Status::OK();
80 leveldb::Status
IndexedDBFakeBackingStore::PutRecord(
81 IndexedDBBackingStore::Transaction
* transaction
,
83 int64 object_store_id
,
84 const IndexedDBKey
& key
,
85 IndexedDBValue
* value
,
86 ScopedVector
<storage::BlobDataHandle
>* handles
,
87 RecordIdentifier
* record
) {
88 return leveldb::Status::OK();
91 leveldb::Status
IndexedDBFakeBackingStore::ClearObjectStore(
94 int64 object_store_id
) {
95 return leveldb::Status::OK();
97 leveldb::Status
IndexedDBFakeBackingStore::DeleteRecord(
100 int64 object_store_id
,
101 const RecordIdentifier
&) {
102 return leveldb::Status::OK();
104 leveldb::Status
IndexedDBFakeBackingStore::GetKeyGeneratorCurrentNumber(
107 int64 object_store_id
,
108 int64
* current_number
) {
109 return leveldb::Status::OK();
111 leveldb::Status
IndexedDBFakeBackingStore::MaybeUpdateKeyGeneratorCurrentNumber(
114 int64 object_store_id
,
116 bool check_current
) {
117 return leveldb::Status::OK();
119 leveldb::Status
IndexedDBFakeBackingStore::KeyExistsInObjectStore(
122 int64 object_store_id
,
124 RecordIdentifier
* found_record_identifier
,
126 return leveldb::Status::OK();
129 leveldb::Status
IndexedDBFakeBackingStore::CreateIndex(
132 int64 object_store_id
,
134 const base::string16
& name
,
135 const IndexedDBKeyPath
&,
137 bool is_multi_entry
) {
138 return leveldb::Status::OK();
141 leveldb::Status
IndexedDBFakeBackingStore::DeleteIndex(Transaction
*,
143 int64 object_store_id
,
145 return leveldb::Status::OK();
147 leveldb::Status
IndexedDBFakeBackingStore::PutIndexDataForRecord(
150 int64 object_store_id
,
153 const RecordIdentifier
&) {
154 return leveldb::Status::OK();
157 void IndexedDBFakeBackingStore::ReportBlobUnused(int64 database_id
,
160 scoped_ptr
<IndexedDBBackingStore::Cursor
>
161 IndexedDBFakeBackingStore::OpenObjectStoreKeyCursor(
162 IndexedDBBackingStore::Transaction
* transaction
,
164 int64 object_store_id
,
165 const IndexedDBKeyRange
& key_range
,
166 blink::WebIDBCursorDirection
,
167 leveldb::Status
* s
) {
168 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
170 scoped_ptr
<IndexedDBBackingStore::Cursor
>
171 IndexedDBFakeBackingStore::OpenObjectStoreCursor(
172 IndexedDBBackingStore::Transaction
* transaction
,
174 int64 object_store_id
,
175 const IndexedDBKeyRange
& key_range
,
176 blink::WebIDBCursorDirection
,
177 leveldb::Status
* s
) {
178 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
180 scoped_ptr
<IndexedDBBackingStore::Cursor
>
181 IndexedDBFakeBackingStore::OpenIndexKeyCursor(
182 IndexedDBBackingStore::Transaction
* transaction
,
184 int64 object_store_id
,
186 const IndexedDBKeyRange
& key_range
,
187 blink::WebIDBCursorDirection
,
188 leveldb::Status
* s
) {
189 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
191 scoped_ptr
<IndexedDBBackingStore::Cursor
>
192 IndexedDBFakeBackingStore::OpenIndexCursor(
193 IndexedDBBackingStore::Transaction
* transaction
,
195 int64 object_store_id
,
197 const IndexedDBKeyRange
& key_range
,
198 blink::WebIDBCursorDirection
,
199 leveldb::Status
* s
) {
200 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
203 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(
204 leveldb::Status result
)
205 : IndexedDBBackingStore::Transaction(NULL
), result_(result
) {
207 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {}
208 leveldb::Status
IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseOne(
209 scoped_refptr
<BlobWriteCallback
> callback
) {
211 return leveldb::Status::OK();
213 leveldb::Status
IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseTwo() {
216 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {}
218 } // namespace content