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

Unified Diff: ui/gfx/ozone/dri/dri_surface_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/dri_surface_factory_unittest.cc ('k') | ui/gfx/ozone/dri/dri_wrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ozone/dri/dri_surface_unittest.cc
diff --git a/ui/gfx/ozone/dri/dri_surface_unittest.cc b/ui/gfx/ozone/dri/dri_surface_unittest.cc
index 754659163a2e050739a7f83ecf5c9349906d95d8..82f303cd1941042b73a206dcaed22122ff49769e 100644
--- a/ui/gfx/ozone/dri/dri_surface_unittest.cc
+++ b/ui/gfx/ozone/dri/dri_surface_unittest.cc
@@ -30,7 +30,12 @@ const uint32_t kDPMSPropertyId = 1;
class MockDriWrapper : public gfx::DriWrapper {
public:
- MockDriWrapper() : DriWrapper(""), id_(1) { fd_ = kFd; }
+ MockDriWrapper() : DriWrapper(""),
+ id_(1),
+ add_framebuffer_expectation_(true) {
+ fd_ = kFd;
+ }
+
virtual ~MockDriWrapper() { fd_ = -1; }
virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE { return NULL; }
@@ -49,7 +54,7 @@ class MockDriWrapper : public gfx::DriWrapper {
uint32_t handle,
uint32_t* framebuffer) OVERRIDE {
*framebuffer = id_++;
- return true;
+ return add_framebuffer_expectation_;
}
virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE { return true; }
virtual bool PageFlip(uint32_t crtc_id,
@@ -61,8 +66,15 @@ class MockDriWrapper : public gfx::DriWrapper {
uint32_t property_id,
uint64_t value) OVERRIDE { return true; }
+ void set_add_framebuffer_expectation(bool state) {
+ add_framebuffer_expectation_ = state;
+ }
+
private:
int id_;
+
+ bool add_framebuffer_expectation_;
+
DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
};
@@ -144,11 +156,16 @@ void DriSurfaceTest::TearDown() {
drm_.reset();
}
-TEST_F(DriSurfaceTest, FailInitialization) {
+TEST_F(DriSurfaceTest, FailInitializationInBitmapInitialization) {
surface_->set_initialize_expectation(false);
EXPECT_FALSE(surface_->Initialize());
}
+TEST_F(DriSurfaceTest, FailInitializationInFramebufferRegistration) {
+ drm_->set_add_framebuffer_expectation(false);
+ EXPECT_FALSE(surface_->Initialize());
+}
+
TEST_F(DriSurfaceTest, SuccessfulInitialization) {
EXPECT_TRUE(surface_->Initialize());
}
@@ -156,7 +173,7 @@ TEST_F(DriSurfaceTest, SuccessfulInitialization) {
TEST_F(DriSurfaceTest, CheckFBIDOnSwap) {
EXPECT_TRUE(surface_->Initialize());
controller_->BindSurfaceToController(
- surface_.PassAs<gfx::DriSurface>());
+ surface_.PassAs<gfx::ScanoutSurface>());
// Check that the framebuffer ID is correct.
EXPECT_EQ(2u, controller_->get_surface()->GetFramebufferId());
« no previous file with comments | « ui/gfx/ozone/dri/dri_surface_factory_unittest.cc ('k') | ui/gfx/ozone/dri/dri_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698