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 | 25 |
26 void SwapBuffers(CompositorFrame frame) override { | 26 void SubmitCompositorFrame(CompositorFrame frame) override { |
27 client_->DidSwapBuffersComplete(); | 27 client_->DidReceiveCompositorFrameAck(); |
28 } | 28 } |
29 | |
30 void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); } | |
31 | |
32 protected: | |
33 }; | 29 }; |
34 | 30 |
35 TEST(CompositorFrameSinkTest, ContextLossInformsClient) { | 31 TEST(CompositorFrameSinkTest, ContextLossInformsClient) { |
36 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); | 32 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); |
37 scoped_refptr<TestContextProvider> worker_provider = | 33 scoped_refptr<TestContextProvider> worker_provider = |
38 TestContextProvider::CreateWorker(); | 34 TestContextProvider::CreateWorker(); |
39 TestCompositorFrameSink compositor_frame_sink(provider, worker_provider); | 35 TestCompositorFrameSink compositor_frame_sink(provider, worker_provider); |
40 EXPECT_FALSE(compositor_frame_sink.HasClient()); | 36 EXPECT_FALSE(compositor_frame_sink.HasClient()); |
41 | 37 |
42 FakeCompositorFrameSinkClient client; | 38 FakeCompositorFrameSinkClient client; |
(...skipping 23 matching lines...) Expand all Loading... |
66 worker_provider); | 62 worker_provider); |
67 EXPECT_FALSE(compositor_frame_sink.HasClient()); | 63 EXPECT_FALSE(compositor_frame_sink.HasClient()); |
68 | 64 |
69 FakeCompositorFrameSinkClient client; | 65 FakeCompositorFrameSinkClient client; |
70 EXPECT_FALSE(compositor_frame_sink.BindToClient(&client)); | 66 EXPECT_FALSE(compositor_frame_sink.BindToClient(&client)); |
71 EXPECT_FALSE(compositor_frame_sink.HasClient()); | 67 EXPECT_FALSE(compositor_frame_sink.HasClient()); |
72 } | 68 } |
73 | 69 |
74 } // namespace | 70 } // namespace |
75 } // namespace cc | 71 } // namespace cc |
OLD | NEW |