chromium/mojo/core/message_pipe_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include <stdint.h>
#include <string.h>

#include <algorithm>
#include <memory>
#include <string>
#include <vector>

#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "build/blink_buildflags.h"
#include "build/build_config.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/core/test/mojo_test_base.h"
#include "mojo/public/c/system/core.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/cpp/system/message_pipe.h"

namespace mojo {
namespace core {
namespace {

const MojoHandleSignals kAllSignals =;

static const char kHelloWorld[] =;

class MessagePipeTest : public test::MojoTestBase {};

FuseMessagePipeTest;

TEST_F(MessagePipeTest, WriteData) {}

// Tests:
//  - only default flags
//  - reading messages from a port
//    - when there are no/one/two messages available for that port
//    - with buffer size 0 (and null buffer) -- should get size
//    - with too-small buffer -- should get size
//    - also verify that buffers aren't modified when/where they shouldn't be
//  - writing messages to a port
//    - in the obvious scenarios (as above)
//    - to a port that's been closed
//  - writing a message to a port, closing the other (would be the source) port,
//    and reading it
TEST_F(MessagePipeTest, Basic) {}

TEST_F(MessagePipeTest, CloseWithQueuedIncomingMessages) {}

TEST_F(MessagePipeTest, BasicWaiting) {}

#if BUILDFLAG(USE_BLINK)

const size_t kPingPongHandlesPerIteration =;
const size_t kPingPongIterations =;

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(HandlePingPong, MessagePipeTest, h) {}

TEST_F(MessagePipeTest, DataPipeConsumerHandlePingPong) {}

TEST_F(MessagePipeTest, DataPipeProducerHandlePingPong) {}

#if BUILDFLAG(IS_IOS)
// TODO(crbug.com/40257752): Test currently fails on iOS.
#define MAYBE_SharedBufferHandlePingPong
#else
#define MAYBE_SharedBufferHandlePingPong
#endif  // BUILDFLAG(IS_IOS)
TEST_F(MessagePipeTest, MAYBE_SharedBufferHandlePingPong) {}

#endif  // BUILDFLAG(USE_BLINK)

TEST_F(FuseMessagePipeTest, Basic) {}

TEST_F(FuseMessagePipeTest, FuseAfterPeerWrite) {}

TEST_F(FuseMessagePipeTest, NoFuseAfterWrite) {}

TEST_F(FuseMessagePipeTest, NoFuseSelf) {}

TEST_F(FuseMessagePipeTest, FuseInvalidArguments) {}

TEST_F(FuseMessagePipeTest, FuseAfterPeerClosure) {}

TEST_F(FuseMessagePipeTest, FuseAfterPeerWriteAndClosure) {}

TEST_F(MessagePipeTest, ClosePipesStressTest) {}

}  // namespace
}  // namespace core
}  // namespace mojo