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 "ui/ozone/public/ozone_gpu_test_helper.h" | 5 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
6 | 6 |
| 7 #include "base/run_loop.h" |
7 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
8 #include "ipc/ipc_listener.h" | 9 #include "ipc/ipc_listener.h" |
9 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
11 #include "ipc/message_filter.h" | 12 #include "ipc/message_filter.h" |
12 #include "ui/ozone/public/gpu_platform_support.h" | 13 #include "ui/ozone/public/gpu_platform_support.h" |
13 #include "ui/ozone/public/gpu_platform_support_host.h" | 14 #include "ui/ozone/public/gpu_platform_support_host.h" |
14 #include "ui/ozone/public/ozone_platform.h" | 15 #include "ui/ozone/public/ozone_platform.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 base::Unretained(fake_gpu_process_.get()))); | 125 base::Unretained(fake_gpu_process_.get()))); |
125 fake_gpu_process_->Init(); | 126 fake_gpu_process_->Init(); |
126 | 127 |
127 fake_gpu_process_host_.reset(new FakeGpuProcessHost( | 128 fake_gpu_process_host_.reset(new FakeGpuProcessHost( |
128 gpu_task_runner, io_helper_thread_->task_runner())); | 129 gpu_task_runner, io_helper_thread_->task_runner())); |
129 fake_gpu_process_host_->Init(); | 130 fake_gpu_process_host_->Init(); |
130 | 131 |
131 return true; | 132 return true; |
132 } | 133 } |
133 | 134 |
| 135 // static |
| 136 std::unique_ptr<OzoneInitializerForTest> OzoneInitializerForTest::Create() { |
| 137 std::unique_ptr<OzoneInitializerForTest> self(new OzoneInitializerForTest()); |
| 138 if (!self->Initialize()) |
| 139 return nullptr; |
| 140 return self; |
| 141 } |
| 142 |
| 143 OzoneInitializerForTest::OzoneInitializerForTest() {} |
| 144 |
| 145 OzoneInitializerForTest::~OzoneInitializerForTest() {} |
| 146 |
| 147 bool OzoneInitializerForTest::Initialize() { |
| 148 OzonePlatform::InitializeForUI(); |
| 149 OzonePlatform::InitializeForGPU(); |
| 150 gpu_helper_.reset(new OzoneGpuTestHelper); |
| 151 if (!gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get(), |
| 152 base::ThreadTaskRunnerHandle::Get())) { |
| 153 return false; |
| 154 } |
| 155 { |
| 156 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 157 base::MessageLoop::current()); |
| 158 base::RunLoop().RunUntilIdle(); |
| 159 } |
| 160 return true; |
| 161 } |
| 162 |
134 } // namespace ui | 163 } // namespace ui |
OLD | NEW |