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/output_surface.h" | 5 #include "cc/output/output_surface.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
9 #include "cc/output/managed_memory_policy.h" | 9 #include "cc/output/managed_memory_policy.h" |
10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 std::unique_ptr<SoftwareOutputDevice> software_device) | 36 std::unique_ptr<SoftwareOutputDevice> software_device) |
37 : OutputSurface(nullptr, nullptr, std::move(software_device)) {} | 37 : OutputSurface(nullptr, nullptr, std::move(software_device)) {} |
38 | 38 |
39 TestOutputSurface(scoped_refptr<TestContextProvider> context_provider, | 39 TestOutputSurface(scoped_refptr<TestContextProvider> context_provider, |
40 std::unique_ptr<SoftwareOutputDevice> software_device) | 40 std::unique_ptr<SoftwareOutputDevice> software_device) |
41 : OutputSurface(std::move(context_provider), | 41 : OutputSurface(std::move(context_provider), |
42 nullptr, | 42 nullptr, |
43 std::move(software_device)) {} | 43 std::move(software_device)) {} |
44 | 44 |
45 void SwapBuffers(CompositorFrame frame) override { | 45 void SwapBuffers(CompositorFrame frame) override { |
46 client_->DidSwapBuffers(); | |
47 client_->DidSwapBuffersComplete(); | 46 client_->DidSwapBuffersComplete(); |
48 } | 47 } |
49 uint32_t GetFramebufferCopyTextureFormat() override { | 48 uint32_t GetFramebufferCopyTextureFormat() override { |
50 // TestContextProvider has no real framebuffer, just use RGB. | 49 // TestContextProvider has no real framebuffer, just use RGB. |
51 return GL_RGB; | 50 return GL_RGB; |
52 } | 51 } |
53 | 52 |
54 void DidSwapBuffersForTesting() { client_->DidSwapBuffers(); } | |
55 | |
56 void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); } | 53 void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); } |
57 | 54 |
58 protected: | 55 protected: |
59 }; | 56 }; |
60 | 57 |
61 class TestSoftwareOutputDevice : public SoftwareOutputDevice { | 58 class TestSoftwareOutputDevice : public SoftwareOutputDevice { |
62 public: | 59 public: |
63 TestSoftwareOutputDevice(); | 60 TestSoftwareOutputDevice(); |
64 ~TestSoftwareOutputDevice() override; | 61 ~TestSoftwareOutputDevice() override; |
65 | 62 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 155 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
159 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); | 156 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); |
160 output_surface.DiscardBackbuffer(); | 157 output_surface.DiscardBackbuffer(); |
161 | 158 |
162 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 159 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
163 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); | 160 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); |
164 } | 161 } |
165 | 162 |
166 } // namespace | 163 } // namespace |
167 } // namespace cc | 164 } // namespace cc |
OLD | NEW |