| Index: cc/ipc/struct_traits_unittest.cc
|
| diff --git a/cc/ipc/struct_traits_unittest.cc b/cc/ipc/struct_traits_unittest.cc
|
| index 5d22e492c579dd577f6d3141de592f2a9663a9d4..6f4e318c9e03537fee860008652564521ab8c1ec 100644
|
| --- a/cc/ipc/struct_traits_unittest.cc
|
| +++ b/cc/ipc/struct_traits_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/message_loop/message_loop.h"
|
| +#include "base/run_loop.h"
|
| #include "cc/input/selection.h"
|
| #include "cc/ipc/traits_test_service.mojom.h"
|
| #include "cc/output/copy_output_result.h"
|
| @@ -91,6 +92,12 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
|
| callback.Run(s);
|
| }
|
|
|
| + void EchoSingleReleaseCallback(
|
| + std::unique_ptr<SingleReleaseCallback> s,
|
| + const EchoSingleReleaseCallbackCallback& callback) override {
|
| + callback.Run(std::move(s));
|
| + }
|
| +
|
| void EchoSharedQuadState(
|
| const SharedQuadState& s,
|
| const EchoSharedQuadStateCallback& callback) override {
|
| @@ -129,6 +136,26 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
|
| DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
|
| };
|
|
|
| +class TextureMailboxReleaserImpl : public mojom::TextureMailboxReleaser {
|
| + public:
|
| + TextureMailboxReleaserImpl(mojom::TextureMailboxReleaserRequest request,
|
| + base::Closure quit_closure)
|
| + : quit_closure_(quit_closure), binding_(this, std::move(request)) {}
|
| +
|
| + bool is_called() { return is_called_; }
|
| +
|
| + // mojom::TextureMailboxReleaser implementation:
|
| + void Release(const gpu::SyncToken& sync_token, bool is_lost) override {
|
| + is_called_ = true;
|
| + quit_closure_.Run();
|
| + }
|
| +
|
| + private:
|
| + bool is_called_ = false;
|
| + base::Closure quit_closure_;
|
| + mojo::Binding<mojom::TextureMailboxReleaser> binding_;
|
| +};
|
| +
|
| void StubCopyOutputRequestCallback(std::unique_ptr<CopyOutputResult> result) {}
|
|
|
| void StubCopyOutputResultCallback(const gpu::SyncToken& sync_token,
|
| @@ -861,6 +888,23 @@ TEST_F(StructTraitsTest, Selection) {
|
| EXPECT_EQ(is_empty_text_form_control, output.is_empty_text_form_control);
|
| }
|
|
|
| +TEST_F(StructTraitsTest, SingleReleaseCallback) {
|
| + base::RunLoop run_loop;
|
| + mojom::TextureMailboxReleaserPtr releaser;
|
| + TextureMailboxReleaserImpl impl(MakeRequest(&releaser),
|
| + run_loop.QuitClosure());
|
| + auto input = SingleReleaseCallback::Create(std::move(releaser));
|
| +
|
| + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
|
| + std::unique_ptr<SingleReleaseCallback> output;
|
| + proxy->EchoSingleReleaseCallback(std::move(input), &output);
|
| +
|
| + EXPECT_FALSE(impl.is_called());
|
| + output->Run(gpu::SyncToken(), true);
|
| + run_loop.Run();
|
| + EXPECT_TRUE(impl.is_called());
|
| +}
|
| +
|
| TEST_F(StructTraitsTest, SurfaceId) {
|
| static constexpr FrameSinkId frame_sink_id(1337, 1234);
|
| static LocalSurfaceId local_surface_id(0xfbadbeef,
|
|
|