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 /* task_runner */) { |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 IndexedDBBackingStore::Transaction* transaction, | 186 IndexedDBBackingStore::Transaction* transaction, |
187 int64 database_id, | 187 int64 database_id, |
188 int64 object_store_id, | 188 int64 object_store_id, |
189 int64 index_id, | 189 int64 index_id, |
190 const IndexedDBKeyRange& key_range, | 190 const IndexedDBKeyRange& key_range, |
191 indexed_db::CursorDirection, | 191 indexed_db::CursorDirection, |
192 leveldb::Status* s) { | 192 leveldb::Status* s) { |
193 return scoped_ptr<IndexedDBBackingStore::Cursor>(); | 193 return scoped_ptr<IndexedDBBackingStore::Cursor>(); |
194 } | 194 } |
195 | 195 |
196 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction(bool result) | 196 IndexedDBFakeBackingStore::FakeTransaction::FakeTransaction( |
197 : IndexedDBBackingStore::Transaction(NULL), result_(result) {} | 197 leveldb::Status result) |
| 198 : IndexedDBBackingStore::Transaction(NULL), result_(result) { |
| 199 } |
198 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} | 200 void IndexedDBFakeBackingStore::FakeTransaction::Begin() {} |
199 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::Commit() { | 201 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseOne( |
200 if (result_) | 202 scoped_refptr<BlobWriteCallback> callback) { |
201 return leveldb::Status::OK(); | 203 callback->Run(true); |
202 else | 204 return leveldb::Status::OK(); |
203 return leveldb::Status::IOError("test error"); | 205 } |
| 206 leveldb::Status IndexedDBFakeBackingStore::FakeTransaction::CommitPhaseTwo() { |
| 207 return result_; |
204 } | 208 } |
205 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} | 209 void IndexedDBFakeBackingStore::FakeTransaction::Rollback() {} |
206 | 210 |
207 } // namespace content | 211 } // namespace content |
OLD | NEW |