#include "third_party/blink/renderer/platform/p2p/socket_client_impl.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "net/base/ip_endpoint.h"
#include "services/network/public/cpp/p2p_socket_type.h"
#include "services/network/public/mojom/p2p.mojom-blink-forward.h"
#include "services/network/public/mojom/p2p.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/p2p/socket_client_delegate.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace network {
bool operator==(const P2PSendPacketMetrics& a, const P2PSendPacketMetrics& b) { … }
}
namespace blink {
namespace {
_;
ElementsAre;
Field;
InSequence;
NiceMock;
Pointee;
Return;
SaveArg;
Values;
WithArgs;
class MockSocketService : public network::mojom::blink::P2PSocket { … };
class MockDelegate : public P2PSocketClientDelegate { … };
class SocketClientImplTestBase { … };
class SocketClientImplParametrizedTest : public SocketClientImplTestBase,
public ::testing::TestWithParam<bool> { … };
TEST_P(SocketClientImplParametrizedTest, OnOpenCalled) { … }
TEST_P(SocketClientImplParametrizedTest, OnDataReceivedCalled) { … }
TEST_P(SocketClientImplParametrizedTest, OnSendCompleteCalled) { … }
TEST_P(SocketClientImplParametrizedTest, OnConnectionErrorCalled) { … }
TEST_P(SocketClientImplParametrizedTest, SendsWithIncreasingPacketId) { … }
TEST_P(SocketClientImplParametrizedTest, SetsOption) { … }
TEST_P(SocketClientImplParametrizedTest, OnSendBatchCompleteCalled) { … }
INSTANTIATE_TEST_SUITE_P(…);
class SocketClientImplBatchingTest : public SocketClientImplTestBase,
public ::testing::Test { … };
TEST_F(SocketClientImplBatchingTest, OnePacketBatchUsesSend) { … }
TEST_F(SocketClientImplBatchingTest, TwoPacketBatchUsesSendBatch) { … }
TEST_F(SocketClientImplBatchingTest,
TwoPacketBatchWithNonbatchableInterleavedUsesSendBatch) { … }
TEST_F(SocketClientImplBatchingTest, PacketBatchCompletedWithFlush) { … }
}
}