Roll DEPS for PDFium to 19ae17578f99621100a26dac3e2c7c3dbf7c7cd1
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_fake_backing_store.h
blob9a4fd0927a691968e8a4fee721dbf38be92503be
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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_
8 #include <vector>
10 #include "content/browser/indexed_db/indexed_db_backing_store.h"
12 namespace base {
13 class SequencedTaskRunner;
16 namespace content {
18 class IndexedDBFactory;
20 class IndexedDBFakeBackingStore : public IndexedDBBackingStore {
21 public:
22 IndexedDBFakeBackingStore();
23 IndexedDBFakeBackingStore(IndexedDBFactory* factory,
24 base::SequencedTaskRunner* task_runner);
25 std::vector<base::string16> GetDatabaseNames(leveldb::Status* s) override;
26 leveldb::Status GetIDBDatabaseMetaData(const base::string16& name,
27 IndexedDBDatabaseMetadata*,
28 bool* found) override;
29 leveldb::Status CreateIDBDatabaseMetaData(const base::string16& name,
30 const base::string16& version,
31 int64 int_version,
32 int64* row_id) override;
33 bool UpdateIDBDatabaseIntVersion(Transaction*,
34 int64 row_id,
35 int64 version) override;
36 leveldb::Status DeleteDatabase(const base::string16& name) override;
38 leveldb::Status CreateObjectStore(Transaction*,
39 int64 database_id,
40 int64 object_store_id,
41 const base::string16& name,
42 const IndexedDBKeyPath&,
43 bool auto_increment) override;
45 leveldb::Status DeleteObjectStore(Transaction* transaction,
46 int64 database_id,
47 int64 object_store_id) override;
49 leveldb::Status PutRecord(IndexedDBBackingStore::Transaction* transaction,
50 int64 database_id,
51 int64 object_store_id,
52 const IndexedDBKey& key,
53 IndexedDBValue* value,
54 ScopedVector<storage::BlobDataHandle>* handles,
55 RecordIdentifier* record) override;
57 leveldb::Status ClearObjectStore(Transaction*,
58 int64 database_id,
59 int64 object_store_id) override;
60 leveldb::Status DeleteRecord(Transaction*,
61 int64 database_id,
62 int64 object_store_id,
63 const RecordIdentifier&) override;
64 leveldb::Status GetKeyGeneratorCurrentNumber(Transaction*,
65 int64 database_id,
66 int64 object_store_id,
67 int64* current_number) override;
68 leveldb::Status MaybeUpdateKeyGeneratorCurrentNumber(
69 Transaction*,
70 int64 database_id,
71 int64 object_store_id,
72 int64 new_number,
73 bool check_current) override;
74 leveldb::Status KeyExistsInObjectStore(
75 Transaction*,
76 int64 database_id,
77 int64 object_store_id,
78 const IndexedDBKey&,
79 RecordIdentifier* found_record_identifier,
80 bool* found) override;
82 leveldb::Status CreateIndex(Transaction*,
83 int64 database_id,
84 int64 object_store_id,
85 int64 index_id,
86 const base::string16& name,
87 const IndexedDBKeyPath&,
88 bool is_unique,
89 bool is_multi_entry) override;
90 leveldb::Status DeleteIndex(Transaction*,
91 int64 database_id,
92 int64 object_store_id,
93 int64 index_id) override;
94 leveldb::Status PutIndexDataForRecord(Transaction*,
95 int64 database_id,
96 int64 object_store_id,
97 int64 index_id,
98 const IndexedDBKey&,
99 const RecordIdentifier&) override;
100 void ReportBlobUnused(int64 database_id, int64 blob_key) override;
101 scoped_ptr<Cursor> OpenObjectStoreKeyCursor(
102 Transaction* transaction,
103 int64 database_id,
104 int64 object_store_id,
105 const IndexedDBKeyRange& key_range,
106 blink::WebIDBCursorDirection,
107 leveldb::Status*) override;
108 scoped_ptr<Cursor> OpenObjectStoreCursor(Transaction* transaction,
109 int64 database_id,
110 int64 object_store_id,
111 const IndexedDBKeyRange& key_range,
112 blink::WebIDBCursorDirection,
113 leveldb::Status*) override;
114 scoped_ptr<Cursor> OpenIndexKeyCursor(Transaction* transaction,
115 int64 database_id,
116 int64 object_store_id,
117 int64 index_id,
118 const IndexedDBKeyRange& key_range,
119 blink::WebIDBCursorDirection,
120 leveldb::Status*) override;
121 scoped_ptr<Cursor> OpenIndexCursor(Transaction* transaction,
122 int64 database_id,
123 int64 object_store_id,
124 int64 index_id,
125 const IndexedDBKeyRange& key_range,
126 blink::WebIDBCursorDirection,
127 leveldb::Status*) override;
129 class FakeTransaction : public IndexedDBBackingStore::Transaction {
130 public:
131 explicit FakeTransaction(leveldb::Status phase_two_result);
132 void Begin() override;
133 leveldb::Status CommitPhaseOne(scoped_refptr<BlobWriteCallback>) override;
134 leveldb::Status CommitPhaseTwo() override;
135 void Rollback() override;
137 private:
138 leveldb::Status result_;
140 DISALLOW_COPY_AND_ASSIGN(FakeTransaction);
143 protected:
144 friend class base::RefCounted<IndexedDBFakeBackingStore>;
145 ~IndexedDBFakeBackingStore() override;
147 private:
148 DISALLOW_COPY_AND_ASSIGN(IndexedDBFakeBackingStore);
151 } // namespace content
153 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_