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/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 message_loop_.reset(new base::MessageLoopForUI); | 95 message_loop_.reset(new base::MessageLoopForUI); |
96 } | 96 } |
97 | 97 |
98 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { | 98 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { |
99 } | 99 } |
100 | 100 |
101 void SoftwareOutputDeviceOzoneTest::SetUp() { | 101 void SoftwareOutputDeviceOzoneTest::SetUp() { |
102 ui::InitializeContextFactoryForTests(enable_pixel_output_); | 102 ui::InitializeContextFactoryForTests(enable_pixel_output_); |
103 | 103 |
104 surface_factory_.reset(new MockSurfaceFactoryOzone()); | 104 surface_factory_.reset(new MockSurfaceFactoryOzone()); |
105 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get()); | |
106 | 105 |
107 const gfx::Size size(500, 400); | 106 const gfx::Size size(500, 400); |
108 compositor_.reset(new ui::Compositor( | 107 compositor_.reset(new ui::Compositor( |
109 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget())); | 108 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget())); |
110 compositor_->SetScaleAndSize(1.0f, size); | 109 compositor_->SetScaleAndSize(1.0f, size); |
111 | 110 |
112 output_device_.reset(new content::SoftwareOutputDeviceOzone( | 111 output_device_.reset(new content::SoftwareOutputDeviceOzone( |
113 compositor_.get())); | 112 compositor_.get())); |
114 output_device_->Resize(size); | 113 output_device_->Resize(size); |
115 } | 114 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); | 184 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); |
186 for (int i = 0; i < area.height(); ++i) { | 185 for (int i = 0; i < area.height(); ++i) { |
187 for (int j = 0; j < area.width(); ++j) { | 186 for (int j = 0; j < area.width(); ++j) { |
188 if (j < damage.width() && i < damage.height()) | 187 if (j < damage.width() && i < damage.height()) |
189 EXPECT_EQ(white, pixels[i * area.width() + j]); | 188 EXPECT_EQ(white, pixels[i * area.width() + j]); |
190 else | 189 else |
191 EXPECT_EQ(black, pixels[i * area.width() + j]); | 190 EXPECT_EQ(black, pixels[i * area.width() + j]); |
192 } | 191 } |
193 } | 192 } |
194 } | 193 } |
OLD | NEW |