| 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 <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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |