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/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "cc/output/managed_memory_policy.h" | 8 #include "cc/output/managed_memory_policy.h" |
9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
10 #include "cc/output/software_output_device.h" | 10 #include "cc/output/software_output_device.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider) | 25 explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider) |
26 : OutputSurface(context_provider) {} | 26 : OutputSurface(context_provider) {} |
27 | 27 |
28 explicit TestOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) | 28 explicit TestOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) |
29 : OutputSurface(software_device.Pass()) {} | 29 : OutputSurface(software_device.Pass()) {} |
30 | 30 |
31 TestOutputSurface(scoped_refptr<ContextProvider> context_provider, | 31 TestOutputSurface(scoped_refptr<ContextProvider> context_provider, |
32 scoped_ptr<SoftwareOutputDevice> software_device) | 32 scoped_ptr<SoftwareOutputDevice> software_device) |
33 : OutputSurface(context_provider, software_device.Pass()) {} | 33 : OutputSurface(context_provider, software_device.Pass()) {} |
34 | 34 |
35 virtual void SwapBuffers(CompositorFrame* frame) override { | 35 void SwapBuffers(CompositorFrame* frame) override { |
36 client_->DidSwapBuffers(); | 36 client_->DidSwapBuffers(); |
37 client_->DidSwapBuffersComplete(); | 37 client_->DidSwapBuffersComplete(); |
38 } | 38 } |
39 | 39 |
40 bool InitializeNewContext3d( | 40 bool InitializeNewContext3d( |
41 scoped_refptr<ContextProvider> new_context_provider) { | 41 scoped_refptr<ContextProvider> new_context_provider) { |
42 return InitializeAndSetContext3d(new_context_provider); | 42 return InitializeAndSetContext3d(new_context_provider); |
43 } | 43 } |
44 | 44 |
45 using OutputSurface::ReleaseGL; | 45 using OutputSurface::ReleaseGL; |
(...skipping 10 matching lines...) Expand all Loading... |
56 void DidSwapBuffersForTesting() { client_->DidSwapBuffers(); } | 56 void DidSwapBuffersForTesting() { client_->DidSwapBuffers(); } |
57 | 57 |
58 void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); } | 58 void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); } |
59 | 59 |
60 protected: | 60 protected: |
61 }; | 61 }; |
62 | 62 |
63 class TestSoftwareOutputDevice : public SoftwareOutputDevice { | 63 class TestSoftwareOutputDevice : public SoftwareOutputDevice { |
64 public: | 64 public: |
65 TestSoftwareOutputDevice(); | 65 TestSoftwareOutputDevice(); |
66 virtual ~TestSoftwareOutputDevice(); | 66 ~TestSoftwareOutputDevice() override; |
67 | 67 |
68 // Overriden from cc:SoftwareOutputDevice | 68 // Overriden from cc:SoftwareOutputDevice |
69 virtual void DiscardBackbuffer() override; | 69 void DiscardBackbuffer() override; |
70 virtual void EnsureBackbuffer() override; | 70 void EnsureBackbuffer() override; |
71 | 71 |
72 int discard_backbuffer_count() { return discard_backbuffer_count_; } | 72 int discard_backbuffer_count() { return discard_backbuffer_count_; } |
73 int ensure_backbuffer_count() { return ensure_backbuffer_count_; } | 73 int ensure_backbuffer_count() { return ensure_backbuffer_count_; } |
74 | 74 |
75 private: | 75 private: |
76 int discard_backbuffer_count_; | 76 int discard_backbuffer_count_; |
77 int ensure_backbuffer_count_; | 77 int ensure_backbuffer_count_; |
78 }; | 78 }; |
79 | 79 |
80 TestSoftwareOutputDevice::TestSoftwareOutputDevice() | 80 TestSoftwareOutputDevice::TestSoftwareOutputDevice() |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 223 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
224 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); | 224 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); |
225 output_surface.DiscardBackbuffer(); | 225 output_surface.DiscardBackbuffer(); |
226 | 226 |
227 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 227 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
228 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); | 228 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); |
229 } | 229 } |
230 | 230 |
231 } // namespace | 231 } // namespace |
232 } // namespace cc | 232 } // namespace cc |
OLD | NEW |