xref: /aosp_15_r20/external/libbrillo/brillo/http/mock_transport.h (revision 1a96fba65179ea7d3f56207137718607415c5953)
1*1a96fba6SXin Li // Copyright 2014 The Chromium OS Authors. All rights reserved.
2*1a96fba6SXin Li // Use of this source code is governed by a BSD-style license that can be
3*1a96fba6SXin Li // found in the LICENSE file.
4*1a96fba6SXin Li 
5*1a96fba6SXin Li #ifndef LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_
6*1a96fba6SXin Li #define LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_
7*1a96fba6SXin Li 
8*1a96fba6SXin Li #include <memory>
9*1a96fba6SXin Li #include <string>
10*1a96fba6SXin Li 
11*1a96fba6SXin Li #include <base/location.h>
12*1a96fba6SXin Li #include <base/macros.h>
13*1a96fba6SXin Li #include <brillo/http/http_transport.h>
14*1a96fba6SXin Li #include <gmock/gmock.h>
15*1a96fba6SXin Li 
16*1a96fba6SXin Li namespace brillo {
17*1a96fba6SXin Li namespace http {
18*1a96fba6SXin Li 
19*1a96fba6SXin Li class MockTransport : public Transport {
20*1a96fba6SXin Li  public:
21*1a96fba6SXin Li   MockTransport() = default;
22*1a96fba6SXin Li 
23*1a96fba6SXin Li   MOCK_METHOD(std::shared_ptr<Connection>,
24*1a96fba6SXin Li               CreateConnection,
25*1a96fba6SXin Li               (const std::string&,
26*1a96fba6SXin Li                const std::string&,
27*1a96fba6SXin Li                const HeaderList&,
28*1a96fba6SXin Li                const std::string&,
29*1a96fba6SXin Li                const std::string&,
30*1a96fba6SXin Li                brillo::ErrorPtr*),
31*1a96fba6SXin Li               (override));
32*1a96fba6SXin Li   MOCK_METHOD(void,
33*1a96fba6SXin Li               RunCallbackAsync,
34*1a96fba6SXin Li               (const base::Location&, const base::Closure&),
35*1a96fba6SXin Li               (override));
36*1a96fba6SXin Li   MOCK_METHOD(RequestID,
37*1a96fba6SXin Li               StartAsyncTransfer,
38*1a96fba6SXin Li               (Connection*, const SuccessCallback&, const ErrorCallback&),
39*1a96fba6SXin Li               (override));
40*1a96fba6SXin Li   MOCK_METHOD(bool, CancelRequest, (RequestID), (override));
41*1a96fba6SXin Li   MOCK_METHOD(void, SetDefaultTimeout, (base::TimeDelta), (override));
42*1a96fba6SXin Li   MOCK_METHOD(void, SetLocalIpAddress, (const std::string&), (override));
43*1a96fba6SXin Li   MOCK_METHOD(void, UseDefaultCertificate, (), (override));
44*1a96fba6SXin Li   MOCK_METHOD(void, UseCustomCertificate, (Certificate), (override));
45*1a96fba6SXin Li   MOCK_METHOD(void,
46*1a96fba6SXin Li               ResolveHostToIp,
47*1a96fba6SXin Li               (const std::string&, uint16_t, const std::string&),
48*1a96fba6SXin Li               (override));
49*1a96fba6SXin Li 
50*1a96fba6SXin Li  protected:
51*1a96fba6SXin Li   MOCK_METHOD(void, ClearHost, (), (override));
52*1a96fba6SXin Li 
53*1a96fba6SXin Li  private:
54*1a96fba6SXin Li   DISALLOW_COPY_AND_ASSIGN(MockTransport);
55*1a96fba6SXin Li };
56*1a96fba6SXin Li 
57*1a96fba6SXin Li }  // namespace http
58*1a96fba6SXin Li }  // namespace brillo
59*1a96fba6SXin Li 
60*1a96fba6SXin Li #endif  // LIBBRILLO_BRILLO_HTTP_MOCK_TRANSPORT_H_
61