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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { | 80 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { |
81 } | 81 } |
82 | 82 |
83 void SoftwareOutputDeviceOzoneTest::SetUp() { | 83 void SoftwareOutputDeviceOzoneTest::SetUp() { |
84 ui::ContextFactory* context_factory = | 84 ui::ContextFactory* context_factory = |
85 ui::InitializeContextFactoryForTests(enable_pixel_output_); | 85 ui::InitializeContextFactoryForTests(enable_pixel_output_); |
86 | 86 |
87 const gfx::Size size(500, 400); | 87 const gfx::Size size(500, 400); |
88 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( | 88 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
89 &window_delegate_, gfx::Rect(size)); | 89 &window_delegate_, gfx::Rect(size)); |
90 compositor_.reset(new ui::Compositor(window_delegate_.GetAcceleratedWidget(), | 90 compositor_.reset( |
91 context_factory, | 91 new ui::Compositor(context_factory, base::ThreadTaskRunnerHandle::Get())); |
92 base::ThreadTaskRunnerHandle::Get())); | 92 compositor_->OnAcceleratedWidgetAvailable( |
| 93 window_delegate_.GetAcceleratedWidget()); |
93 compositor_->SetScaleAndSize(1.0f, size); | 94 compositor_->SetScaleAndSize(1.0f, size); |
94 | 95 |
95 output_device_.reset(new content::SoftwareOutputDeviceOzone( | 96 output_device_.reset(new content::SoftwareOutputDeviceOzone( |
96 compositor_.get())); | 97 compositor_.get())); |
97 output_device_->Resize(size, 1.f); | 98 output_device_->Resize(size, 1.f); |
98 } | 99 } |
99 | 100 |
100 void SoftwareOutputDeviceOzoneTest::TearDown() { | 101 void SoftwareOutputDeviceOzoneTest::TearDown() { |
101 output_device_.reset(); | 102 output_device_.reset(); |
102 compositor_.reset(); | 103 compositor_.reset(); |
(...skipping 27 matching lines...) Expand all Loading... |
130 // Increase size. | 131 // Increase size. |
131 output_device_->Resize(size, 1.f); | 132 output_device_->Resize(size, 1.f); |
132 | 133 |
133 canvas = output_device_->BeginPaint(damage); | 134 canvas = output_device_->BeginPaint(damage); |
134 canvas_size.SetSize(canvas->getDeviceSize().width(), | 135 canvas_size.SetSize(canvas->getDeviceSize().width(), |
135 canvas->getDeviceSize().height()); | 136 canvas->getDeviceSize().height()); |
136 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 137 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
137 | 138 |
138 } | 139 } |
139 | 140 |
OLD | NEW |