| Index: mojo/public/cpp/bindings/tests/union_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/union_unittest.cc b/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| index 13f3b5e34d8622850f4b2d7e2e66f38020722021..6f14a1a59c4a371e619e8f972c9371c75d21195c 100644
|
| --- a/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| @@ -13,7 +13,6 @@
|
| #include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
|
| #include "mojo/public/cpp/bindings/lib/map_serialization.h"
|
| #include "mojo/public/cpp/bindings/string.h"
|
| -#include "mojo/public/cpp/environment/environment.h"
|
| #include "mojo/public/cpp/test_support/test_utils.h"
|
| #include "mojo/public/cpp/utility/run_loop.h"
|
| #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
|
| @@ -228,7 +227,6 @@ TEST(UnionTest, NullValidation) {
|
| }
|
|
|
| TEST(UnionTest, OutOfAlignmentValidation) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::PodUnion_Data);
|
| // Get an aligned object and shift the alignment.
|
| mojo::internal::FixedBufferForTesting aligned_buf(size + 1);
|
| @@ -246,7 +244,6 @@ TEST(UnionTest, OutOfAlignmentValidation) {
|
| }
|
|
|
| TEST(UnionTest, OOBValidation) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::PodUnion_Data) - 1;
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
|
| @@ -260,7 +257,6 @@ TEST(UnionTest, OOBValidation) {
|
| }
|
|
|
| TEST(UnionTest, UnknownTagDeserialization) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::PodUnion_Data);
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
|
| @@ -274,7 +270,6 @@ TEST(UnionTest, UnknownTagDeserialization) {
|
| }
|
|
|
| TEST(UnionTest, UnknownTagValidation) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::PodUnion_Data);
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
|
| @@ -345,7 +340,6 @@ TEST(UnionTest, StringSerialization) {
|
| }
|
|
|
| TEST(UnionTest, NullStringValidation) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::ObjectUnion_Data);
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
|
| @@ -362,7 +356,6 @@ TEST(UnionTest, NullStringValidation) {
|
| }
|
|
|
| TEST(UnionTest, StringPointerOverflowValidation) {
|
| - Environment environment;
|
| size_t size = sizeof(internal::ObjectUnion_Data);
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
|
| @@ -379,7 +372,6 @@ TEST(UnionTest, StringPointerOverflowValidation) {
|
| }
|
|
|
| TEST(UnionTest, StringValidateOOB) {
|
| - Environment environment;
|
| size_t size = 32;
|
| mojo::internal::FixedBufferForTesting buf(size);
|
| internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
|
| @@ -416,7 +408,6 @@ TEST(UnionTest, PodUnionInArray) {
|
| }
|
|
|
| TEST(UnionTest, PodUnionInArraySerialization) {
|
| - Environment environment;
|
| auto array = Array<PodUnionPtr>::New(2);
|
| array[0] = PodUnion::New();
|
| array[1] = PodUnion::New();
|
| @@ -443,7 +434,6 @@ TEST(UnionTest, PodUnionInArraySerialization) {
|
| }
|
|
|
| TEST(UnionTest, PodUnionInArrayValidation) {
|
| - Environment environment;
|
| auto array = Array<PodUnionPtr>::New(2);
|
| array[0] = PodUnion::New();
|
| array[1] = PodUnion::New();
|
| @@ -472,7 +462,6 @@ TEST(UnionTest, PodUnionInArrayValidation) {
|
| free(raw_buf);
|
| }
|
| TEST(UnionTest, PodUnionInArraySerializationWithNull) {
|
| - Environment environment;
|
| auto array = Array<PodUnionPtr>::New(2);
|
| array[0] = PodUnion::New();
|
|
|
| @@ -499,7 +488,6 @@ TEST(UnionTest, PodUnionInArraySerializationWithNull) {
|
| // TODO(azani): Move back in struct_unittest.cc when possible.
|
| // Struct tests
|
| TEST(UnionTest, Clone_Union) {
|
| - Environment environment;
|
| SmallStructPtr small_struct(SmallStruct::New());
|
| small_struct->pod_union = PodUnion::New();
|
| small_struct->pod_union->set_f_int8(10);
|
| @@ -510,7 +498,6 @@ TEST(UnionTest, Clone_Union) {
|
|
|
| // Serialization test of a struct with a union of plain old data.
|
| TEST(UnionTest, Serialization_UnionOfPods) {
|
| - Environment environment;
|
| SmallStructPtr small_struct(SmallStruct::New());
|
| small_struct->pod_union = PodUnion::New();
|
| small_struct->pod_union->set_f_int32(10);
|
| @@ -530,7 +517,6 @@ TEST(UnionTest, Serialization_UnionOfPods) {
|
|
|
| // Serialization test of a struct with a union of structs.
|
| TEST(UnionTest, Serialization_UnionOfObjects) {
|
| - Environment environment;
|
| SmallObjStructPtr obj_struct(SmallObjStruct::New());
|
| obj_struct->obj_union = ObjectUnion::New();
|
| String hello("hello world");
|
| @@ -555,7 +541,6 @@ TEST(UnionTest, Serialization_UnionOfObjects) {
|
|
|
| // Validation test of a struct with a union.
|
| TEST(UnionTest, Validation_UnionsInStruct) {
|
| - Environment environment;
|
| SmallStructPtr small_struct(SmallStruct::New());
|
| small_struct->pod_union = PodUnion::New();
|
| small_struct->pod_union->set_f_int32(10);
|
| @@ -582,7 +567,6 @@ TEST(UnionTest, Validation_UnionsInStruct) {
|
|
|
| // Validation test of a struct union fails due to unknown union tag.
|
| TEST(UnionTest, Validation_PodUnionInStruct_Failure) {
|
| - Environment environment;
|
| SmallStructPtr small_struct(SmallStruct::New());
|
| small_struct->pod_union = PodUnion::New();
|
| small_struct->pod_union->set_f_int32(10);
|
| @@ -610,7 +594,6 @@ TEST(UnionTest, Validation_PodUnionInStruct_Failure) {
|
|
|
| // Validation fails due to non-nullable null union in struct.
|
| TEST(UnionTest, Validation_NullUnion_Failure) {
|
| - Environment environment;
|
| SmallStructNonNullableUnionPtr small_struct(
|
| SmallStructNonNullableUnion::New());
|
|
|
| @@ -631,7 +614,6 @@ TEST(UnionTest, Validation_NullUnion_Failure) {
|
|
|
| // Validation passes with nullable null union.
|
| TEST(UnionTest, Validation_NullableUnion) {
|
| - Environment environment;
|
| SmallStructPtr small_struct(SmallStruct::New());
|
|
|
| size_t size = GetSerializedSize_(*small_struct);
|
| @@ -669,7 +651,6 @@ TEST(UnionTest, Deserialize_NullableUnion) {
|
|
|
| // Validation passes with nullable null union containing non-nullable objects.
|
| TEST(UnionTest, Validation_NullableObjectUnion) {
|
| - Environment environment;
|
| StructNullObjectUnionPtr small_struct(StructNullObjectUnion::New());
|
|
|
| size_t size = GetSerializedSize_(*small_struct);
|
| @@ -708,7 +689,6 @@ TEST(UnionTest, PodUnionInMap) {
|
| }
|
|
|
| TEST(UnionTest, PodUnionInMapSerialization) {
|
| - Environment environment;
|
| Map<String, PodUnionPtr> map;
|
| map.insert("one", PodUnion::New());
|
| map.insert("two", PodUnion::New());
|
| @@ -734,7 +714,6 @@ TEST(UnionTest, PodUnionInMapSerialization) {
|
| }
|
|
|
| TEST(UnionTest, PodUnionInMapSerializationWithNull) {
|
| - Environment environment;
|
| Map<String, PodUnionPtr> map;
|
| map.insert("one", PodUnion::New());
|
| map.insert("two", nullptr);
|
| @@ -769,7 +748,6 @@ TEST(UnionTest, StructInUnionGetterSetterPasser) {
|
| }
|
|
|
| TEST(UnionTest, StructInUnionSerialization) {
|
| - Environment environment;
|
| DummyStructPtr dummy(DummyStruct::New());
|
| dummy->f_int8 = 8;
|
|
|
| @@ -793,7 +771,6 @@ TEST(UnionTest, StructInUnionSerialization) {
|
| }
|
|
|
| TEST(UnionTest, StructInUnionValidation) {
|
| - Environment environment;
|
| DummyStructPtr dummy(DummyStruct::New());
|
| dummy->f_int8 = 8;
|
|
|
| @@ -820,7 +797,6 @@ TEST(UnionTest, StructInUnionValidation) {
|
| }
|
|
|
| TEST(UnionTest, StructInUnionValidationNonNullable) {
|
| - Environment environment;
|
| DummyStructPtr dummy(nullptr);
|
|
|
| ObjectUnionPtr obj(ObjectUnion::New());
|
| @@ -846,7 +822,6 @@ TEST(UnionTest, StructInUnionValidationNonNullable) {
|
| }
|
|
|
| TEST(UnionTest, StructInUnionValidationNullable) {
|
| - Environment environment;
|
| DummyStructPtr dummy(nullptr);
|
|
|
| ObjectUnionPtr obj(ObjectUnion::New());
|
| @@ -872,8 +847,6 @@ TEST(UnionTest, StructInUnionValidationNullable) {
|
| }
|
|
|
| TEST(UnionTest, ArrayInUnionGetterSetter) {
|
| - Environment environment;
|
| -
|
| auto array = Array<int8_t>::New(2);
|
| array[0] = 8;
|
| array[1] = 9;
|
| @@ -886,8 +859,6 @@ TEST(UnionTest, ArrayInUnionGetterSetter) {
|
| }
|
|
|
| TEST(UnionTest, ArrayInUnionSerialization) {
|
| - Environment environment;
|
| -
|
| auto array = Array<int8_t>::New(2);
|
| array[0] = 8;
|
| array[1] = 9;
|
| @@ -914,8 +885,6 @@ TEST(UnionTest, ArrayInUnionSerialization) {
|
| }
|
|
|
| TEST(UnionTest, ArrayInUnionValidation) {
|
| - Environment environment;
|
| -
|
| auto array = Array<int8_t>::New(2);
|
| array[0] = 8;
|
| array[1] = 9;
|
| @@ -943,7 +912,6 @@ TEST(UnionTest, ArrayInUnionValidation) {
|
| }
|
|
|
| TEST(UnionTest, MapInUnionGetterSetter) {
|
| - Environment environment;
|
| Map<String, int8_t> map;
|
| map.insert("one", 1);
|
| map.insert("two", 2);
|
| @@ -956,7 +924,6 @@ TEST(UnionTest, MapInUnionGetterSetter) {
|
| }
|
|
|
| TEST(UnionTest, MapInUnionSerialization) {
|
| - Environment environment;
|
| Map<String, int8_t> map;
|
| map.insert("one", 1);
|
| map.insert("two", 2);
|
| @@ -983,7 +950,6 @@ TEST(UnionTest, MapInUnionSerialization) {
|
| }
|
|
|
| TEST(UnionTest, MapInUnionValidation) {
|
| - Environment environment;
|
| Map<String, int8_t> map;
|
| map.insert("one", 1);
|
| map.insert("two", 2);
|
| @@ -1023,7 +989,6 @@ TEST(UnionTest, UnionInUnionGetterSetter) {
|
| }
|
|
|
| TEST(UnionTest, UnionInUnionSerialization) {
|
| - Environment environment;
|
| PodUnionPtr pod(PodUnion::New());
|
| pod->set_f_int8(10);
|
|
|
| @@ -1047,7 +1012,6 @@ TEST(UnionTest, UnionInUnionSerialization) {
|
| }
|
|
|
| TEST(UnionTest, UnionInUnionValidation) {
|
| - Environment environment;
|
| PodUnionPtr pod(PodUnion::New());
|
| pod->set_f_int8(10);
|
|
|
| @@ -1074,7 +1038,6 @@ TEST(UnionTest, UnionInUnionValidation) {
|
| }
|
|
|
| TEST(UnionTest, UnionInUnionValidationNonNullable) {
|
| - Environment environment;
|
| PodUnionPtr pod(nullptr);
|
|
|
| ObjectUnionPtr obj(ObjectUnion::New());
|
| @@ -1149,7 +1112,6 @@ TEST(UnionTest, HandleInUnionSerialization) {
|
| }
|
|
|
| TEST(UnionTest, HandleInUnionValidation) {
|
| - Environment environment;
|
| ScopedMessagePipeHandle pipe0;
|
| ScopedMessagePipeHandle pipe1;
|
|
|
| @@ -1178,7 +1140,6 @@ TEST(UnionTest, HandleInUnionValidation) {
|
| }
|
|
|
| TEST(UnionTest, HandleInUnionValidationNull) {
|
| - Environment environment;
|
| ScopedMessagePipeHandle pipe;
|
| HandleUnionPtr handle(HandleUnion::New());
|
| handle->set_f_message_pipe(pipe.Pass());
|
| @@ -1218,7 +1179,6 @@ class SmallCacheImpl : public SmallCache {
|
| };
|
|
|
| TEST(UnionTest, InterfaceInUnion) {
|
| - Environment env;
|
| RunLoop run_loop;
|
| SmallCacheImpl impl;
|
| SmallCachePtr ptr;
|
| @@ -1235,7 +1195,6 @@ TEST(UnionTest, InterfaceInUnion) {
|
| }
|
|
|
| TEST(UnionTest, InterfaceInUnionSerialization) {
|
| - Environment env;
|
| RunLoop run_loop;
|
| SmallCacheImpl impl;
|
| SmallCachePtr ptr;
|
| @@ -1277,7 +1236,6 @@ class UnionInterfaceImpl : public UnionInterface {
|
| };
|
|
|
| TEST(UnionTest, UnionInInterface) {
|
| - Environment env;
|
| RunLoop run_loop;
|
| UnionInterfaceImpl impl;
|
| UnionInterfacePtr ptr;
|
|
|