| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 context_provider->SetMemoryAllocation(policy); | 202 context_provider->SetMemoryAllocation(policy); |
| 203 EXPECT_EQ(1234u, client.memory_policy().bytes_limit_when_visible); | 203 EXPECT_EQ(1234u, client.memory_policy().bytes_limit_when_visible); |
| 204 } | 204 } |
| 205 | 205 |
| 206 TEST(OutputSurfaceTest, SoftwareOutputDeviceBackbufferManagement) { | 206 TEST(OutputSurfaceTest, SoftwareOutputDeviceBackbufferManagement) { |
| 207 TestSoftwareOutputDevice* software_output_device = | 207 TestSoftwareOutputDevice* software_output_device = |
| 208 new TestSoftwareOutputDevice(); | 208 new TestSoftwareOutputDevice(); |
| 209 | 209 |
| 210 // TestOutputSurface now owns software_output_device and has responsibility to | 210 // TestOutputSurface now owns software_output_device and has responsibility to |
| 211 // free it. | 211 // free it. |
| 212 TestOutputSurface output_surface(make_scoped_ptr(software_output_device)); | 212 scoped_ptr<TestSoftwareOutputDevice> p(software_output_device); |
| 213 TestOutputSurface output_surface(p.PassAs<SoftwareOutputDevice>()); |
| 213 | 214 |
| 214 EXPECT_EQ(0, software_output_device->ensure_backbuffer_count()); | 215 EXPECT_EQ(0, software_output_device->ensure_backbuffer_count()); |
| 215 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); | 216 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); |
| 216 | 217 |
| 217 output_surface.EnsureBackbuffer(); | 218 output_surface.EnsureBackbuffer(); |
| 218 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 219 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
| 219 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); | 220 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); |
| 220 output_surface.DiscardBackbuffer(); | 221 output_surface.DiscardBackbuffer(); |
| 221 | 222 |
| 222 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 223 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |
| 223 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); | 224 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace | 227 } // namespace |
| 227 } // namespace cc | 228 } // namespace cc |
| OLD | NEW |