OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "third_party/skia/include/core/SkColor.h" | 7 #include "third_party/skia/include/core/SkColor.h" |
8 #include "third_party/skia/include/core/SkDevice.h" | 8 #include "third_party/skia/include/core/SkDevice.h" |
9 #include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" | 9 #include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" |
10 #include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" | 10 #include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 surface_->set_initialize_expectation(false); | 142 surface_->set_initialize_expectation(false); |
143 EXPECT_FALSE(surface_->Initialize()); | 143 EXPECT_FALSE(surface_->Initialize()); |
144 } | 144 } |
145 | 145 |
146 TEST_F(SoftwareSurfaceOzoneTest, SuccessfulInitialization) { | 146 TEST_F(SoftwareSurfaceOzoneTest, SuccessfulInitialization) { |
147 EXPECT_TRUE(surface_->Initialize()); | 147 EXPECT_TRUE(surface_->Initialize()); |
148 } | 148 } |
149 | 149 |
150 TEST_F(SoftwareSurfaceOzoneTest, CheckFBIDOnSwap) { | 150 TEST_F(SoftwareSurfaceOzoneTest, CheckFBIDOnSwap) { |
151 EXPECT_TRUE(surface_->Initialize()); | 151 EXPECT_TRUE(surface_->Initialize()); |
152 controller_->BindSurfaceToController(surface_.release()); | 152 controller_->BindSurfaceToController( |
| 153 surface_.PassAs<gfx::SoftwareSurfaceOzone>()); |
153 | 154 |
154 // Check that the framebuffer ID is correct. | 155 // Check that the framebuffer ID is correct. |
155 EXPECT_EQ(2u, controller_->get_surface()->GetFramebufferId()); | 156 EXPECT_EQ(2u, controller_->get_surface()->GetFramebufferId()); |
156 | 157 |
157 controller_->get_surface()->SwapBuffers(); | 158 controller_->get_surface()->SwapBuffers(); |
158 | 159 |
159 EXPECT_EQ(1u, controller_->get_surface()->GetFramebufferId()); | 160 EXPECT_EQ(1u, controller_->get_surface()->GetFramebufferId()); |
160 } | 161 } |
161 | 162 |
162 TEST_F(SoftwareSurfaceOzoneTest, CheckPixelPointerOnSwap) { | 163 TEST_F(SoftwareSurfaceOzoneTest, CheckPixelPointerOnSwap) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 for (int j = 0; j < canvas->getDeviceSize().width(); ++j) { | 197 for (int j = 0; j < canvas->getDeviceSize().width(); ++j) { |
197 if (i < clip.height() && j < clip.width()) | 198 if (i < clip.height() && j < clip.width()) |
198 EXPECT_EQ(SK_ColorWHITE, | 199 EXPECT_EQ(SK_ColorWHITE, |
199 canvas->getDevice()->accessBitmap(false).getColor(j, i)); | 200 canvas->getDevice()->accessBitmap(false).getColor(j, i)); |
200 else | 201 else |
201 EXPECT_EQ(SK_ColorBLACK, | 202 EXPECT_EQ(SK_ColorBLACK, |
202 canvas->getDevice()->accessBitmap(false).getColor(j, i)); | 203 canvas->getDevice()->accessBitmap(false).getColor(j, i)); |
203 } | 204 } |
204 } | 205 } |
205 } | 206 } |
OLD | NEW |