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

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

Issue 308103004: IndexedDB: Using a mock IndexedDBFactory for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to add mock_indexed_db_factory.* files in last patch set. 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_MOCK_INDEXED_DB_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_
7
8 #include "content/browser/indexed_db/indexed_db_factory.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10
11 namespace content {
12
13 class MockIndexedDBFactory : public IndexedDBFactory {
14 public:
15 MockIndexedDBFactory();
16 MOCK_METHOD2(ReleaseDatabase,
17 void(const IndexedDBDatabase::Identifier& identifier,
18 bool forcedClose));
19 MOCK_METHOD4(GetDatabaseNames,
20 void(scoped_refptr<IndexedDBCallbacks> callbacks,
21 const GURL& origin_url,
22 const base::FilePath& data_directory,
23 net::URLRequestContext* request_context));
24 MOCK_METHOD5(Open,
25 void(const base::string16& name,
26 const IndexedDBPendingConnection& connection,
27 net::URLRequestContext* request_context,
28 const GURL& origin_url,
29 const base::FilePath& data_directory));
30 MOCK_METHOD5(DeleteDatabase,
31 void(const base::string16& name,
32 net::URLRequestContext* request_context,
33 scoped_refptr<IndexedDBCallbacks> callbacks,
34 const GURL& origin_url,
35 const base::FilePath& data_directory));
36 MOCK_METHOD1(HandleBackingStoreFailure, void(const GURL& origin_url));
37 MOCK_METHOD2(HandleBackingStoreCorruption,
38 void(const GURL& origin_url,
39 const IndexedDBDatabaseError& error));
40 // mock template gets confused and needs typedef to compile.
41 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs;
42 MOCK_CONST_METHOD1(GetOpenDatabasesForOrigin,
43 OriginDBs(const GURL& origin_url));
44 MOCK_METHOD1(ForceClose, void(const GURL& origin_url));
45 MOCK_METHOD0(ContextDestroyed, void());
46 MOCK_METHOD1(DatabaseDeleted,
47 void(const IndexedDBDatabase::Identifier& identifier));
48 MOCK_CONST_METHOD1(GetConnectionCount, size_t(const GURL& origin_url));
49
50 MOCK_METHOD2(ReportOutstandingBlobs,
51 void(const GURL& origin_url,
52 bool blobs_outstanding));
53 protected:
54 virtual ~MockIndexedDBFactory();
55
56 MOCK_METHOD6(OpenBackingStore,
57 scoped_refptr<IndexedDBBackingStore>(
58 const GURL& origin_url,
59 const base::FilePath& data_directory,
60 net::URLRequestContext* request_context,
61 blink::WebIDBDataLoss* data_loss,
62 std::string* data_loss_reason,
63 bool* disk_full));
64
65 MOCK_METHOD7(OpenBackingStoreHelper,
66 scoped_refptr<IndexedDBBackingStore>(
67 const GURL& origin_url,
68 const base::FilePath& data_directory,
69 net::URLRequestContext* request_context,
70 blink::WebIDBDataLoss* data_loss,
71 std::string* data_loss_message,
72 bool* disk_full,
73 bool first_time));
74
75 private:
76 MOCK_CONST_METHOD1(IsBackingStoreOpen,
77 bool(const GURL& origin_url));
78
79 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory);
80 };
81
82 } // namespace content
83
84 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction_unittest.cc ('k') | content/browser/indexed_db/mock_indexed_db_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698