[IndexedDB] Adding traces, perf tests
[chromium-blink-merge.git] / content / browser / indexed_db / mock_indexed_db_factory.h
blobb480758692c9525faf15c18f4b3e3e3796834b84
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.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_
8 #include <string>
10 #include "content/browser/indexed_db/indexed_db_factory.h"
11 #include "testing/gmock/include/gmock/gmock.h"
13 namespace content {
15 class MockIndexedDBFactory : public IndexedDBFactory {
16 public:
17 MockIndexedDBFactory();
18 MOCK_METHOD2(ReleaseDatabase,
19 void(const IndexedDBDatabase::Identifier& identifier,
20 bool forced_close));
21 MOCK_METHOD4(GetDatabaseNames,
22 void(scoped_refptr<IndexedDBCallbacks> callbacks,
23 const GURL& origin_url,
24 const base::FilePath& data_directory,
25 net::URLRequestContext* request_context));
26 MOCK_METHOD5(Open,
27 void(const base::string16& name,
28 const IndexedDBPendingConnection& connection,
29 net::URLRequestContext* request_context,
30 const GURL& origin_url,
31 const base::FilePath& data_directory));
32 MOCK_METHOD5(DeleteDatabase,
33 void(const base::string16& name,
34 net::URLRequestContext* request_context,
35 scoped_refptr<IndexedDBCallbacks> callbacks,
36 const GURL& origin_url,
37 const base::FilePath& data_directory));
38 MOCK_METHOD1(HandleBackingStoreFailure, void(const GURL& origin_url));
39 MOCK_METHOD2(HandleBackingStoreCorruption,
40 void(const GURL& origin_url,
41 const IndexedDBDatabaseError& error));
42 // The Android NDK implements a subset of STL, and the gtest templates can't
43 // deal with std::pair's. This means we can't use GoogleMock for this method
44 OriginDBs GetOpenDatabasesForOrigin(const GURL& origin_url) const override;
45 MOCK_METHOD1(ForceClose, void(const GURL& origin_url));
46 MOCK_METHOD0(ContextDestroyed, void());
47 MOCK_METHOD1(DatabaseDeleted,
48 void(const IndexedDBDatabase::Identifier& identifier));
49 MOCK_CONST_METHOD1(GetConnectionCount, size_t(const GURL& origin_url));
51 MOCK_METHOD2(ReportOutstandingBlobs,
52 void(const GURL& origin_url, bool blobs_outstanding));
54 protected:
55 virtual ~MockIndexedDBFactory();
57 MOCK_METHOD7(OpenBackingStore,
58 scoped_refptr<IndexedDBBackingStore>(
59 const GURL& origin_url,
60 const base::FilePath& data_directory,
61 net::URLRequestContext* request_context,
62 blink::WebIDBDataLoss* data_loss,
63 std::string* data_loss_reason,
64 bool* disk_full,
65 leveldb::Status* s));
67 MOCK_METHOD8(OpenBackingStoreHelper,
68 scoped_refptr<IndexedDBBackingStore>(
69 const GURL& origin_url,
70 const base::FilePath& data_directory,
71 net::URLRequestContext* request_context,
72 blink::WebIDBDataLoss* data_loss,
73 std::string* data_loss_message,
74 bool* disk_full,
75 bool first_time,
76 leveldb::Status* s));
78 private:
79 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory);
82 } // namespace content
84 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_