1 // Copyright 2014 The Chromium OS 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 LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_ 6 #define LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include <base/location.h> 12 #include <base/macros.h> 13 #include <brillo/http/http_transport.h> 14 #include <gmock/gmock.h> 15 16 namespace brillo { 17 namespace http { 18 19 class MockTransport : public Transport { 20 public: 21 MockTransport() = default; 22 23 MOCK_METHOD(std::shared_ptr<Connection>, 24 CreateConnection, 25 (const std::string&, 26 const std::string&, 27 const HeaderList&, 28 const std::string&, 29 const std::string&, 30 brillo::ErrorPtr*), 31 (override)); 32 MOCK_METHOD(void, 33 RunCallbackAsync, 34 (const base::Location&, const base::Closure&), 35 (override)); 36 MOCK_METHOD(RequestID, 37 StartAsyncTransfer, 38 (Connection*, const SuccessCallback&, const ErrorCallback&), 39 (override)); 40 MOCK_METHOD(bool, CancelRequest, (RequestID), (override)); 41 MOCK_METHOD(void, SetDefaultTimeout, (base::TimeDelta), (override)); 42 MOCK_METHOD(void, SetLocalIpAddress, (const std::string&), (override)); 43 MOCK_METHOD(void, UseDefaultCertificate, (), (override)); 44 MOCK_METHOD(void, UseCustomCertificate, (Certificate), (override)); 45 MOCK_METHOD(void, 46 ResolveHostToIp, 47 (const std::string&, uint16_t, const std::string&), 48 (override)); 49 50 protected: 51 MOCK_METHOD(void, ClearHost, (), (override)); 52 53 private: 54 DISALLOW_COPY_AND_ASSIGN(MockTransport); 55 }; 56 57 } // namespace http 58 } // namespace brillo 59 60 #endif // LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_ 61