| Index: content/browser/indexed_db/indexed_db_browsertest_mock_factory.h
|
| diff --git a/content/browser/indexed_db/indexed_db_browsertest_mock_factory.h b/content/browser/indexed_db/indexed_db_browsertest_mock_factory.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b8733ea206796c8b9987b6f701574d6d101f9eda
|
| --- /dev/null
|
| +++ b/content/browser/indexed_db/indexed_db_browsertest_mock_factory.h
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_
|
| +#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_
|
| +
|
| +#include <map>
|
| +
|
| +#include "content/browser/indexed_db/indexed_db_class_factory.h"
|
| +
|
| +namespace content {
|
| +
|
| +class LevelDBTransaction;
|
| +class LevelDBDatabase;
|
| +
|
| +enum FailClass {
|
| + FAIL_CLASS_NOTHING,
|
| + FAIL_CLASS_LEVELDB_TRANSACTION,
|
| +};
|
| +
|
| +enum FailMethod {
|
| + FAIL_METHOD_NOTHING,
|
| + FAIL_METHOD_COMMIT,
|
| + FAIL_METHOD_GET,
|
| +};
|
| +
|
| +class IndexedDBBrowserTestClassFactory : public IndexedDBClassFactory {
|
| + public:
|
| + IndexedDBBrowserTestClassFactory();
|
| + virtual ~IndexedDBBrowserTestClassFactory();
|
| + virtual LevelDBTransaction* CreateLevelDBTransaction(
|
| + LevelDBDatabase* db) OVERRIDE;
|
| +
|
| + void FailOperation(FailClass failure_class,
|
| + FailMethod failure_method,
|
| + int fail_on_instance_num,
|
| + int fail_on_call_num);
|
| + void Reset();
|
| +
|
| + private:
|
| + FailClass failure_class_;
|
| + FailMethod failure_method_;
|
| + std::map<FailClass, int> instance_count_;
|
| + std::map<FailClass, int> fail_on_instance_num_;
|
| + std::map<FailClass, int> fail_on_call_num_;
|
| + bool only_trace_calls_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_
|
|
|