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