1 // Copyright 2014 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_MOCK_BROWSERTEST_INDEXED_DB_CLASS_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_BROWSERTEST_INDEXED_DB_CLASS_FACTORY_H_
11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/indexed_db/indexed_db_backing_store.h"
13 #include "content/browser/indexed_db/indexed_db_class_factory.h"
14 #include "content/browser/indexed_db/indexed_db_database.h"
15 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
19 class LevelDBTransaction
;
20 class LevelDBDatabase
;
24 FAIL_CLASS_LEVELDB_ITERATOR
,
25 FAIL_CLASS_LEVELDB_TRANSACTION
,
31 FAIL_METHOD_COMMIT_DISK_FULL
,
36 class MockBrowserTestIndexedDBClassFactory
: public IndexedDBClassFactory
{
38 MockBrowserTestIndexedDBClassFactory();
39 ~MockBrowserTestIndexedDBClassFactory() override
;
41 IndexedDBDatabase
* CreateIndexedDBDatabase(
42 const base::string16
& name
,
43 IndexedDBBackingStore
* backing_store
,
44 IndexedDBFactory
* factory
,
45 const IndexedDBDatabase::Identifier
& unique_identifier
) override
;
46 IndexedDBTransaction
* CreateIndexedDBTransaction(
48 scoped_refptr
<IndexedDBDatabaseCallbacks
> callbacks
,
49 const std::set
<int64
>& scope
,
50 blink::WebIDBTransactionMode mode
,
51 IndexedDBDatabase
* db
,
52 IndexedDBBackingStore::Transaction
* backing_store_transaction
) override
;
53 LevelDBTransaction
* CreateLevelDBTransaction(LevelDBDatabase
* db
) override
;
54 LevelDBIteratorImpl
* CreateIteratorImpl(
55 scoped_ptr
<leveldb::Iterator
> iterator
) override
;
57 void FailOperation(FailClass failure_class
,
58 FailMethod failure_method
,
59 int fail_on_instance_num
,
60 int fail_on_call_num
);
64 FailClass failure_class_
;
65 FailMethod failure_method_
;
66 std::map
<FailClass
, int> instance_count_
;
67 std::map
<FailClass
, int> fail_on_instance_num_
;
68 std::map
<FailClass
, int> fail_on_call_num_
;
69 bool only_trace_calls_
;
72 } // namespace content
74 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_BROWSERTEST_INDEXED_DB_CLASS_FACTORY_H_