chromium/third_party/perfetto/src/ipc/deferred_unittest.cc

/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "perfetto/ext/ipc/deferred.h"

#include "perfetto/base/logging.h"
#include "test/gtest_and_gmock.h"

#include "src/ipc/test/deferred_unittest_messages.gen.h"

namespace perfetto {
namespace ipc {
namespace {

using ::perfetto::ipc::gen::TestMessage;

#if PERFETTO_DCHECK_IS_ON()
#define EXPECT_DCHECK(x)
#else
#define EXPECT_DCHECK
#endif

TEST(DeferredTest, BindAndResolve) {}

// In case of a Reject() a callback with a nullptr should be received.
TEST(DeferredTest, BindAndFail) {}

// Test the RAII behavior.
TEST(DeferredTest, AutoRejectIfOutOfScope) {}

// Binds two callbacks one after the other and tests that the bind state of the
// first callback is released.
TEST(DeferredTest, BindTwiceDoesNotHoldBindState) {}

TEST(DeferredTest, MoveOperators) {}

// Covers the case of a streaming reply, where the deferred keeps being resolved
// until has_more == true.
TEST(DeferredTest, StreamingReply) {}

// Similar to the above, but checks that destroying a Deferred without having
// resolved with has_more == true automatically rejects once out of scope.
TEST(DeferredTest, StreamingReplyIsRejectedOutOfScope) {}

// Tests that a Deferred<Specialized> still behaves sanely after it has been
// moved into a DeferredBase.
TEST(DeferredTest, MoveAsBase) {}

}  // namespace
}  // namespace ipc
}  // namespace perfetto