Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: ui/gfx/ozone/dri/hardware_display_controller_unittest.cc

Issue 132543002: Not for review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/ozone/dri/hardware_display_controller.cc ('k') | ui/gfx/ozone/dri/scanout_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ozone/dri/hardware_display_controller_unittest.cc
diff --git a/ui/gfx/ozone/dri/hardware_display_controller_unittest.cc b/ui/gfx/ozone/dri/hardware_display_controller_unittest.cc
index 3806b5a157b8860cb15c0c7bd6b122c4d76a66db..a145d3aa0f960c853593e00fd4ad6ac74b07da20 100644
--- a/ui/gfx/ozone/dri/hardware_display_controller_unittest.cc
+++ b/ui/gfx/ozone/dri/hardware_display_controller_unittest.cc
@@ -35,7 +35,6 @@ class MockDriWrapper : public gfx::DriWrapper {
add_framebuffer_call_count_(0),
remove_framebuffer_call_count_(0),
set_crtc_expectation_(true),
- add_framebuffer_expectation_(true),
page_flip_expectation_(true) {
fd_ = fd;
}
@@ -71,12 +70,13 @@ class MockDriWrapper : public gfx::DriWrapper {
uint32_t handle,
uint32_t* framebuffer) OVERRIDE {
add_framebuffer_call_count_++;
+ *framebuffer = add_framebuffer_call_count_;
return add_framebuffer_expectation_;
}
virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE {
remove_framebuffer_call_count_++;
- return true;
+ return framebuffer != 0;
}
virtual bool PageFlip(uint32_t crtc_id,
@@ -113,10 +113,6 @@ class MockDriWrapper : public gfx::DriWrapper {
set_crtc_expectation_ = state;
}
- void set_add_framebuffer_expectation(bool state) {
- add_framebuffer_expectation_ = state;
- }
-
void set_page_flip_expectation(bool state) {
page_flip_expectation_ = state;
}
@@ -129,7 +125,6 @@ class MockDriWrapper : public gfx::DriWrapper {
int remove_framebuffer_call_count_;
bool set_crtc_expectation_;
- bool add_framebuffer_expectation_;
bool page_flip_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
@@ -202,40 +197,42 @@ TEST_F(HardwareDisplayControllerTest,
controller_->get_state());
}
-TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) {
+TEST_F(HardwareDisplayControllerTest, CheckStateAfterAddFramebufferFails) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
- new MockDriSurface(controller_.get()));
- EXPECT_TRUE(surface->Initialize());
- EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
-
- EXPECT_EQ(2, drm_->get_add_framebuffer_call_count());
- EXPECT_EQ(gfx::HardwareDisplayController::SURFACE_INITIALIZED,
+ drm_->set_add_framebuffer_expectation(false);
+ uint32_t framebuffer = 0;
+ EXPECT_FALSE(controller_->AddFramebuffer(24, 32, 100, 1, &framebuffer));
+ EXPECT_EQ(gfx::HardwareDisplayController::FAILED,
controller_->get_state());
}
-TEST_F(HardwareDisplayControllerTest, CheckStateIfBindingFails) {
- drm_->set_add_framebuffer_expectation(false);
+TEST_F(HardwareDisplayControllerTest, CheckReturnOfInvalidRemoveFramebuffer) {
+ controller_->SetControllerInfo(
+ drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
+
+ EXPECT_FALSE(controller_->RemoveFramebuffer(0));
+}
+TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
+ scoped_ptr<gfx::ScanoutSurface> surface(
new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize());
- EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass()));
+ EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
- EXPECT_EQ(1, drm_->get_add_framebuffer_call_count());
- EXPECT_EQ(gfx::HardwareDisplayController::FAILED,
+ EXPECT_EQ(2, drm_->get_add_framebuffer_call_count());
+ EXPECT_EQ(gfx::HardwareDisplayController::SURFACE_INITIALIZED,
controller_->get_state());
}
TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
+ scoped_ptr<gfx::ScanoutSurface> surface(
new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize());
@@ -252,7 +249,7 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfModesetFails) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
+ scoped_ptr<gfx::ScanoutSurface> surface(
new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize());
@@ -269,7 +266,7 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
+ scoped_ptr<gfx::ScanoutSurface> surface(
new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize());
@@ -284,7 +281,7 @@ TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) {
TEST_F(HardwareDisplayControllerTest, CheckProperDestruction) {
controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
- scoped_ptr<gfx::DriSurface> surface(
+ scoped_ptr<gfx::ScanoutSurface> surface(
new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize());
« no previous file with comments | « ui/gfx/ozone/dri/hardware_display_controller.cc ('k') | ui/gfx/ozone/dri/scanout_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698