// Copyright 2014 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LIBBRILLO_BRILLO_HTTP_MOCK_CONNECTION_H_ #define LIBBRILLO_BRILLO_HTTP_MOCK_CONNECTION_H_ #include #include #include #include #include namespace brillo { namespace http { class MockConnection : public Connection { public: using Connection::Connection; MOCK_METHOD(bool, SendHeaders, (const HeaderList&, ErrorPtr*), (override)); MOCK_METHOD(bool, MockSetRequestData, (Stream*, ErrorPtr*)); MOCK_METHOD(void, MockSetResponseData, (Stream*)); MOCK_METHOD(bool, FinishRequest, (ErrorPtr*), (override)); MOCK_METHOD(RequestID, FinishRequestAsync, (const SuccessCallback&, const ErrorCallback&), (override)); MOCK_METHOD(int, GetResponseStatusCode, (), (const, override)); MOCK_METHOD(std::string, GetResponseStatusText, (), (const, override)); MOCK_METHOD(std::string, GetProtocolVersion, (), (const, override)); MOCK_METHOD(std::string, GetResponseHeader, (const std::string&), (const, override)); MOCK_METHOD(Stream*, MockExtractDataStream, (brillo::ErrorPtr*), (const)); private: bool SetRequestData(StreamPtr stream, brillo::ErrorPtr* error) override { return MockSetRequestData(stream.get(), error); } void SetResponseData(StreamPtr stream) override { MockSetResponseData(stream.get()); } StreamPtr ExtractDataStream(brillo::ErrorPtr* error) override { return StreamPtr{MockExtractDataStream(error)}; } DISALLOW_COPY_AND_ASSIGN(MockConnection); }; } // namespace http } // namespace brillo #endif // LIBBRILLO_BRILLO_HTTP_MOCK_CONNECTION_H_