chromium/components/cast/message_port/message_port_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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  // BUILDFLAG(IS_FUCHSIA)

#ifdef PostMessage
#undef PostMessage
#endif

namespace cast_api_bindings {

CreatePairFunction;

// Creates a PlatformMessagePort |client | talking to MessagePortCast |server|
static void CreatePlatformToBlinkPair(std::unique_ptr<MessagePort>* client,
                                      std::unique_ptr<MessagePort>* server) {}

// Creates a MessagePortCast |client | talking to PlatformMessagePort |server|
static void CreateBlinkToPlatformPair(std::unique_ptr<MessagePort>* client,
                                      std::unique_ptr<MessagePort>* server) {}

class MessagePortTest : public ::testing::Test {};

TEST_F(MessagePortTest, WrapPlatformPort) {}

// Test unwrapping via TakePort (rewrapped for test methods)
TEST_F(MessagePortTest, UnwrapPlatformPort) {}

enum MessagePortTestType {};

struct MessagePortTestParam {};

const MessagePortTestParam MessagePortTestParams[] =;

class ParameterizedMessagePortTest
    : public MessagePortTest,
      public ::testing::WithParamInterface<MessagePortTestParam> {};

// Run the tests on all port types supported by the platform.
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) {}

}  // namespace cast_api_bindings