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_
10 #include "content/browser/indexed_db/indexed_db_backing_store.h"
14 class IndexedDBFakeBackingStore
: public IndexedDBBackingStore
{
16 IndexedDBFakeBackingStore()
17 : IndexedDBBackingStore(std::string(),
18 scoped_ptr
<LevelDBDatabase
>(),
19 scoped_ptr
<LevelDBComparator
>()) {}
20 virtual std::vector
<string16
> GetDatabaseNames() OVERRIDE
;
21 virtual bool GetIDBDatabaseMetaData(const string16
& name
,
22 IndexedDBDatabaseMetadata
*,
23 bool* found
) OVERRIDE
;
24 virtual bool CreateIDBDatabaseMetaData(const string16
& name
,
25 const string16
& version
,
27 int64
* row_id
) OVERRIDE
;
28 virtual bool UpdateIDBDatabaseMetaData(Transaction
*,
30 const string16
& version
) OVERRIDE
;
31 virtual bool UpdateIDBDatabaseIntVersion(Transaction
*,
33 int64 version
) OVERRIDE
;
34 virtual bool DeleteDatabase(const string16
& name
) OVERRIDE
;
36 virtual bool CreateObjectStore(Transaction
*,
38 int64 object_store_id
,
40 const IndexedDBKeyPath
&,
41 bool auto_increment
) OVERRIDE
;
43 virtual bool ClearObjectStore(Transaction
*,
45 int64 object_store_id
) OVERRIDE
;
46 virtual bool DeleteRecord(Transaction
*,
48 int64 object_store_id
,
49 const RecordIdentifier
&) OVERRIDE
;
50 virtual bool GetKeyGeneratorCurrentNumber(Transaction
*,
52 int64 object_store_id
,
53 int64
* current_number
) OVERRIDE
;
54 virtual bool MaybeUpdateKeyGeneratorCurrentNumber(Transaction
*,
56 int64 object_store_id
,
60 virtual bool KeyExistsInObjectStore(Transaction
*,
62 int64 object_store_id
,
64 RecordIdentifier
* found_record_identifier
,
65 bool* found
) OVERRIDE
;
67 virtual bool CreateIndex(Transaction
*,
69 int64 object_store_id
,
72 const IndexedDBKeyPath
&,
74 bool is_multi_entry
) OVERRIDE
;
75 virtual bool DeleteIndex(Transaction
*,
77 int64 object_store_id
,
78 int64 index_id
) OVERRIDE
;
79 virtual bool PutIndexDataForRecord(Transaction
*,
81 int64 object_store_id
,
84 const RecordIdentifier
&) OVERRIDE
;
86 virtual scoped_ptr
<Cursor
> OpenObjectStoreKeyCursor(
87 Transaction
* transaction
,
89 int64 object_store_id
,
90 const IndexedDBKeyRange
& key_range
,
91 indexed_db::CursorDirection
) OVERRIDE
;
92 virtual scoped_ptr
<Cursor
> OpenObjectStoreCursor(
93 Transaction
* transaction
,
95 int64 object_store_id
,
96 const IndexedDBKeyRange
& key_range
,
97 indexed_db::CursorDirection
) OVERRIDE
;
98 virtual scoped_ptr
<Cursor
> OpenIndexKeyCursor(
99 Transaction
* transaction
,
101 int64 object_store_id
,
103 const IndexedDBKeyRange
& key_range
,
104 indexed_db::CursorDirection
) OVERRIDE
;
105 virtual scoped_ptr
<Cursor
> OpenIndexCursor(Transaction
* transaction
,
107 int64 object_store_id
,
109 const IndexedDBKeyRange
& key_range
,
110 indexed_db::CursorDirection
)
114 friend class base::RefCounted
<IndexedDBFakeBackingStore
>;
115 virtual ~IndexedDBFakeBackingStore();
118 } // namespace content
120 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_