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

Side by Side Diff: ui/ozone/platform/dri/hardware_display_controller_unittest.cc

Issue 276753003: [Ozone-DRI] Move framebuffer initialization into the buffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 uint32_t* connectors, 58 uint32_t* connectors,
59 drmModeModeInfo* mode) OVERRIDE { 59 drmModeModeInfo* mode) OVERRIDE {
60 return set_crtc_expectation_; 60 return set_crtc_expectation_;
61 } 61 }
62 62
63 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE { 63 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE {
64 restore_crtc_call_count_++; 64 restore_crtc_call_count_++;
65 return true; 65 return true;
66 } 66 }
67 67
68 virtual bool AddFramebuffer(const drmModeModeInfo& mode, 68 virtual bool AddFramebuffer(uint32_t width,
69 uint32_t height,
69 uint8_t depth, 70 uint8_t depth,
70 uint8_t bpp, 71 uint8_t bpp,
71 uint32_t stride, 72 uint32_t stride,
72 uint32_t handle, 73 uint32_t handle,
73 uint32_t* framebuffer) OVERRIDE { 74 uint32_t* framebuffer) OVERRIDE {
74 add_framebuffer_call_count_++; 75 add_framebuffer_call_count_++;
75 return add_framebuffer_expectation_; 76 return add_framebuffer_expectation_;
76 } 77 }
77 78
78 virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE { 79 virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 220 }
220 221
221 TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) { 222 TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) {
222 scoped_ptr<ui::DriSurface> surface( 223 scoped_ptr<ui::DriSurface> surface(
223 new MockDriSurface(drm_.get(), kDefaultModeSize)); 224 new MockDriSurface(drm_.get(), kDefaultModeSize));
224 225
225 EXPECT_TRUE(surface->Initialize()); 226 EXPECT_TRUE(surface->Initialize());
226 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), 227 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(),
227 kDefaultMode)); 228 kDefaultMode));
228 229
229 EXPECT_EQ(2, drm_->get_add_framebuffer_call_count());
230 EXPECT_TRUE(controller_->get_surface() != NULL); 230 EXPECT_TRUE(controller_->get_surface() != NULL);
231 } 231 }
232 232
233 TEST_F(HardwareDisplayControllerTest, CheckStateIfBindingFails) {
234 drm_->set_add_framebuffer_expectation(false);
235
236 scoped_ptr<ui::DriSurface> surface(
237 new MockDriSurface(drm_.get(), kDefaultModeSize));
238
239 EXPECT_TRUE(surface->Initialize());
240 EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass(),
241 kDefaultMode));
242
243 EXPECT_EQ(1, drm_->get_add_framebuffer_call_count());
244 EXPECT_EQ(NULL, controller_->get_surface());
245 }
246
247 TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) { 233 TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) {
248 scoped_ptr<ui::DriSurface> surface( 234 scoped_ptr<ui::DriSurface> surface(
249 new MockDriSurface(drm_.get(), kDefaultModeSize)); 235 new MockDriSurface(drm_.get(), kDefaultModeSize));
250 236
251 EXPECT_TRUE(surface->Initialize()); 237 EXPECT_TRUE(surface->Initialize());
252 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), 238 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(),
253 kDefaultMode)); 239 kDefaultMode));
254 240
255 EXPECT_TRUE(controller_->SchedulePageFlip()); 241 EXPECT_TRUE(controller_->SchedulePageFlip());
256 EXPECT_TRUE(controller_->get_surface() != NULL); 242 EXPECT_TRUE(controller_->get_surface() != NULL);
(...skipping 15 matching lines...) Expand all
272 drm_->set_page_flip_expectation(false); 258 drm_->set_page_flip_expectation(false);
273 259
274 scoped_ptr<ui::DriSurface> surface( 260 scoped_ptr<ui::DriSurface> surface(
275 new MockDriSurface(drm_.get(), kDefaultModeSize)); 261 new MockDriSurface(drm_.get(), kDefaultModeSize));
276 262
277 EXPECT_TRUE(surface->Initialize()); 263 EXPECT_TRUE(surface->Initialize());
278 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(), 264 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(),
279 kDefaultMode)); 265 kDefaultMode));
280 EXPECT_FALSE(controller_->SchedulePageFlip()); 266 EXPECT_FALSE(controller_->SchedulePageFlip());
281 } 267 }
282
283 TEST_F(HardwareDisplayControllerTest, CheckProperDestruction) {
284 scoped_ptr<ui::DriSurface> surface(
285 new MockDriSurface(drm_.get(), kDefaultModeSize));
286
287 EXPECT_TRUE(surface->Initialize());
288 EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass(),
289 kDefaultMode));
290 EXPECT_TRUE(controller_->get_surface() != NULL);
291
292 controller_.reset();
293
294 EXPECT_EQ(2, drm_->get_remove_framebuffer_call_count());
295 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698