| 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 "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/ozone/platform/dri/dri_buffer.h" | 9 #include "ui/ozone/platform/dri/dri_buffer.h" |
| 10 #include "ui/ozone/platform/dri/dri_surface.h" | 10 #include "ui/ozone/platform/dri/dri_surface.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 surface_->set_initialize_expectation(false); | 54 surface_->set_initialize_expectation(false); |
| 55 EXPECT_FALSE(surface_->Initialize()); | 55 EXPECT_FALSE(surface_->Initialize()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TEST_F(DriSurfaceTest, SuccessfulInitialization) { | 58 TEST_F(DriSurfaceTest, SuccessfulInitialization) { |
| 59 EXPECT_TRUE(surface_->Initialize()); | 59 EXPECT_TRUE(surface_->Initialize()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 TEST_F(DriSurfaceTest, CheckFBIDOnSwap) { | 62 TEST_F(DriSurfaceTest, CheckFBIDOnSwap) { |
| 63 EXPECT_TRUE(surface_->Initialize()); | 63 EXPECT_TRUE(surface_->Initialize()); |
| 64 controller_->BindSurfaceToController(surface_.PassAs<ui::DriSurface>(), | 64 controller_->BindSurfaceToController(surface_.PassAs<ui::ScanoutSurface>(), |
| 65 kDefaultMode); | 65 kDefaultMode); |
| 66 | 66 |
| 67 // Check that the framebuffer ID is correct. | 67 // Check that the framebuffer ID is correct. |
| 68 EXPECT_EQ(2u, controller_->surface()->GetFramebufferId()); | 68 EXPECT_EQ(2u, controller_->surface()->GetFramebufferId()); |
| 69 | 69 |
| 70 controller_->surface()->SwapBuffers(); | 70 controller_->surface()->SwapBuffers(); |
| 71 | 71 |
| 72 EXPECT_EQ(1u, controller_->surface()->GetFramebufferId()); | 72 EXPECT_EQ(1u, controller_->surface()->GetFramebufferId()); |
| 73 } | 73 } |
| 74 | 74 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (int j = 0; j < canvas->getDeviceSize().width(); ++j) { | 109 for (int j = 0; j < canvas->getDeviceSize().width(); ++j) { |
| 110 if (i < clip.height() && j < clip.width()) | 110 if (i < clip.height() && j < clip.width()) |
| 111 EXPECT_EQ(SK_ColorWHITE, | 111 EXPECT_EQ(SK_ColorWHITE, |
| 112 canvas->getDevice()->accessBitmap(false).getColor(j, i)); | 112 canvas->getDevice()->accessBitmap(false).getColor(j, i)); |
| 113 else | 113 else |
| 114 EXPECT_EQ(SK_ColorBLACK, | 114 EXPECT_EQ(SK_ColorBLACK, |
| 115 canvas->getDevice()->accessBitmap(false).getColor(j, i)); | 115 canvas->getDevice()->accessBitmap(false).getColor(j, i)); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| OLD | NEW |