blob: f552519be06abcf50e2d66c9048d56bf1c38a287 [file] [log] [blame]
Sameer Vijaykar1adcde92022-09-16 13:04:341/*
2 * Copyright 2018 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef P2P_BASE_MOCK_ICE_CONTROLLER_H_
12#define P2P_BASE_MOCK_ICE_CONTROLLER_H_
13
14#include <memory>
15#include <vector>
16
17#include "p2p/base/ice_controller_factory_interface.h"
18#include "p2p/base/ice_controller_interface.h"
19#include "test/gmock.h"
20
21namespace cricket {
22
23class MockIceController : public cricket::IceControllerInterface {
24 public:
25 explicit MockIceController(const cricket::IceControllerFactoryArgs& args) {}
26 ~MockIceController() override = default;
27
28 MOCK_METHOD(void, SetIceConfig, (const cricket::IceConfig&), (override));
29 MOCK_METHOD(void,
30 SetSelectedConnection,
31 (const cricket::Connection*),
32 (override));
33 MOCK_METHOD(void, AddConnection, (const cricket::Connection*), (override));
34 MOCK_METHOD(void,
35 OnConnectionDestroyed,
36 (const cricket::Connection*),
37 (override));
Daniel Chenge125a332023-12-02 22:16:5938 MOCK_METHOD(rtc::ArrayView<const cricket::Connection* const>,
39 GetConnections,
40 (),
41 (const, override));
Manashi Sarkarc925f502023-12-04 12:10:1542 MOCK_METHOD(rtc::ArrayView<const cricket::Connection*>,
Sameer Vijaykar1adcde92022-09-16 13:04:3443 connections,
44 (),
45 (const, override));
46 MOCK_METHOD(bool, HasPingableConnection, (), (const, override));
47 MOCK_METHOD(cricket::IceControllerInterface::PingResult,
48 SelectConnectionToPing,
49 (int64_t),
50 (override));
51 MOCK_METHOD(bool,
52 GetUseCandidateAttr,
53 (const cricket::Connection*,
54 cricket::NominationMode,
55 cricket::IceMode),
56 (const, override));
57 MOCK_METHOD(const cricket::Connection*,
58 FindNextPingableConnection,
59 (),
60 (override));
61 MOCK_METHOD(void,
62 MarkConnectionPinged,
63 (const cricket::Connection*),
64 (override));
65 MOCK_METHOD(cricket::IceControllerInterface::SwitchResult,
66 ShouldSwitchConnection,
67 (cricket::IceSwitchReason, const cricket::Connection*),
68 (override));
69 MOCK_METHOD(cricket::IceControllerInterface::SwitchResult,
70 SortAndSwitchConnection,
71 (cricket::IceSwitchReason),
72 (override));
73 MOCK_METHOD(std::vector<const cricket::Connection*>,
74 PruneConnections,
75 (),
76 (override));
77};
78
79class MockIceControllerFactory : public cricket::IceControllerFactoryInterface {
80 public:
81 ~MockIceControllerFactory() override = default;
82
83 std::unique_ptr<cricket::IceControllerInterface> Create(
84 const cricket::IceControllerFactoryArgs& args) override {
85 RecordIceControllerCreated();
86 return std::make_unique<MockIceController>(args);
87 }
88
89 MOCK_METHOD(void, RecordIceControllerCreated, ());
90};
91
92} // namespace cricket
93
94#endif // P2P_BASE_MOCK_ICE_CONTROLLER_H_