| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "cc/output/software_frame_data.h" | 7 #include "cc/output/software_frame_data.h" |
| 8 #include "content/browser/compositor/software_output_device_ozone.h" | 8 #include "content/browser/compositor/software_output_device_ozone.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/skia/include/core/SkDevice.h" | 10 #include "third_party/skia/include/core/SkDevice.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 gfx::AcceleratedWidget widget_; | 46 gfx::AcceleratedWidget widget_; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(TestPlatformWindowDelegate); | 48 DISALLOW_COPY_AND_ASSIGN(TestPlatformWindowDelegate); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 class SoftwareOutputDeviceOzoneTest : public testing::Test { | 53 class SoftwareOutputDeviceOzoneTest : public testing::Test { |
| 54 public: | 54 public: |
| 55 SoftwareOutputDeviceOzoneTest(); | 55 SoftwareOutputDeviceOzoneTest(); |
| 56 virtual ~SoftwareOutputDeviceOzoneTest(); | 56 ~SoftwareOutputDeviceOzoneTest() override; |
| 57 | 57 |
| 58 virtual void SetUp() override; | 58 void SetUp() override; |
| 59 virtual void TearDown() override; | 59 void TearDown() override; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 scoped_ptr<content::SoftwareOutputDeviceOzone> output_device_; | 62 scoped_ptr<content::SoftwareOutputDeviceOzone> output_device_; |
| 63 bool enable_pixel_output_; | 63 bool enable_pixel_output_; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 scoped_ptr<ui::Compositor> compositor_; | 66 scoped_ptr<ui::Compositor> compositor_; |
| 67 scoped_ptr<base::MessageLoop> message_loop_; | 67 scoped_ptr<base::MessageLoop> message_loop_; |
| 68 TestPlatformWindowDelegate window_delegate_; | 68 TestPlatformWindowDelegate window_delegate_; |
| 69 scoped_ptr<ui::PlatformWindow> window_; | 69 scoped_ptr<ui::PlatformWindow> window_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 99 void SoftwareOutputDeviceOzoneTest::TearDown() { | 99 void SoftwareOutputDeviceOzoneTest::TearDown() { |
| 100 output_device_.reset(); | 100 output_device_.reset(); |
| 101 compositor_.reset(); | 101 compositor_.reset(); |
| 102 window_.reset(); | 102 window_.reset(); |
| 103 ui::TerminateContextFactoryForTests(); | 103 ui::TerminateContextFactoryForTests(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 class SoftwareOutputDeviceOzonePixelTest | 106 class SoftwareOutputDeviceOzonePixelTest |
| 107 : public SoftwareOutputDeviceOzoneTest { | 107 : public SoftwareOutputDeviceOzoneTest { |
| 108 protected: | 108 protected: |
| 109 virtual void SetUp() override; | 109 void SetUp() override; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 void SoftwareOutputDeviceOzonePixelTest::SetUp() { | 112 void SoftwareOutputDeviceOzonePixelTest::SetUp() { |
| 113 enable_pixel_output_ = true; | 113 enable_pixel_output_ = true; |
| 114 SoftwareOutputDeviceOzoneTest::SetUp(); | 114 SoftwareOutputDeviceOzoneTest::SetUp(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 TEST_F(SoftwareOutputDeviceOzoneTest, CheckCorrectResizeBehavior) { | 117 TEST_F(SoftwareOutputDeviceOzoneTest, CheckCorrectResizeBehavior) { |
| 118 gfx::Rect damage(0, 0, 100, 100); | 118 gfx::Rect damage(0, 0, 100, 100); |
| 119 gfx::Size size(200, 100); | 119 gfx::Size size(200, 100); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); | 167 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); |
| 168 for (int i = 0; i < area.height(); ++i) { | 168 for (int i = 0; i < area.height(); ++i) { |
| 169 for (int j = 0; j < area.width(); ++j) { | 169 for (int j = 0; j < area.width(); ++j) { |
| 170 if (j < damage.width() && i < damage.height()) | 170 if (j < damage.width() && i < damage.height()) |
| 171 EXPECT_EQ(white, pixels[i * area.width() + j]); | 171 EXPECT_EQ(white, pixels[i * area.width() + j]); |
| 172 else | 172 else |
| 173 EXPECT_EQ(black, pixels[i * area.width() + j]); | 173 EXPECT_EQ(black, pixels[i * area.width() + j]); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| OLD | NEW |