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/test/scoped_task_environment.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
14 #include "ui/compositor/compositor.h" | 14 #include "ui/compositor/compositor.h" |
15 #include "ui/compositor/test/context_factories_for_test.h" | 15 #include "ui/compositor/test/context_factories_for_test.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gfx/skia_util.h" | 17 #include "ui/gfx/skia_util.h" |
18 #include "ui/gfx/vsync_provider.h" | 18 #include "ui/gfx/vsync_provider.h" |
19 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
20 #include "ui/ozone/public/ozone_platform.h" | 20 #include "ui/ozone/public/ozone_platform.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 class SoftwareOutputDeviceOzoneTest : public testing::Test { | 59 class SoftwareOutputDeviceOzoneTest : public testing::Test { |
60 public: | 60 public: |
61 SoftwareOutputDeviceOzoneTest(); | 61 SoftwareOutputDeviceOzoneTest(); |
62 ~SoftwareOutputDeviceOzoneTest() override; | 62 ~SoftwareOutputDeviceOzoneTest() override; |
63 | 63 |
64 void SetUp() override; | 64 void SetUp() override; |
65 void TearDown() override; | 65 void TearDown() override; |
66 | 66 |
67 protected: | 67 protected: |
68 std::unique_ptr<content::SoftwareOutputDeviceOzone> output_device_; | 68 std::unique_ptr<content::SoftwareOutputDeviceOzone> output_device_; |
69 bool enable_pixel_output_; | 69 bool enable_pixel_output_ = false; |
70 | 70 |
71 private: | 71 private: |
| 72 base::test::ScopedTaskEnvironment scoped_task_environment_; |
72 std::unique_ptr<ui::Compositor> compositor_; | 73 std::unique_ptr<ui::Compositor> compositor_; |
73 std::unique_ptr<base::MessageLoop> message_loop_; | |
74 TestPlatformWindowDelegate window_delegate_; | 74 TestPlatformWindowDelegate window_delegate_; |
75 std::unique_ptr<ui::PlatformWindow> window_; | 75 std::unique_ptr<ui::PlatformWindow> window_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzoneTest); | 77 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzoneTest); |
78 }; | 78 }; |
79 | 79 |
80 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() | 80 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() |
81 : enable_pixel_output_(false) { | 81 : scoped_task_environment_( |
82 message_loop_.reset(new base::MessageLoopForUI); | 82 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} |
83 } | |
84 | 83 |
85 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { | 84 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { |
86 } | 85 } |
87 | 86 |
88 void SoftwareOutputDeviceOzoneTest::SetUp() { | 87 void SoftwareOutputDeviceOzoneTest::SetUp() { |
89 ui::ContextFactory* context_factory = nullptr; | 88 ui::ContextFactory* context_factory = nullptr; |
90 ui::ContextFactoryPrivate* context_factory_private = nullptr; | 89 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
91 ui::InitializeContextFactoryForTests(enable_pixel_output_, &context_factory, | 90 ui::InitializeContextFactoryForTests(enable_pixel_output_, &context_factory, |
92 &context_factory_private); | 91 &context_factory_private); |
93 | 92 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Increase size. | 142 // Increase size. |
144 output_device_->Resize(size, 1.f); | 143 output_device_->Resize(size, 1.f); |
145 | 144 |
146 canvas = output_device_->BeginPaint(damage); | 145 canvas = output_device_->BeginPaint(damage); |
147 canvas_size.SetSize(canvas->getBaseLayerSize().width(), | 146 canvas_size.SetSize(canvas->getBaseLayerSize().width(), |
148 canvas->getBaseLayerSize().height()); | 147 canvas->getBaseLayerSize().height()); |
149 EXPECT_EQ(size.ToString(), canvas_size.ToString()); | 148 EXPECT_EQ(size.ToString(), canvas_size.ToString()); |
150 | 149 |
151 } | 150 } |
152 | 151 |
OLD | NEW |