Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: content/browser/indexed_db/indexed_db_browsertest_mock_factory.h

Issue 334303002: Using a mock LevelDBTransaction for corruption tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined VLOG and NOTREACHED Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698