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/memory/scoped_ptr.h"
11 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {}
13 std::vector
<base::string16
> IndexedDBFakeBackingStore::GetDatabaseNames() {
14 return std::vector
<base::string16
>();
16 leveldb::Status
IndexedDBFakeBackingStore::GetIDBDatabaseMetaData(
17 const base::string16
& name
,
18 IndexedDBDatabaseMetadata
*,
20 return leveldb::Status::OK();
23 leveldb::Status
IndexedDBFakeBackingStore::CreateIDBDatabaseMetaData(
24 const base::string16
& name
,
25 const base::string16
& version
,
28 return leveldb::Status::OK();
30 bool IndexedDBFakeBackingStore::UpdateIDBDatabaseIntVersion(Transaction
*,
35 leveldb::Status
IndexedDBFakeBackingStore::DeleteDatabase(
36 const base::string16
& name
) {
37 return leveldb::Status::OK();
40 leveldb::Status
IndexedDBFakeBackingStore::CreateObjectStore(
43 int64 object_store_id
,
44 const base::string16
& name
,
45 const IndexedDBKeyPath
&,
46 bool auto_increment
) {
47 return leveldb::Status::IOError("test error");
50 leveldb::Status
IndexedDBFakeBackingStore::ClearObjectStore(
53 int64 object_store_id
) {
54 return leveldb::Status::IOError("test error");
56 leveldb::Status
IndexedDBFakeBackingStore::DeleteRecord(
59 int64 object_store_id
,
60 const RecordIdentifier
&) {
61 return leveldb::Status::IOError("test error");
63 leveldb::Status
IndexedDBFakeBackingStore::GetKeyGeneratorCurrentNumber(
66 int64 object_store_id
,
67 int64
* current_number
) {
68 return leveldb::Status::OK();
70 leveldb::Status
IndexedDBFakeBackingStore::MaybeUpdateKeyGeneratorCurrentNumber(
73 int64 object_store_id
,
76 return leveldb::Status::OK();
78 leveldb::Status
IndexedDBFakeBackingStore::KeyExistsInObjectStore(
81 int64 object_store_id
,
83 RecordIdentifier
* found_record_identifier
,
85 return leveldb::Status::OK();
88 leveldb::Status
IndexedDBFakeBackingStore::CreateIndex(
91 int64 object_store_id
,
93 const base::string16
& name
,
94 const IndexedDBKeyPath
&,
96 bool is_multi_entry
) {
97 return leveldb::Status::IOError("test error");
100 leveldb::Status
IndexedDBFakeBackingStore::DeleteIndex(Transaction
*,
102 int64 object_store_id
,
104 return leveldb::Status::IOError("test error");
106 leveldb::Status
IndexedDBFakeBackingStore::PutIndexDataForRecord(
109 int64 object_store_id
,
112 const RecordIdentifier
&) {
113 return leveldb::Status::IOError("test error");
116 scoped_ptr
<IndexedDBBackingStore::Cursor
>
117 IndexedDBFakeBackingStore::OpenObjectStoreKeyCursor(
118 IndexedDBBackingStore::Transaction
* transaction
,
120 int64 object_store_id
,
121 const IndexedDBKeyRange
& key_range
,
122 indexed_db::CursorDirection
) {
123 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
125 scoped_ptr
<IndexedDBBackingStore::Cursor
>
126 IndexedDBFakeBackingStore::OpenObjectStoreCursor(
127 IndexedDBBackingStore::Transaction
* transaction
,
129 int64 object_store_id
,
130 const IndexedDBKeyRange
& key_range
,
131 indexed_db::CursorDirection
) {
132 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
134 scoped_ptr
<IndexedDBBackingStore::Cursor
>
135 IndexedDBFakeBackingStore::OpenIndexKeyCursor(
136 IndexedDBBackingStore::Transaction
* transaction
,
138 int64 object_store_id
,
140 const IndexedDBKeyRange
& key_range
,
141 indexed_db::CursorDirection
) {
142 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
144 scoped_ptr
<IndexedDBBackingStore::Cursor
>
145 IndexedDBFakeBackingStore::OpenIndexCursor(
146 IndexedDBBackingStore::Transaction
* transaction
,
148 int64 object_store_id
,
150 const IndexedDBKeyRange
& key_range
,
151 indexed_db::CursorDirection
) {
152 return scoped_ptr
<IndexedDBBackingStore::Cursor
>();
155 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(bool result
)
156 : IndexedDBBackingStore::Transaction(NULL
), result_(result
) {}
157 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {}
158 leveldb::Status
IndexedDBFakeBackingStore::FakeTransaction::Commit() {
160 return leveldb::Status::OK();
162 return leveldb::Status::IOError("test error");
164 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {}
166 } // namespace content