| 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 "content/browser/indexed_db/indexed_db_fake_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore() | 11 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore() |
| 12 : IndexedDBBackingStore(NULL, | 12 : IndexedDBBackingStore(NULL, |
| 13 GURL("http://localhost:81"), | 13 GURL("http://localhost:81"), |
| 14 scoped_ptr<LevelDBDatabase>(), | 14 scoped_ptr<LevelDBDatabase>(), |
| 15 scoped_ptr<LevelDBComparator>(), | 15 scoped_ptr<LevelDBComparator>(), |
| 16 NULL) {} | 16 NULL) {} |
| 17 | 17 |
| 18 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore( | 18 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore( |
| 19 IndexedDBFactory* factory, | 19 IndexedDBFactory* factory, |
| 20 base::TaskRunner* task_runner) | 20 base::TaskRunner* task_runner) |
| 21 : IndexedDBBackingStore(factory, | 21 : IndexedDBBackingStore(factory, |
| 22 GURL("http://localhost:81"), | 22 GURL("http://localhost:81"), |
| 23 scoped_ptr<LevelDBDatabase>(), | 23 scoped_ptr<LevelDBDatabase>(), |
| 24 scoped_ptr<LevelDBComparator>(), | 24 scoped_ptr<LevelDBComparator>(), |
| 25 task_runner) {} | 25 task_runner) {} |
| 26 | 26 |
| 27 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {} | 27 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {} |
| 28 | 28 |
| 29 std::vector<base::string16> IndexedDBFakeBackingStore::GetDatabaseNames() { | 29 std::vector<base::string16> IndexedDBFakeBackingStore::GetDatabaseNames( |
| 30 leveldb::Status* s) { |
| 31 *s = leveldb::Status::OK(); |
| 30 return std::vector<base::string16>(); | 32 return std::vector<base::string16>(); |
| 31 } | 33 } |
| 32 leveldb::Status IndexedDBFakeBackingStore::GetIDBDatabaseMetaData( | 34 leveldb::Status IndexedDBFakeBackingStore::GetIDBDatabaseMetaData( |
| 33 const base::string16& name, | 35 const base::string16& name, |
| 34 IndexedDBDatabaseMetadata*, | 36 IndexedDBDatabaseMetadata*, |
| 35 bool* found) { | 37 bool* found) { |
| 36 return leveldb::Status::OK(); | 38 return leveldb::Status::OK(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 leveldb::Status IndexedDBFakeBackingStore::CreateIDBDatabaseMetaData( | 41 leveldb::Status IndexedDBFakeBackingStore::CreateIDBDatabaseMetaData( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 133 |
| 132 void IndexedDBFakeBackingStore::ReportBlobUnused(int64 database_id, | 134 void IndexedDBFakeBackingStore::ReportBlobUnused(int64 database_id, |
| 133 int64 blob_key) {} | 135 int64 blob_key) {} |
| 134 | 136 |
| 135 scoped_ptr<IndexedDBBackingStore::Cursor> | 137 scoped_ptr<IndexedDBBackingStore::Cursor> |
| 136 IndexedDBFakeBackingStore::OpenObjectStoreKeyCursor( | 138 IndexedDBFakeBackingStore::OpenObjectStoreKeyCursor( |
| 137 IndexedDBBackingStore::Transaction* transaction, | 139 IndexedDBBackingStore::Transaction* transaction, |
| 138 int64 database_id, | 140 int64 database_id, |
| 139 int64 object_store_id, | 141 int64 object_store_id, |
| 140 const IndexedDBKeyRange& key_range, | 142 const IndexedDBKeyRange& key_range, |
| 141 indexed_db::CursorDirection) { | 143 indexed_db::CursorDirection, |
| 144 leveldb::Status* s) { |
| 142 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 145 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
| 143 } | 146 } |
| 144 scoped_ptr<IndexedDBBackingStore::Cursor> | 147 scoped_ptr<IndexedDBBackingStore::Cursor> |
| 145 IndexedDBFakeBackingStore::OpenObjectStoreCursor( | 148 IndexedDBFakeBackingStore::OpenObjectStoreCursor( |
| 146 IndexedDBBackingStore::Transaction* transaction, | 149 IndexedDBBackingStore::Transaction* transaction, |
| 147 int64 database_id, | 150 int64 database_id, |
| 148 int64 object_store_id, | 151 int64 object_store_id, |
| 149 const IndexedDBKeyRange& key_range, | 152 const IndexedDBKeyRange& key_range, |
| 150 indexed_db::CursorDirection) { | 153 indexed_db::CursorDirection, |
| 154 leveldb::Status* s) { |
| 151 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 155 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
| 152 } | 156 } |
| 153 scoped_ptr<IndexedDBBackingStore::Cursor> | 157 scoped_ptr<IndexedDBBackingStore::Cursor> |
| 154 IndexedDBFakeBackingStore::OpenIndexKeyCursor( | 158 IndexedDBFakeBackingStore::OpenIndexKeyCursor( |
| 155 IndexedDBBackingStore::Transaction* transaction, | 159 IndexedDBBackingStore::Transaction* transaction, |
| 156 int64 database_id, | 160 int64 database_id, |
| 157 int64 object_store_id, | 161 int64 object_store_id, |
| 158 int64 index_id, | 162 int64 index_id, |
| 159 const IndexedDBKeyRange& key_range, | 163 const IndexedDBKeyRange& key_range, |
| 160 indexed_db::CursorDirection) { | 164 indexed_db::CursorDirection, |
| 165 leveldb::Status* s) { |
| 161 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 166 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
| 162 } | 167 } |
| 163 scoped_ptr<IndexedDBBackingStore::Cursor> | 168 scoped_ptr<IndexedDBBackingStore::Cursor> |
| 164 IndexedDBFakeBackingStore::OpenIndexCursor( | 169 IndexedDBFakeBackingStore::OpenIndexCursor( |
| 165 IndexedDBBackingStore::Transaction* transaction, | 170 IndexedDBBackingStore::Transaction* transaction, |
| 166 int64 database_id, | 171 int64 database_id, |
| 167 int64 object_store_id, | 172 int64 object_store_id, |
| 168 int64 index_id, | 173 int64 index_id, |
| 169 const IndexedDBKeyRange& key_range, | 174 const IndexedDBKeyRange& key_range, |
| 170 indexed_db::CursorDirection) { | 175 indexed_db::CursorDirection, |
| 176 leveldb::Status* s) { |
| 171 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 177 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
| 172 } | 178 } |
| 173 | 179 |
| 174 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(bool result) | 180 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(bool result) |
| 175 : IndexedDBBackingStore::Transaction(NULL), result_(result) {} | 181 : IndexedDBBackingStore::Transaction(NULL), result_(result) {} |
| 176 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} | 182 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} |
| 177 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::Commit() { | 183 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::Commit() { |
| 178 if (result_) | 184 if (result_) |
| 179 return leveldb::Status::OK(); | 185 return leveldb::Status::OK(); |
| 180 else | 186 else |
| 181 return leveldb::Status::IOError("test error"); | 187 return leveldb::Status::IOError("test error"); |
| 182 } | 188 } |
| 183 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} | 189 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} |
| 184 | 190 |
| 185 } // namespace content | 191 } // namespace content |
| OLD | NEW |