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_MOCK_INDEXED_DB_FACTORY_H_ | |
6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ | |
7 | |
8 #include <string> | |
9 #include <utility> | |
10 | |
11 #include "content/browser/indexed_db/indexed_db_factory.h" | |
12 #include "testing/gmock/include/gmock/gmock.h" | |
13 | |
14 namespace content { | |
15 | |
16 class MockIndexedDBFactory : public IndexedDBFactory { | |
17 public: | |
18 // mock template gets confused and needs typedef to compile. | |
jsbell
2014/07/28 22:26:16
Should we move the typedef to the base class, for
cmumford
2014/07/28 22:46:35
Done.
| |
19 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; | |
20 | |
21 MockIndexedDBFactory(); | |
22 MOCK_METHOD2(ReleaseDatabase, | |
23 void(const IndexedDBDatabase::Identifier& identifier, | |
24 bool forcedClose)); | |
25 MOCK_METHOD4(GetDatabaseNames, | |
26 void(scoped_refptr<IndexedDBCallbacks> callbacks, | |
27 const GURL& origin_url, | |
28 const base::FilePath& data_directory, | |
29 net::URLRequestContext* request_context)); | |
30 MOCK_METHOD5(Open, | |
31 void(const base::string16& name, | |
32 const IndexedDBPendingConnection& connection, | |
33 net::URLRequestContext* request_context, | |
34 const GURL& origin_url, | |
35 const base::FilePath& data_directory)); | |
36 MOCK_METHOD5(DeleteDatabase, | |
37 void(const base::string16& name, | |
38 net::URLRequestContext* request_context, | |
39 scoped_refptr<IndexedDBCallbacks> callbacks, | |
40 const GURL& origin_url, | |
41 const base::FilePath& data_directory)); | |
42 MOCK_METHOD1(HandleBackingStoreFailure, void(const GURL& origin_url)); | |
43 MOCK_METHOD2(HandleBackingStoreCorruption, | |
44 void(const GURL& origin_url, | |
45 const IndexedDBDatabaseError& error)); | |
46 MOCK_CONST_METHOD1(GetOpenDatabasesForOrigin, | |
47 OriginDBs(const GURL& origin_url)); | |
48 MOCK_METHOD1(ForceClose, void(const GURL& origin_url)); | |
49 MOCK_METHOD0(ContextDestroyed, void()); | |
50 MOCK_METHOD1(DatabaseDeleted, | |
51 void(const IndexedDBDatabase::Identifier& identifier)); | |
52 MOCK_CONST_METHOD1(GetConnectionCount, size_t(const GURL& origin_url)); | |
53 | |
54 MOCK_METHOD2(ReportOutstandingBlobs, | |
55 void(const GURL& origin_url, bool blobs_outstanding)); | |
56 | |
57 protected: | |
58 virtual ~MockIndexedDBFactory(); | |
59 | |
60 MOCK_METHOD7(OpenBackingStore, | |
61 scoped_refptr<IndexedDBBackingStore>( | |
62 const GURL& origin_url, | |
63 const base::FilePath& data_directory, | |
64 net::URLRequestContext* request_context, | |
65 blink::WebIDBDataLoss* data_loss, | |
66 std::string* data_loss_reason, | |
67 bool* disk_full, | |
68 leveldb::Status* s)); | |
69 | |
70 MOCK_METHOD8(OpenBackingStoreHelper, | |
71 scoped_refptr<IndexedDBBackingStore>( | |
72 const GURL& origin_url, | |
73 const base::FilePath& data_directory, | |
74 net::URLRequestContext* request_context, | |
75 blink::WebIDBDataLoss* data_loss, | |
76 std::string* data_loss_message, | |
77 bool* disk_full, | |
78 bool first_time, | |
79 leveldb::Status* s)); | |
80 | |
81 private: | |
82 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory); | |
83 }; | |
84 | |
85 } // namespace content | |
86 | |
87 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ | |
OLD | NEW |