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_
10 #include "content/browser/indexed_db/indexed_db_factory.h"
11 #include "testing/gmock/include/gmock/gmock.h"
15 class MockIndexedDBFactory
: public IndexedDBFactory
{
17 MockIndexedDBFactory();
18 MOCK_METHOD2(ReleaseDatabase
,
19 void(const IndexedDBDatabase::Identifier
& identifier
,
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
));
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
));
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
,
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
,
79 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory
);
82 } // namespace content
84 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_