| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() | 93 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() |
| 94 : enable_pixel_output_(false) { | 94 : enable_pixel_output_(false) { |
| 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::ContextFactory* context_factory = |
| 103 ui::InitializeContextFactoryForTests(enable_pixel_output_); |
| 103 | 104 |
| 104 surface_factory_.reset(new MockSurfaceFactoryOzone()); | 105 surface_factory_.reset(new MockSurfaceFactoryOzone()); |
| 105 | 106 |
| 106 const gfx::Size size(500, 400); | 107 const gfx::Size size(500, 400); |
| 107 compositor_.reset(new ui::Compositor( | 108 compositor_.reset(new ui::Compositor( |
| 108 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget())); | 109 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(), |
| 110 context_factory)); |
| 109 compositor_->SetScaleAndSize(1.0f, size); | 111 compositor_->SetScaleAndSize(1.0f, size); |
| 110 | 112 |
| 111 output_device_.reset(new content::SoftwareOutputDeviceOzone( | 113 output_device_.reset(new content::SoftwareOutputDeviceOzone( |
| 112 compositor_.get())); | 114 compositor_.get())); |
| 113 output_device_->Resize(size); | 115 output_device_->Resize(size); |
| 114 } | 116 } |
| 115 | 117 |
| 116 void SoftwareOutputDeviceOzoneTest::TearDown() { | 118 void SoftwareOutputDeviceOzoneTest::TearDown() { |
| 117 output_device_.reset(); | 119 output_device_.reset(); |
| 118 compositor_.reset(); | 120 compositor_.reset(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); | 186 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); |
| 185 for (int i = 0; i < area.height(); ++i) { | 187 for (int i = 0; i < area.height(); ++i) { |
| 186 for (int j = 0; j < area.width(); ++j) { | 188 for (int j = 0; j < area.width(); ++j) { |
| 187 if (j < damage.width() && i < damage.height()) | 189 if (j < damage.width() && i < damage.height()) |
| 188 EXPECT_EQ(white, pixels[i * area.width() + j]); | 190 EXPECT_EQ(white, pixels[i * area.width() + j]); |
| 189 else | 191 else |
| 190 EXPECT_EQ(black, pixels[i * area.width() + j]); | 192 EXPECT_EQ(black, pixels[i * area.width() + j]); |
| 191 } | 193 } |
| 192 } | 194 } |
| 193 } | 195 } |
| OLD | NEW |