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" | |
8 #include "cc/output/software_frame_data.h" | 7 #include "cc/output/software_frame_data.h" |
9 #include "content/browser/compositor/software_output_device_ozone.h" | 8 #include "content/browser/compositor/software_output_device_ozone.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "third_party/skia/include/core/SkDevice.h" | 10 #include "third_party/skia/include/core/SkDevice.h" |
12 #include "third_party/skia/include/core/SkSurface.h" | 11 #include "third_party/skia/include/core/SkSurface.h" |
13 #include "ui/compositor/compositor.h" | 12 #include "ui/compositor/compositor.h" |
14 #include "ui/compositor/test/context_factories_for_test.h" | 13 #include "ui/compositor/test/context_factories_for_test.h" |
15 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
17 #include "ui/gfx/vsync_provider.h" | 16 #include "ui/gfx/vsync_provider.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 81 |
83 void SoftwareOutputDeviceOzoneTest::SetUp() { | 82 void SoftwareOutputDeviceOzoneTest::SetUp() { |
84 ui::ContextFactory* context_factory = | 83 ui::ContextFactory* context_factory = |
85 ui::InitializeContextFactoryForTests(enable_pixel_output_); | 84 ui::InitializeContextFactoryForTests(enable_pixel_output_); |
86 | 85 |
87 const gfx::Size size(500, 400); | 86 const gfx::Size size(500, 400); |
88 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( | 87 window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
89 &window_delegate_, gfx::Rect(size)); | 88 &window_delegate_, gfx::Rect(size)); |
90 compositor_.reset(new ui::Compositor(window_delegate_.GetAcceleratedWidget(), | 89 compositor_.reset(new ui::Compositor(window_delegate_.GetAcceleratedWidget(), |
91 context_factory, | 90 context_factory, |
92 base::ThreadTaskRunnerHandle::Get())); | 91 base::MessageLoopProxy::current())); |
93 compositor_->SetScaleAndSize(1.0f, size); | 92 compositor_->SetScaleAndSize(1.0f, size); |
94 | 93 |
95 output_device_.reset(new content::SoftwareOutputDeviceOzone( | 94 output_device_.reset(new content::SoftwareOutputDeviceOzone( |
96 compositor_.get())); | 95 compositor_.get())); |
97 output_device_->Resize(size, 1.f); | 96 output_device_->Resize(size, 1.f); |
98 } | 97 } |
99 | 98 |
100 void SoftwareOutputDeviceOzoneTest::TearDown() { | 99 void SoftwareOutputDeviceOzoneTest::TearDown() { |
101 output_device_.reset(); | 100 output_device_.reset(); |
102 compositor_.reset(); | 101 compositor_.reset(); |
(...skipping 27 matching lines...) Expand all Loading... |
130 // Increase size. | 129 // Increase size. |
131 output_device_->Resize(size, 1.f); | 130 output_device_->Resize(size, 1.f); |
132 | 131 |
133 canvas = output_device_->BeginPaint(damage); | 132 canvas = output_device_->BeginPaint(damage); |
134 canvas_size.SetSize(canvas->getDeviceSize().width(), | 133 canvas_size.SetSize(canvas->getDeviceSize().width(), |
135 canvas->getDeviceSize().height()); | 134 canvas->getDeviceSize().height()); |
136 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 135 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
137 | 136 |
138 } | 137 } |
139 | 138 |
OLD | NEW |