OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 11 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
11 #include "ui/ozone/platform/drm/gpu/fake_plane_info.h" | 12 #include "ui/ozone/platform/drm/gpu/fake_plane_info.h" |
12 #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" | 13 #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" |
13 #include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" | 14 #include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" |
14 #include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" | 15 #include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const ui::FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; | 19 const ui::FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; |
19 const ui::FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, | 20 const ui::FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, |
20 {11, 1}, | 21 {11, 1}, |
21 {20, 2}, | 22 {20, 2}, |
22 {21, 2}}; | 23 {21, 2}}; |
23 const ui::FakePlaneInfo kOnePlanePerCrtcWithShared[] = {{10, 1}, | 24 const ui::FakePlaneInfo kOnePlanePerCrtcWithShared[] = {{10, 1}, |
24 {20, 2}, | 25 {20, 2}, |
25 {50, 3}}; | 26 {50, 3}}; |
26 const uint32_t kDummyFormat = 0; | 27 const uint32_t kDummyFormat = 0; |
27 const gfx::Size kDefaultBufferSize(2, 2); | 28 const gfx::Size kDefaultBufferSize(2, 2); |
28 | 29 |
29 class HardwareDisplayPlaneManagerTest : public testing::Test { | 30 class HardwareDisplayPlaneManagerTest : public testing::Test { |
30 public: | 31 public: |
31 HardwareDisplayPlaneManagerTest() {} | 32 HardwareDisplayPlaneManagerTest() {} |
32 | 33 |
33 void SetUp() override; | 34 void SetUp() override; |
34 | 35 |
35 protected: | 36 protected: |
36 scoped_ptr<ui::MockHardwareDisplayPlaneManager> plane_manager_; | 37 std::unique_ptr<ui::MockHardwareDisplayPlaneManager> plane_manager_; |
37 ui::HardwareDisplayPlaneList state_; | 38 ui::HardwareDisplayPlaneList state_; |
38 std::vector<uint32_t> default_crtcs_; | 39 std::vector<uint32_t> default_crtcs_; |
39 scoped_refptr<ui::ScanoutBuffer> fake_buffer_; | 40 scoped_refptr<ui::ScanoutBuffer> fake_buffer_; |
40 scoped_refptr<ui::MockDrmDevice> fake_drm_; | 41 scoped_refptr<ui::MockDrmDevice> fake_drm_; |
41 | 42 |
42 private: | 43 private: |
43 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerTest); | 44 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManagerTest); |
44 }; | 45 }; |
45 | 46 |
46 void HardwareDisplayPlaneManagerTest::SetUp() { | 47 void HardwareDisplayPlaneManagerTest::SetUp() { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 assigns.push_back(ui::OverlayPlane(primary_buffer)); | 222 assigns.push_back(ui::OverlayPlane(primary_buffer)); |
222 drm->plane_manager()->BeginFrame(&hdpl); | 223 drm->plane_manager()->BeginFrame(&hdpl); |
223 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, | 224 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, |
224 crtcs[0], &crtc)); | 225 crtcs[0], &crtc)); |
225 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); | 226 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); |
226 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); | 227 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); |
227 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); | 228 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); |
228 } | 229 } |
229 | 230 |
230 } // namespace | 231 } // namespace |
OLD | NEW |