| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/compositor_frame_sink.h" | 5 #include "cc/output/compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/test/fake_compositor_frame_sink_client.h" | 9 #include "cc/test/fake_compositor_frame_sink_client.h" |
| 10 #include "cc/test/test_context_provider.h" | 10 #include "cc/test/test_context_provider.h" |
| 11 #include "cc/test/test_web_graphics_context_3d.h" | 11 #include "cc/test/test_web_graphics_context_3d.h" |
| 12 #include "gpu/GLES2/gl2extchromium.h" | 12 #include "gpu/GLES2/gl2extchromium.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class TestCompositorFrameSink : public CompositorFrameSink { | 18 class TestCompositorFrameSink : public CompositorFrameSink { |
| 19 public: | 19 public: |
| 20 explicit TestCompositorFrameSink( | 20 explicit TestCompositorFrameSink( |
| 21 scoped_refptr<TestContextProvider> context_provider, | 21 scoped_refptr<TestContextProvider> context_provider, |
| 22 scoped_refptr<TestContextProvider> worker_context_provider) | 22 scoped_refptr<TestContextProvider> worker_context_provider) |
| 23 : CompositorFrameSink(std::move(context_provider), | 23 : CompositorFrameSink(std::move(context_provider), |
| 24 std::move(worker_context_provider)) {} | 24 std::move(worker_context_provider), |
| 25 nullptr, |
| 26 nullptr) {} |
| 25 | 27 |
| 26 void SubmitCompositorFrame(CompositorFrame frame) override { | 28 void SubmitCompositorFrame(CompositorFrame frame) override { |
| 27 client_->DidReceiveCompositorFrameAck(); | 29 client_->DidReceiveCompositorFrameAck(); |
| 28 } | 30 } |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 TEST(CompositorFrameSinkTest, ContextLossInformsClient) { | 33 TEST(CompositorFrameSinkTest, ContextLossInformsClient) { |
| 32 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); | 34 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); |
| 33 scoped_refptr<TestContextProvider> worker_provider = | 35 scoped_refptr<TestContextProvider> worker_provider = |
| 34 TestContextProvider::CreateWorker(); | 36 TestContextProvider::CreateWorker(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 62 worker_provider); | 64 worker_provider); |
| 63 EXPECT_FALSE(compositor_frame_sink.HasClient()); | 65 EXPECT_FALSE(compositor_frame_sink.HasClient()); |
| 64 | 66 |
| 65 FakeCompositorFrameSinkClient client; | 67 FakeCompositorFrameSinkClient client; |
| 66 EXPECT_FALSE(compositor_frame_sink.BindToClient(&client)); | 68 EXPECT_FALSE(compositor_frame_sink.BindToClient(&client)); |
| 67 EXPECT_FALSE(compositor_frame_sink.HasClient()); | 69 EXPECT_FALSE(compositor_frame_sink.HasClient()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 } // namespace | 72 } // namespace |
| 71 } // namespace cc | 73 } // namespace cc |
| OLD | NEW |