#include <memory>
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/cast/message_port/blink_message_port_adapter.h"
#include "components/cast/message_port/cast/message_port_cast.h"
#include "components/cast/message_port/cast_core/create_message_port_core.h"
#include "components/cast/message_port/message_port.h"
#include "components/cast/message_port/message_port_buildflags.h"
#include "components/cast/message_port/platform_message_port.h"
#include "components/cast/message_port/test_message_port_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/messaging/web_message_port.h"
#if BUILDFLAG(IS_FUCHSIA)
#include "components/cast/message_port/fuchsia/message_port_fuchsia.h"
#endif
#ifdef PostMessage
#undef PostMessage
#endif
namespace cast_api_bindings {
CreatePairFunction;
static void CreatePlatformToBlinkPair(std::unique_ptr<MessagePort>* client,
std::unique_ptr<MessagePort>* server) { … }
static void CreateBlinkToPlatformPair(std::unique_ptr<MessagePort>* client,
std::unique_ptr<MessagePort>* server) { … }
class MessagePortTest : public ::testing::Test { … };
TEST_F(MessagePortTest, WrapPlatformPort) { … }
TEST_F(MessagePortTest, UnwrapPlatformPort) { … }
enum MessagePortTestType { … };
struct MessagePortTestParam { … };
const MessagePortTestParam MessagePortTestParams[] = …;
class ParameterizedMessagePortTest
: public MessagePortTest,
public ::testing::WithParamInterface<MessagePortTestParam> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ParameterizedMessagePortTest, Close) { … }
TEST_P(ParameterizedMessagePortTest, OnError) { … }
TEST_P(ParameterizedMessagePortTest, OnErrorOnClose) { … }
TEST_P(ParameterizedMessagePortTest, PostMessage) { … }
TEST_P(ParameterizedMessagePortTest, PostMessageMultiple) { … }
TEST_P(ParameterizedMessagePortTest, PostMessageWithTransferables) { … }
}