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 virtual OriginDBs
GetOpenDatabasesForOrigin(
45 const GURL
& origin_url
) const OVERRIDE
;
46 MOCK_METHOD1(ForceClose
, void(const GURL
& origin_url
));
47 MOCK_METHOD0(ContextDestroyed
, void());
48 MOCK_METHOD1(DatabaseDeleted
,
49 void(const IndexedDBDatabase::Identifier
& identifier
));
50 MOCK_CONST_METHOD1(GetConnectionCount
, size_t(const GURL
& origin_url
));
52 MOCK_METHOD2(ReportOutstandingBlobs
,
53 void(const GURL
& origin_url
, bool blobs_outstanding
));
56 virtual ~MockIndexedDBFactory();
58 MOCK_METHOD7(OpenBackingStore
,
59 scoped_refptr
<IndexedDBBackingStore
>(
60 const GURL
& origin_url
,
61 const base::FilePath
& data_directory
,
62 net::URLRequestContext
* request_context
,
63 blink::WebIDBDataLoss
* data_loss
,
64 std::string
* data_loss_reason
,
68 MOCK_METHOD8(OpenBackingStoreHelper
,
69 scoped_refptr
<IndexedDBBackingStore
>(
70 const GURL
& origin_url
,
71 const base::FilePath
& data_directory
,
72 net::URLRequestContext
* request_context
,
73 blink::WebIDBDataLoss
* data_loss
,
74 std::string
* data_loss_message
,
80 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory
);
83 } // namespace content
85 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_