chromium/mojo/public/cpp/bindings/tests/union_unittest.cc

// Copyright 2014 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 <stddef.h>
#include <stdint.h>
#include <utility>
#include <vector>

#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/lib/array_internal.h"
#include "mojo/public/cpp/bindings/lib/message_fragment.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/tests/union_unittest.test-mojom.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_unions.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo {
namespace test {
namespace union_unittest {

template <typename InputType, typename DataType>
size_t SerializeStruct(InputType& input,
                       mojo::Message* message,
                       DataType** out_data) {}

template <typename InputType, typename DataType>
size_t SerializeUnion(InputType& input,
                      mojo::Message* message,
                      DataType** out_data = nullptr) {}

template <typename DataViewType, bool nullable_elements, typename InputType>
size_t SerializeArray(InputType& input,
                      mojo::Message* message,
                      typename DataViewType::Data_** out_data) {}

TEST(UnionTest, PlainOldDataGetterSetter) {}

TEST(UnionTest, PlainOldDataFactoryFunction) {}

TEST(UnionTest, PodEquals) {}

TEST(UnionTest, PodClone) {}

TEST(UnionTest, PodSerialization) {}

TEST(UnionTest, EnumSerialization) {}

TEST(UnionTest, PodValidation) {}

TEST(UnionTest, SerializeNotNull) {}

TEST(UnionTest, SerializeIsNullInlined) {}

TEST(UnionTest, SerializeIsNullNotInlined) {}

TEST(UnionTest, NullValidation) {}

TEST(UnionTest, OOBValidation) {}

TEST(UnionTest, UnknownTagValidation) {}

TEST(UnionTest, UnknownEnumValueValidation) {}

TEST(UnionTest, UnknownExtensibleEnumValueValidation) {}

TEST(UnionTest, StringGetterSetter) {}

TEST(UnionTest, StringFactoryFunction) {}

TEST(UnionTest, StringEquals) {}

TEST(UnionTest, StringClone) {}

TEST(UnionTest, StringSerialization) {}

TEST(UnionTest, NullStringValidation) {}

TEST(UnionTest, StringPointerOverflowValidation) {}

TEST(UnionTest, StringValidateOOB) {}

// TODO(azani): Move back in array_unittest.cc when possible.
// Array tests
TEST(UnionTest, PodUnionInArray) {}

TEST(UnionTest, PodUnionInArraySerialization) {}

TEST(UnionTest, PodUnionInArraySerializationWithNull) {}

TEST(UnionTest, ObjectUnionInArraySerialization) {}

// TODO(azani): Move back in struct_unittest.cc when possible.
// Struct tests
TEST(UnionTest, Clone_Union) {}

// Serialization test of a struct with a union of plain old data.
TEST(UnionTest, Serialization_UnionOfPods) {}

// Serialization test of a struct with a union of structs.
TEST(UnionTest, Serialization_UnionOfObjects) {}

// Validation test of a struct with a union.
TEST(UnionTest, Validation_UnionsInStruct) {}

// Validation test of a struct union fails due to unknown union tag.
TEST(UnionTest, Validation_PodUnionInStruct_Failure) {}

// Validation fails due to non-nullable null union in struct.
TEST(UnionTest, Validation_NullUnion_Failure) {}

// Validation passes with nullable null union.
TEST(UnionTest, Validation_NullableUnion) {}

// TODO(azani): Move back in map_unittest.cc when possible.
// Map Tests
TEST(UnionTest, PodUnionInMap) {}

TEST(UnionTest, PodUnionInMapSerialization) {}

TEST(UnionTest, PodUnionInMapSerializationWithNull) {}

TEST(UnionTest, StructInUnionGetterSetterPasser) {}

TEST(UnionTest, StructInUnionSerialization) {}

TEST(UnionTest, StructInUnionValidation) {}

TEST(UnionTest, StructInUnionValidationNonNullable) {}

TEST(UnionTest, StructInUnionValidationNullable) {}

TEST(UnionTest, ArrayInUnionGetterSetter) {}

TEST(UnionTest, ArrayInUnionSerialization) {}

TEST(UnionTest, ArrayInUnionValidation) {}

TEST(UnionTest, MapInUnionGetterSetter) {}

TEST(UnionTest, MapInUnionSerialization) {}

TEST(UnionTest, MapInUnionValidation) {}

TEST(UnionTest, UnionInUnionGetterSetter) {}

TEST(UnionTest, UnionInUnionFactoryFunction) {}

TEST(UnionTest, UnionInUnionSerialization) {}

TEST(UnionTest, UnionInUnionValidation) {}

TEST(UnionTest, UnionInUnionValidationNonNullable) {}

TEST(UnionTest, HandleInUnionGetterSetter) {}

TEST(UnionTest, HandleInUnionGetterFactoryFunction) {}

TEST(UnionTest, HandleInUnionSerialization) {}

TEST(UnionTest, HandleInUnionValidation) {}

TEST(UnionTest, HandleInUnionValidationNull) {}

class SmallCacheImpl : public SmallCache {};

TEST(UnionTest, InterfaceInUnion) {}

TEST(UnionTest, InterfaceInUnionFactoryFunction) {}

TEST(UnionTest, InterfaceInUnionSerialization) {}

class UnionInterfaceImpl : public UnionInterface {};

TEST(UnionTest, UnionInInterface) {}

TEST(UnionTest, InlineUnionAllocationWithNonPODFirstField) {}

class ExtensibleTestUnionExchange
    : public mojom::ExtensibleTestUnionExchangeV1 {};

TEST(UnionTest, ExtensibleUnion) {}

}  // namespace union_unittest
}  // namespace test
}  // namespace mojo