| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 void SoftwareOutputDeviceOzoneTest::SetUp() { | 95 void SoftwareOutputDeviceOzoneTest::SetUp() { |
| 96 ui::ContextFactory* context_factory = | 96 ui::ContextFactory* context_factory = |
| 97 ui::InitializeContextFactoryForTests(enable_pixel_output_); | 97 ui::InitializeContextFactoryForTests(enable_pixel_output_); |
| 98 | 98 |
| 99 surface_factory_.reset(new MockSurfaceFactoryOzone()); | 99 surface_factory_.reset(new MockSurfaceFactoryOzone()); |
| 100 | 100 |
| 101 const gfx::Size size(500, 400); | 101 const gfx::Size size(500, 400); |
| 102 const gfx::AcceleratedWidget kTestAcceleratedWidget = 1; | 102 const gfx::AcceleratedWidget kTestAcceleratedWidget = 1; |
| 103 compositor_.reset( | 103 compositor_.reset( |
| 104 new ui::Compositor(kTestAcceleratedWidget, context_factory)); | 104 new ui::Compositor(kTestAcceleratedWidget, |
| 105 context_factory, |
| 106 base::MessageLoopProxy::current())); |
| 105 compositor_->SetScaleAndSize(1.0f, size); | 107 compositor_->SetScaleAndSize(1.0f, size); |
| 106 | 108 |
| 107 output_device_.reset(new content::SoftwareOutputDeviceOzone( | 109 output_device_.reset(new content::SoftwareOutputDeviceOzone( |
| 108 compositor_.get())); | 110 compositor_.get())); |
| 109 output_device_->Resize(size, 1.f); | 111 output_device_->Resize(size, 1.f); |
| 110 } | 112 } |
| 111 | 113 |
| 112 void SoftwareOutputDeviceOzoneTest::TearDown() { | 114 void SoftwareOutputDeviceOzoneTest::TearDown() { |
| 113 output_device_.reset(); | 115 output_device_.reset(); |
| 114 compositor_.reset(); | 116 compositor_.reset(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); | 182 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); |
| 181 for (int i = 0; i < area.height(); ++i) { | 183 for (int i = 0; i < area.height(); ++i) { |
| 182 for (int j = 0; j < area.width(); ++j) { | 184 for (int j = 0; j < area.width(); ++j) { |
| 183 if (j < damage.width() && i < damage.height()) | 185 if (j < damage.width() && i < damage.height()) |
| 184 EXPECT_EQ(white, pixels[i * area.width() + j]); | 186 EXPECT_EQ(white, pixels[i * area.width() + j]); |
| 185 else | 187 else |
| 186 EXPECT_EQ(black, pixels[i * area.width() + j]); | 188 EXPECT_EQ(black, pixels[i * area.width() + j]); |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 } | 191 } |
| OLD | NEW |