| Index: third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| index 65a23fad2ee1a94296c603f9fb0a5011633ecca6..3253232e435ad18815f52511b3f1ca52264bb9d8 100644
|
| --- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| +++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #include <vector>
|
| #include "mojo/public/cpp/bindings/array.h"
|
| -#include "mojo/public/cpp/bindings/binding.h"
|
| #include "mojo/public/cpp/bindings/lib/array_internal.h"
|
| #include "mojo/public/cpp/bindings/lib/array_serialization.h"
|
| #include "mojo/public/cpp/bindings/lib/bounds_checker.h"
|
| @@ -12,7 +11,6 @@
|
| #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"
|
| #include "mojo/public/interfaces/bindings/tests/test_unions.mojom.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -1045,90 +1043,5 @@ TEST(UnionTest, HandleInUnionValidationNull) {
|
| free(raw_buf);
|
| }
|
|
|
| -class SmallCacheImpl : public SmallCache {
|
| - public:
|
| - SmallCacheImpl() : int_value_(0) {}
|
| - ~SmallCacheImpl() override {}
|
| - int64_t int_value() const { return int_value_; }
|
| -
|
| - private:
|
| - void SetIntValue(int64_t int_value) override { int_value_ = int_value; }
|
| - void GetIntValue(const GetIntValueCallback& callback) override {
|
| - callback.Run(int_value_);
|
| - }
|
| -
|
| - int64_t int_value_;
|
| -};
|
| -
|
| -TEST(UnionTest, InterfaceInUnion) {
|
| - Environment env;
|
| - RunLoop run_loop;
|
| - SmallCacheImpl impl;
|
| - SmallCachePtr ptr;
|
| - Binding<SmallCache> bindings(&impl, GetProxy(&ptr));
|
| -
|
| - HandleUnionPtr handle(HandleUnion::New());
|
| - handle->set_f_small_cache(ptr.Pass());
|
| -
|
| - handle->get_f_small_cache()->SetIntValue(10);
|
| - run_loop.RunUntilIdle();
|
| - EXPECT_EQ(10, impl.int_value());
|
| -}
|
| -
|
| -TEST(UnionTest, InterfaceInUnionSerialization) {
|
| - Environment env;
|
| - RunLoop run_loop;
|
| - SmallCacheImpl impl;
|
| - SmallCachePtr ptr;
|
| - Binding<SmallCache> bindings(&impl, GetProxy(&ptr));
|
| -
|
| - HandleUnionPtr handle(HandleUnion::New());
|
| - handle->set_f_small_cache(ptr.Pass());
|
| - size_t size = GetSerializedSize_(handle, false);
|
| - EXPECT_EQ(16U, size);
|
| -
|
| - mojo::internal::FixedBuffer buf(size);
|
| - internal::HandleUnion_Data* data = nullptr;
|
| - SerializeUnion_(handle.Pass(), &buf, &data, false);
|
| -
|
| - std::vector<Handle> handles;
|
| - data->EncodePointersAndHandles(&handles);
|
| - EXPECT_EQ(1U, handles.size());
|
| - data->DecodePointersAndHandles(&handles);
|
| -
|
| - HandleUnionPtr handle2(HandleUnion::New());
|
| - Deserialize_(data, &handle2);
|
| -
|
| - handle2->get_f_small_cache()->SetIntValue(10);
|
| - run_loop.RunUntilIdle();
|
| - EXPECT_EQ(10, impl.int_value());
|
| -}
|
| -
|
| -class UnionInterfaceImpl : public UnionInterface {
|
| - public:
|
| - UnionInterfaceImpl() {}
|
| - ~UnionInterfaceImpl() override {}
|
| -
|
| - private:
|
| - void Echo(PodUnionPtr in, const EchoCallback& callback) override {
|
| - callback.Run(in.Pass());
|
| - }
|
| -};
|
| -
|
| -TEST(UnionTest, UnionInInterface) {
|
| - Environment env;
|
| - RunLoop run_loop;
|
| - UnionInterfaceImpl impl;
|
| - UnionInterfacePtr ptr;
|
| - Binding<UnionInterface> bindings(&impl, GetProxy(&ptr));
|
| -
|
| - PodUnionPtr pod(PodUnion::New());
|
| - pod->set_f_int16(16);
|
| -
|
| - ptr->Echo(pod.Pass(),
|
| - [](PodUnionPtr out) { EXPECT_EQ(16, out->get_f_int16()); });
|
| - run_loop.RunUntilIdle();
|
| -}
|
| -
|
| } // namespace test
|
| } // namespace mojo
|
|
|