| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "content/browser/indexed_db/indexed_db_factory.h" | 13 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class MockIndexedDBFactory : public IndexedDBFactory { | 18 class MockIndexedDBFactory : public IndexedDBFactory { |
| 19 public: | 19 public: |
| 20 MockIndexedDBFactory(); | 20 MockIndexedDBFactory(); |
| 21 MOCK_METHOD2(ReleaseDatabase, | 21 MOCK_METHOD2(ReleaseDatabase, |
| 22 void(const IndexedDBDatabase::Identifier& identifier, | 22 void(const IndexedDBDatabase::Identifier& identifier, |
| 23 bool forced_close)); | 23 bool forced_close)); |
| 24 MOCK_METHOD4(GetDatabaseNames, | 24 MOCK_METHOD4(GetDatabaseNames, |
| 25 void(scoped_refptr<IndexedDBCallbacks> callbacks, | 25 void(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 26 const url::Origin& origin, | 26 const url::Origin& origin, |
| 27 const base::FilePath& data_directory, | 27 const base::FilePath& data_directory, |
| 28 net::URLRequestContext* request_context)); | 28 net::URLRequestContext* request_context)); |
| 29 MOCK_METHOD5(Open, | 29 MOCK_METHOD5(OpenProxy, |
| 30 void(const base::string16& name, | 30 void(const base::string16& name, |
| 31 const IndexedDBPendingConnection& connection, | 31 IndexedDBPendingConnection* connection, |
| 32 net::URLRequestContext* request_context, | 32 net::URLRequestContext* request_context, |
| 33 const url::Origin& origin, | 33 const url::Origin& origin, |
| 34 const base::FilePath& data_directory)); | 34 const base::FilePath& data_directory)); |
| 35 // Googlemock can't deal with move-only types, so *Proxy() is a workaround. |
| 36 virtual void Open(const base::string16& name, |
| 37 std::unique_ptr<IndexedDBPendingConnection> connection, |
| 38 net::URLRequestContext* request_context, |
| 39 const url::Origin& origin, |
| 40 const base::FilePath& data_directory) { |
| 41 OpenProxy(name, connection.get(), request_context, origin, data_directory); |
| 42 } |
| 35 MOCK_METHOD5(DeleteDatabase, | 43 MOCK_METHOD5(DeleteDatabase, |
| 36 void(const base::string16& name, | 44 void(const base::string16& name, |
| 37 net::URLRequestContext* request_context, | 45 net::URLRequestContext* request_context, |
| 38 scoped_refptr<IndexedDBCallbacks> callbacks, | 46 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 39 const url::Origin& origin, | 47 const url::Origin& origin, |
| 40 const base::FilePath& data_directory)); | 48 const base::FilePath& data_directory)); |
| 41 MOCK_METHOD1(HandleBackingStoreFailure, void(const url::Origin& origin)); | 49 MOCK_METHOD1(HandleBackingStoreFailure, void(const url::Origin& origin)); |
| 42 MOCK_METHOD2(HandleBackingStoreCorruption, | 50 MOCK_METHOD2(HandleBackingStoreCorruption, |
| 43 void(const url::Origin& origin, | 51 void(const url::Origin& origin, |
| 44 const IndexedDBDatabaseError& error)); | 52 const IndexedDBDatabaseError& error)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool first_time, | 84 bool first_time, |
| 77 leveldb::Status* s)); | 85 leveldb::Status* s)); |
| 78 | 86 |
| 79 private: | 87 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory); | 88 DISALLOW_COPY_AND_ASSIGN(MockIndexedDBFactory); |
| 81 }; | 89 }; |
| 82 | 90 |
| 83 } // namespace content | 91 } // namespace content |
| 84 | 92 |
| 85 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ | 93 #endif // CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_FACTORY_H_ |
| OLD | NEW |