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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "third_party/skia/include/core/SkCanvas.h" | 6 #include "third_party/skia/include/core/SkCanvas.h" |
7 #include "ui/ozone/platform/dri/dri_buffer.h" | 7 #include "ui/ozone/platform/dri/dri_buffer.h" |
8 #include "ui/ozone/platform/dri/dri_surface.h" | 8 #include "ui/ozone/platform/dri/dri_surface.h" |
9 #include "ui/ozone/platform/dri/dri_wrapper.h" | 9 #include "ui/ozone/platform/dri/dri_wrapper.h" |
10 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 10 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 drm_.reset(new ui::MockDriWrapper(3)); | 40 drm_.reset(new ui::MockDriWrapper(3)); |
41 controller_.reset(new ui::HardwareDisplayController(drm_.get(), 1, 1)); | 41 controller_.reset(new ui::HardwareDisplayController(drm_.get(), 1, 1)); |
42 } | 42 } |
43 | 43 |
44 void HardwareDisplayControllerTest::TearDown() { | 44 void HardwareDisplayControllerTest::TearDown() { |
45 controller_.reset(); | 45 controller_.reset(); |
46 drm_.reset(); | 46 drm_.reset(); |
47 } | 47 } |
48 | 48 |
49 TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) { | 49 TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) { |
50 scoped_ptr<ui::DriSurface> surface( | 50 scoped_ptr<ui::ScanoutSurface> surface( |
51 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); | 51 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); |
52 | 52 |
53 EXPECT_TRUE(surface->Initialize()); | 53 EXPECT_TRUE(surface->Initialize()); |
54 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), | 54 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), |
55 kDefaultMode)); | 55 kDefaultMode)); |
56 EXPECT_TRUE(controller_->surface() != NULL); | 56 EXPECT_TRUE(controller_->surface() != NULL); |
57 } | 57 } |
58 | 58 |
59 TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) { | 59 TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) { |
60 scoped_ptr<ui::DriSurface> surface( | 60 scoped_ptr<ui::ScanoutSurface> surface( |
61 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); | 61 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); |
62 | 62 |
63 EXPECT_TRUE(surface->Initialize()); | 63 EXPECT_TRUE(surface->Initialize()); |
64 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), | 64 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), |
65 kDefaultMode)); | 65 kDefaultMode)); |
66 EXPECT_TRUE(controller_->SchedulePageFlip()); | 66 EXPECT_TRUE(controller_->SchedulePageFlip()); |
67 EXPECT_TRUE(controller_->surface() != NULL); | 67 EXPECT_TRUE(controller_->surface() != NULL); |
68 } | 68 } |
69 | 69 |
70 TEST_F(HardwareDisplayControllerTest, CheckStateIfModesetFails) { | 70 TEST_F(HardwareDisplayControllerTest, CheckStateIfModesetFails) { |
71 drm_->set_set_crtc_expectation(false); | 71 drm_->set_set_crtc_expectation(false); |
72 | 72 |
73 scoped_ptr<ui::DriSurface> surface( | 73 scoped_ptr<ui::ScanoutSurface> surface( |
74 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); | 74 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); |
75 | 75 |
76 EXPECT_TRUE(surface->Initialize()); | 76 EXPECT_TRUE(surface->Initialize()); |
77 EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass(), | 77 EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass(), |
78 kDefaultMode)); | 78 kDefaultMode)); |
79 EXPECT_EQ(NULL, controller_->surface()); | 79 EXPECT_EQ(NULL, controller_->surface()); |
80 } | 80 } |
81 | 81 |
82 TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) { | 82 TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) { |
83 drm_->set_page_flip_expectation(false); | 83 drm_->set_page_flip_expectation(false); |
84 | 84 |
85 scoped_ptr<ui::DriSurface> surface( | 85 scoped_ptr<ui::ScanoutSurface> surface( |
86 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); | 86 new ui::MockDriSurface(drm_.get(), kDefaultModeSize)); |
87 | 87 |
88 EXPECT_TRUE(surface->Initialize()); | 88 EXPECT_TRUE(surface->Initialize()); |
89 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), | 89 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), |
90 kDefaultMode)); | 90 kDefaultMode)); |
91 EXPECT_FALSE(controller_->SchedulePageFlip()); | 91 EXPECT_FALSE(controller_->SchedulePageFlip()); |
92 } | 92 } |
OLD | NEW |