Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_ | |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "content/browser/indexed_db/indexed_db_class_factory.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class LevelDBTransaction; | |
| 15 class LevelDBDatabase; | |
| 16 | |
| 17 enum FailClass { | |
| 18 FAIL_CLASS_NOTHING, | |
| 19 FAIL_CLASS_LEVELDB_TRANSACTION, | |
| 20 }; | |
| 21 | |
| 22 enum FailMethod { | |
| 23 FAIL_METHOD_NOTHING, | |
| 24 FAIL_METHOD_COMMIT, | |
| 25 FAIL_METHOD_GET, | |
| 26 }; | |
| 27 | |
| 28 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
| |
| 29 public: | |
| 30 IndexedDBBrowserTestClassFactory(); | |
| 31 virtual ~IndexedDBBrowserTestClassFactory(); | |
| 32 virtual LevelDBTransaction* CreateLevelDBTransaction( | |
| 33 LevelDBDatabase* db) OVERRIDE; | |
| 34 | |
| 35 void FailOperation(FailClass failure_class, | |
| 36 FailMethod failure_method, | |
| 37 int fail_on_instance_num, | |
| 38 int fail_on_call_num); | |
| 39 void Reset(); | |
| 40 | |
| 41 private: | |
| 42 FailClass failure_class_; | |
| 43 FailMethod failure_method_; | |
| 44 std::map<FailClass, int> instance_count_; | |
| 45 std::map<FailClass, int> fail_on_instance_num_; | |
| 46 std::map<FailClass, int> fail_on_call_num_; | |
| 47 bool only_trace_calls_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BROWSERTEST_MOCK_FACTORY_H_ | |
| OLD | NEW |