#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/tests/rect_blink.h"
#include "mojo/public/cpp/bindings/tests/rect_chromium.h"
#include "mojo/public/cpp/bindings/tests/struct_with_traits_impl.h"
#include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h"
#include "mojo/public/cpp/bindings/tests/variant_test_util.h"
#include "mojo/public/cpp/system/wait.h"
#include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-blink.h"
#include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace test {
namespace {
template <typename T>
void DoExpectResult(const T& expected,
base::OnceClosure callback,
const T& actual) { … }
template <typename T>
base::OnceCallback<void(const T&)> ExpectResult(const T& r,
base::OnceClosure callback) { … }
template <typename T>
void DoFail(const std::string& reason, const T&) { … }
template <typename T>
base::OnceCallback<void(const T&)> Fail(const std::string& reason) { … }
template <typename T>
void ExpectError(Remote<T>* proxy, base::OnceClosure callback) { … }
class ChromiumRectServiceImpl : public RectService { … };
class BlinkRectServiceImpl : public blink::RectService { … };
class StructTraitsTest : public testing::Test,
public TraitsTestService { … };
}
TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) { … }
TEST_F(StructTraitsTest, ChromiumToBlinkService) { … }
TEST_F(StructTraitsTest, BlinkProxyToBlinkService) { … }
TEST_F(StructTraitsTest, BlinkProxyToChromiumService) { … }
void ExpectStructWithTraits(const StructWithTraitsImpl& expected,
base::OnceClosure closure,
const StructWithTraitsImpl& passed) { … }
TEST_F(StructTraitsTest, EchoStructWithTraits) { … }
TEST_F(StructTraitsTest, CloneStructWithTraitsContainer) { … }
void ExpectTrivialStructWithTraits(TrivialStructWithTraitsImpl expected,
base::OnceClosure closure,
TrivialStructWithTraitsImpl passed) { … }
TEST_F(StructTraitsTest, EchoTrivialStructWithTraits) { … }
void CaptureMessagePipe(ScopedMessagePipeHandle* storage,
base::OnceClosure closure,
MoveOnlyStructWithTraitsImpl passed) { … }
TEST_F(StructTraitsTest, EchoMoveOnlyStructWithTraits) { … }
void CaptureNullableMoveOnlyStructWithTraitsImpl(
std::optional<MoveOnlyStructWithTraitsImpl>* storage,
base::OnceClosure closure,
std::optional<MoveOnlyStructWithTraitsImpl> passed) { … }
TEST_F(StructTraitsTest, EchoNullableMoveOnlyStructWithTraits) { … }
void ExpectEnumWithTraits(EnumWithTraitsImpl expected_value,
base::OnceClosure closure,
EnumWithTraitsImpl value) { … }
TEST_F(StructTraitsTest, EchoEnumWithTraits) { … }
TEST_F(StructTraitsTest, SerializeStructWithTraits) { … }
void ExpectUniquePtr(std::unique_ptr<int> expected,
base::OnceClosure closure,
std::unique_ptr<int> value) { … }
TEST_F(StructTraitsTest, TypemapUniquePtr) { … }
TEST_F(StructTraitsTest, EchoUnionWithTraits) { … }
TEST_F(StructTraitsTest, DefaultValueOfEnumWithTraits) { … }
}
}