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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore() | 12 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore() |
13 : IndexedDBBackingStore(NULL, | 13 : IndexedDBBackingStore(NULL /* indexed_db_factory */, |
14 GURL("http://localhost:81"), | 14 GURL("http://localhost:81"), |
15 base::FilePath(), | 15 base::FilePath(), |
16 NULL, | 16 NULL /* request_context */, |
17 scoped_ptr<LevelDBDatabase>(), | 17 scoped_ptr<LevelDBDatabase>(), |
18 scoped_ptr<LevelDBComparator>(), | 18 scoped_ptr<LevelDBComparator>(), |
19 NULL) {} | 19 NULL) { |
20 | 20 } |
21 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore( | 21 IndexedDBFakeBackingStore::IndexedDBFakeBackingStore( |
22 IndexedDBFactory* factory, | 22 IndexedDBFactory* factory, |
23 base::TaskRunner* task_runner) | 23 base::TaskRunner* task_runner) |
24 : IndexedDBBackingStore(factory, | 24 : IndexedDBBackingStore(factory, |
25 GURL("http://localhost:81"), | 25 GURL("http://localhost:81"), |
26 base::FilePath(), | 26 base::FilePath(), |
27 NULL, | 27 NULL /* request_context */, |
28 scoped_ptr<LevelDBDatabase>(), | 28 scoped_ptr<LevelDBDatabase>(), |
29 scoped_ptr<LevelDBComparator>(), | 29 scoped_ptr<LevelDBComparator>(), |
30 task_runner) {} | 30 task_runner) { |
31 | 31 } |
32 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {} | 32 IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {} |
33 | 33 |
34 std::vector<base::string16> IndexedDBFakeBackingStore::GetDatabaseNames( | 34 std::vector<base::string16> IndexedDBFakeBackingStore::GetDatabaseNames( |
35 leveldb::Status* s) { | 35 leveldb::Status* s) { |
36 *s = leveldb::Status::OK(); | 36 *s = leveldb::Status::OK(); |
37 return std::vector<base::string16>(); | 37 return std::vector<base::string16>(); |
38 } | 38 } |
39 leveldb::Status IndexedDBFakeBackingStore::GetIDBDatabaseMetaData( | 39 leveldb::Status IndexedDBFakeBackingStore::GetIDBDatabaseMetaData( |
40 const base::string16& name, | 40 const base::string16& name, |
41 IndexedDBDatabaseMetadata*, | 41 IndexedDBDatabaseMetadata*, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 IndexedDBBackingStore::Transaction* transaction, | 175 IndexedDBBackingStore::Transaction* transaction, |
176 int64 database_id, | 176 int64 database_id, |
177 int64 object_store_id, | 177 int64 object_store_id, |
178 int64 index_id, | 178 int64 index_id, |
179 const IndexedDBKeyRange& key_range, | 179 const IndexedDBKeyRange& key_range, |
180 indexed_db::CursorDirection, | 180 indexed_db::CursorDirection, |
181 leveldb::Status* s) { | 181 leveldb::Status* s) { |
182 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 182 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
183 } | 183 } |
184 | 184 |
185 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(bool result) | 185 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction( |
186 : IndexedDBBackingStore::Transaction(NULL), result_(result) {} | 186 leveldb::Status result) |
| 187 : IndexedDBBackingStore::Transaction(NULL), result_(result) { |
| 188 } |
187 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} | 189 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} |
188 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::Commit() { | 190 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseOne( |
189 if (result_) | 191 scoped_refptr<BlobWriteCallback> callback) { |
190 return leveldb::Status::OK(); | 192 callback->Run(true); |
191 else | 193 return leveldb::Status::OK(); |
192 return leveldb::Status::IOError("test error"); | 194 } |
| 195 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseTwo() { |
| 196 return result_; |
193 } | 197 } |
194 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} | 198 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} |
195 | 199 |
196 } // namespace content | 200 } // namespace content |
OLD | NEW |