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

Side by Side Diff: ui/ozone/platform/dri/dri_surface_factory_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/dri_buffer.cc ('k') | ui/ozone/platform/dri/dri_surface_unittest.cc » ('j') | 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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 uint32_t framebuffer, 56 uint32_t framebuffer,
57 uint32_t* connectors, 57 uint32_t* connectors,
58 drmModeModeInfo* mode) OVERRIDE { 58 drmModeModeInfo* mode) OVERRIDE {
59 return true; 59 return true;
60 } 60 }
61 61
62 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE { 62 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE {
63 return true; 63 return true;
64 } 64 }
65 65
66 virtual bool AddFramebuffer(const drmModeModeInfo& mode, 66 virtual bool AddFramebuffer(uint32_t width,
67 uint32_t height,
67 uint8_t depth, 68 uint8_t depth,
68 uint8_t bpp, 69 uint8_t bpp,
69 uint32_t stride, 70 uint32_t stride,
70 uint32_t handle, 71 uint32_t handle,
71 uint32_t* framebuffer) OVERRIDE { 72 uint32_t* framebuffer) OVERRIDE {
72 return add_framebuffer_expectation_; 73 return add_framebuffer_expectation_;
73 } 74 }
74 75
75 virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE { return true; } 76 virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE { return true; }
76 77
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 268
268 EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, 269 EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
269 factory_->InitializeHardware()); 270 factory_->InitializeHardware());
270 271
271 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); 272 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget();
272 EXPECT_EQ(kDefaultWidgetHandle, w); 273 EXPECT_EQ(kDefaultWidgetHandle, w);
273 274
274 EXPECT_FALSE(factory_->CreateCanvasForWidget(w)); 275 EXPECT_FALSE(factory_->CreateCanvasForWidget(w));
275 } 276 }
276 277
277 TEST_F(DriSurfaceFactoryTest, FailBindingSurfaceToController) {
278 EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
279 factory_->InitializeHardware());
280
281 factory_->get_drm()->set_add_framebuffer_expectation(false);
282
283 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget();
284 EXPECT_EQ(kDefaultWidgetHandle, w);
285
286 EXPECT_FALSE(factory_->CreateCanvasForWidget(w));
287 }
288
289 TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) { 278 TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) {
290 EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, 279 EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
291 factory_->InitializeHardware()); 280 factory_->InitializeHardware());
292 281
293 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); 282 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget();
294 EXPECT_EQ(kDefaultWidgetHandle, w); 283 EXPECT_EQ(kDefaultWidgetHandle, w);
295 284
296 EXPECT_TRUE(factory_->CreateCanvasForWidget(w)); 285 EXPECT_TRUE(factory_->CreateCanvasForWidget(w));
297 } 286 }
298 287
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 for (int i = 0; i < cursor.height(); ++i) { 346 for (int i = 0; i < cursor.height(); ++i) {
358 for (int j = 0; j < cursor.width(); ++j) { 347 for (int j = 0; j < cursor.width(); ++j) {
359 if (j < info.width() && i < info.height()) 348 if (j < info.width() && i < info.height())
360 EXPECT_EQ(SK_ColorWHITE, cursor.getColor(j, i)); 349 EXPECT_EQ(SK_ColorWHITE, cursor.getColor(j, i));
361 else 350 else
362 EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), 351 EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT),
363 cursor.getColor(j, i)); 352 cursor.getColor(j, i));
364 } 353 }
365 } 354 }
366 } 355 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.cc ('k') | ui/ozone/platform/dri/dri_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698