| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "cc/output/compositor_frame.h" | 6 #include "cc/output/compositor_frame.h" |
| 7 #include "cc/quads/texture_draw_quad.h" | 7 #include "cc/quads/texture_draw_quad.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "components/exo/buffer.h" | 10 #include "components/exo/buffer.h" |
| 11 #include "components/exo/surface.h" | 11 #include "components/exo/surface.h" |
| 12 #include "components/exo/test/exo_test_base.h" | 12 #include "components/exo/test/exo_test_base.h" |
| 13 #include "components/exo/test/exo_test_helper.h" | 13 #include "components/exo/test/exo_test_helper.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
| 16 #include "ui/compositor/layer_tree_owner.h" | 16 #include "ui/compositor/layer_tree_owner.h" |
| 17 #include "ui/gfx/gpu_memory_buffer.h" | 17 #include "ui/gfx/gpu_memory_buffer.h" |
| 18 #include "ui/wm/core/window_util.h" | 18 #include "ui/wm/core/window_util.h" |
| 19 | 19 |
| 20 namespace exo { | 20 namespace exo { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 using SurfaceTest = test::ExoTestBase; | 23 using SurfaceTest = test::ExoTestBase; |
| 24 | 24 |
| 25 void ReleaseBuffer(int* release_buffer_call_count) { | 25 void ReleaseBuffer(int* release_buffer_call_count) { |
| 26 (*release_buffer_call_count)++; | 26 (*release_buffer_call_count)++; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // SurafaceTest.Attach is failing |
| 29 TEST_F(SurfaceTest, Attach) { | 30 TEST_F(SurfaceTest, Attach) { |
| 30 gfx::Size buffer_size(256, 256); | 31 gfx::Size buffer_size(256, 256); |
| 31 std::unique_ptr<Buffer> buffer( | 32 std::unique_ptr<Buffer> buffer( |
| 32 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 33 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 33 | 34 |
| 34 // Set the release callback that will be run when buffer is no longer in use. | 35 // Set the release callback that will be run when buffer is no longer in use. |
| 35 int release_buffer_call_count = 0; | 36 int release_buffer_call_count = 0; |
| 36 buffer->set_release_callback( | 37 buffer->set_release_callback( |
| 37 base::Bind(&ReleaseBuffer, base::Unretained(&release_buffer_call_count))); | 38 base::Bind(&ReleaseBuffer, base::Unretained(&release_buffer_call_count))); |
| 38 | 39 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 241 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 241 std::unique_ptr<Surface> surface(new Surface); | 242 std::unique_ptr<Surface> surface(new Surface); |
| 242 | 243 |
| 243 surface->Attach(buffer.get()); | 244 surface->Attach(buffer.get()); |
| 244 surface->SetAlpha(0.5f); | 245 surface->SetAlpha(0.5f); |
| 245 surface->Commit(); | 246 surface->Commit(); |
| 246 } | 247 } |
| 247 | 248 |
| 248 TEST_F(SurfaceTest, Commit) { | 249 TEST_F(SurfaceTest, Commit) { |
| 249 std::unique_ptr<Surface> surface(new Surface); | 250 std::unique_ptr<Surface> surface(new Surface); |
| 250 | |
| 251 // Calling commit without a buffer should succeed. | 251 // Calling commit without a buffer should succeed. |
| 252 surface->Commit(); | 252 surface->Commit(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| 256 } // namespace exo | 256 } // namespace exo |
| OLD | NEW |