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