#include "third_party/webrtc_overrides/p2p/base/bridge_ice_controller.h"
#include <memory>
#include <tuple>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/strcat.h"
#include "base/test/gtest_util.h"
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/peerconnection/fake_connection_test_base.h"
#include "third_party/blink/renderer/platform/peerconnection/webrtc_connection_matchers.h"
#include "third_party/webrtc/p2p/base/ice_controller_interface.h"
#include "third_party/webrtc/p2p/base/ice_switch_reason.h"
#include "third_party/webrtc/p2p/base/mock_ice_agent.h"
#include "third_party/webrtc/p2p/base/mock_ice_controller.h"
#include "third_party/webrtc_overrides/p2p/base/fake_connection_factory.h"
#include "third_party/webrtc_overrides/p2p/base/ice_connection.h"
#include "third_party/webrtc_overrides/p2p/base/ice_interaction_interface.h"
#include "third_party/webrtc_overrides/p2p/base/ice_ping_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_prune_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_switch_proposal.h"
namespace cricket {
struct IceConfig;
}
namespace {
BridgeIceController;
FakeConnectionFactory;
IceConnection;
IceControllerObserverInterface;
IceInteractionInterface;
IcePingProposal;
IcePruneProposal;
IceSwitchProposal;
Candidate;
Connection;
IceConfig;
IceControllerFactoryArgs;
IceControllerInterface;
IceMode;
IceRecheckEvent;
IceSwitchReason;
MockIceAgent;
MockIceController;
MockIceControllerFactory;
NominationMode;
_;
Combine;
ElementsAreArray;
Eq;
IsEmpty;
NiceMock;
Ref;
Return;
Sequence;
StrictMock;
Test;
TestParamInfo;
Values;
WithArgs;
WithParamInterface;
ConnectionEq;
PingProposalEq;
PruneProposalEq;
SwitchProposalEq;
SingleThreadTaskEnvironment;
TaskEnvironment;
static const std::string kIp = …;
static const std::string kIpTwo = …;
static const std::string kIpThree = …;
static const int kPort = …;
static const IceConfig kIceConfig;
static const std::vector<const Connection*> kEmptyConnsList{ … };
static const IceControllerInterface::SwitchResult kEmptySwitchResult{ … };
static constexpr base::TimeDelta kTick = …;
class MockIceControllerObserver : public IceControllerObserverInterface { … };
class BridgeIceControllerTest : public ::blink::FakeConnectionTestBase { … };
enum class ProposalResponse { … };
PingProposalResponse;
SwitchProposalResponse;
PruneProposalResponse;
class BridgeIceControllerProposalTest
: public BridgeIceControllerTest,
public WithParamInterface<std::tuple<PingProposalResponse,
SwitchProposalResponse,
PruneProposalResponse>> { … };
std::string ToTestSuffix(std::string type, ProposalResponse response) { … }
std::string MakeTestName(
const TestParamInfo<BridgeIceControllerProposalTest::ParamType>& info) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(BridgeIceControllerTest, ObserverAttached) { … }
TEST_F(BridgeIceControllerTest, PassthroughIceControllerInterface) { … }
TEST_F(BridgeIceControllerTest, HandlesImmediateSwitchRequest) { … }
TEST_P(BridgeIceControllerProposalTest, HandlesImmediateSortAndSwitchRequest) { … }
TEST_P(BridgeIceControllerProposalTest, HandlesSortAndSwitchRequest) { … }
TEST_P(BridgeIceControllerProposalTest, StartPingingAfterSortAndSwitch) { … }
class BridgeIceControllerInvalidProposalTest : public BridgeIceControllerTest { … };
BridgeIceControllerDeathTest;
BridgeIceControllerNoopTest;
TEST_F(BridgeIceControllerDeathTest, AcceptUnsolicitedPingProposal) { … }
TEST_F(BridgeIceControllerDeathTest, RejectUnsolicitedPingProposal) { … }
TEST_F(BridgeIceControllerDeathTest, AcceptEmptyPingProposal) { … }
TEST_F(BridgeIceControllerNoopTest, AcceptUnknownPingProposal) { … }
TEST_F(BridgeIceControllerDeathTest, AcceptUnsolicitedSwitchProposal) { … }
TEST_F(BridgeIceControllerDeathTest, RejectUnsolicitedSwitchProposal) { … }
TEST_F(BridgeIceControllerDeathTest, AcceptEmptySwitchProposal) { … }
TEST_F(BridgeIceControllerDeathTest, AcceptNullSwitchProposal) { … }
TEST_F(BridgeIceControllerNoopTest, AcceptUnknownSwitchProposal) { … }
TEST_F(BridgeIceControllerDeathTest, AcceptUnsolicitedPruneProposal) { … }
TEST_F(BridgeIceControllerDeathTest, RejectUnsolicitedPruneProposal) { … }
TEST_F(BridgeIceControllerInvalidProposalTest, AcceptUnknownPruneProposal) { … }
TEST_F(BridgeIceControllerTest, HandlesPingRequest) { … }
TEST_F(BridgeIceControllerTest, HandlesSwitchRequest) { … }
TEST_F(BridgeIceControllerTest, HandlesPruneRequest) { … }
}