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 "content/browser/compositor/software_output_device_ozone.h" | 5 #include "content/browser/compositor/software_output_device_ozone.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() | 80 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() |
81 : enable_pixel_output_(false) { | 81 : enable_pixel_output_(false) { |
82 message_loop_.reset(new base::MessageLoopForUI); | 82 message_loop_.reset(new base::MessageLoopForUI); |
83 } | 83 } |
84 | 84 |
85 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { | 85 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { |
86 } | 86 } |
87 | 87 |
88 void SoftwareOutputDeviceOzoneTest::SetUp() { | 88 void SoftwareOutputDeviceOzoneTest::SetUp() { |
89 ui::ContextFactory* context_factory = | 89 ui::ContextFactory* context_factory = nullptr; |
90 ui::InitializeContextFactoryForTests(enable_pixel_output_); | 90 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 91 ui::InitializeContextFactoryForTests(enable_pixel_output_, &context_factory, |
| 92 &context_factory_private); |
91 | 93 |
92 const gfx::Size size(500, 400); | 94 const gfx::Size size(500, 400); |
93 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( | 95 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
94 &window_delegate_, gfx::Rect(size)); | 96 &window_delegate_, gfx::Rect(size)); |
95 compositor_.reset( | 97 compositor_.reset(new ui::Compositor(context_factory, nullptr, |
96 new ui::Compositor(context_factory, base::ThreadTaskRunnerHandle::Get())); | 98 base::ThreadTaskRunnerHandle::Get())); |
97 compositor_->SetAcceleratedWidget(window_delegate_.GetAcceleratedWidget()); | 99 compositor_->SetAcceleratedWidget(window_delegate_.GetAcceleratedWidget()); |
98 compositor_->SetScaleAndSize(1.0f, size); | 100 compositor_->SetScaleAndSize(1.0f, size); |
99 | 101 |
100 output_device_ = | 102 output_device_ = |
101 content::SoftwareOutputDeviceOzone::Create(compositor_.get()); | 103 content::SoftwareOutputDeviceOzone::Create(compositor_.get()); |
102 if (output_device_) | 104 if (output_device_) |
103 output_device_->Resize(size, 1.f); | 105 output_device_->Resize(size, 1.f); |
104 } | 106 } |
105 | 107 |
106 void SoftwareOutputDeviceOzoneTest::TearDown() { | 108 void SoftwareOutputDeviceOzoneTest::TearDown() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Increase size. | 142 // Increase size. |
141 output_device_->Resize(size, 1.f); | 143 output_device_->Resize(size, 1.f); |
142 | 144 |
143 canvas = output_device_->BeginPaint(damage); | 145 canvas = output_device_->BeginPaint(damage); |
144 canvas_size.SetSize(canvas->getBaseLayerSize().width(), | 146 canvas_size.SetSize(canvas->getBaseLayerSize().width(), |
145 canvas->getBaseLayerSize().height()); | 147 canvas->getBaseLayerSize().height()); |
146 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 148 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
147 | 149 |
148 } | 150 } |
149 | 151 |
OLD | NEW |