Chromium Code Reviews| 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 { |
|
jsbell
2014/06/19 21:08:47
Looking around the Chromium code, it's more common
cmumford
2014/06/19 22:17:11
I'll rename to MockXXX.
Here's where I was going
jsbell
2014/06/19 22:36:03
I'm good with MockBrowserTestIndexedDBClassFactory
|
| + 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_ |