chromium/mojo/core/trap_unittest.cc

// Copyright 2017 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 <map>
#include <memory>
#include <set>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/rand_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/bind.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "base/time/time.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/core/test/mojo_test_base.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/trap.h"
#include "mojo/public/c/system/types.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo {
namespace core {
namespace {

TrapTest;

class TriggerHelper {};

class ThreadedRunner : public base::SimpleThread {};

void ExpectNoNotification(const MojoTrapEvent* event) {}

void ExpectOnlyCancel(const MojoTrapEvent* event) {}

TEST_F(TrapTest, InvalidArguments) {}

TEST_F(TrapTest, TrapMessagePipeReadable) {}

TEST_F(TrapTest, CloseWatchedMessagePipeHandle) {}

TEST_F(TrapTest, CloseWatchedMessagePipeHandlePeer) {}

TEST_F(TrapTest, TrapDataPipeConsumerReadable) {}

TEST_F(TrapTest, TrapDataPipeConsumerNewDataReadable) {}

TEST_F(TrapTest, TrapDataPipeProducerWritable) {}

TEST_F(TrapTest, CloseWatchedDataPipeConsumerHandle) {}

TEST_F(TrapTest, CloseWatchedDataPipeConsumerHandlePeer) {}

TEST_F(TrapTest, CloseWatchedDataPipeProducerHandle) {}

TEST_F(TrapTest, CloseWatchedDataPipeProducerHandlePeer) {}

TEST_F(TrapTest, ArmWithNoTriggers) {}

TEST_F(TrapTest, DuplicateTriggerContext) {}

TEST_F(TrapTest, RemoveUnknownTrigger) {}

TEST_F(TrapTest, ArmWithTriggerConditionAlreadySatisfied) {}

TEST_F(TrapTest, ArmWithTriggerConditionAlreadyUnsatisfiable) {}

TEST_F(TrapTest, MultipleTriggers) {}

TEST_F(TrapTest, ActivateOtherTriggerFromEventHandler) {}

TEST_F(TrapTest, ActivateSameTriggerFromEventHandler) {}

TEST_F(TrapTest, ImplicitRemoveOtherTriggerWithinEventHandler) {}

TEST_F(TrapTest, ExplicitRemoveOtherTriggerWithinEventHandler) {}

TEST_F(TrapTest, NestedCancellation) {}

TEST_F(TrapTest, RemoveSelfWithinEventHandler) {}

TEST_F(TrapTest, CloseTrapWithinEventHandler) {}

TEST_F(TrapTest, CloseTrapAfterImplicitTriggerRemoval) {}

TEST_F(TrapTest, OtherThreadRemovesTriggerDuringEventHandler) {}

TEST_F(TrapTest, TriggersRemoveEachOtherWithinEventHandlers) {}

TEST_F(TrapTest, AlwaysCancel) {}

TEST_F(TrapTest, ArmFailureCirculation) {}

TEST_F(TrapTest, TriggerOnUnsatisfiedSignals) {}

TEST_F(TrapTest, TriggerDuringDestruction) {}

TEST_F(TrapTest, RaceDispatchAndBlockedCancel) {}

base::RepeatingClosure g_do_random_thing_callback;

void ReadAllMessages(const MojoTrapEvent* event) {}

MojoHandle RandomHandle(MojoHandle* handles, size_t size) {}

void DoRandomThing(MojoHandle* traps,
                   size_t num_traps,
                   MojoHandle* watched_handles,
                   size_t num_watched_handles) {}

TEST_F(TrapTest, ConcurrencyStressTest) {}

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