Chromium Code Reviews| 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 scoped_ptr<OzoneInitializerForTest> OzoneInitializerForTest::Create() { | |
| 137 scoped_ptr<OzoneInitializerForTest> self(new OzoneInitializerForTest()); | |
| 138 if (!self->Initialize()) | |
| 139 return nullptr; | |
| 140 return self.Pass(); | |
| 141 } | |
| 142 | |
| 143 OzoneInitializerForTest::OzoneInitializerForTest() {} | |
| 144 | |
| 145 OzoneInitializerForTest::~OzoneInitializerForTest() {} | |
| 146 | |
| 147 bool OzoneInitializerForTest::Initialize() { | |
| 148 // On Ozone, the backend initializes the event system using a UI thread. | |
| 149 message_loop_.reset(new base::MessageLoopForUI); | |
|
spang
2015/12/02 17:00:03
This is a library component. I'm very unconvinced
dshwang
2015/12/08 01:12:38
There are pros and cons.
If the loop should belon
dshwang
2015/12/08 22:19:33
At least, gl_image_test_support and content_test_s
| |
| 150 | |
| 151 OzonePlatform::InitializeForUI(); | |
| 152 OzonePlatform::InitializeForGPU(); | |
| 153 gpu_helper_.reset(new OzoneGpuTestHelper); | |
| 154 if (!gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get(), | |
| 155 base::ThreadTaskRunnerHandle::Get())) { | |
| 156 return false; | |
| 157 } | |
| 158 { | |
| 159 base::MessageLoop::ScopedNestableTaskAllower allow( | |
| 160 base::MessageLoop::current()); | |
| 161 base::RunLoop().RunUntilIdle(); | |
| 162 } | |
| 163 return true; | |
| 164 } | |
| 165 | |
| 134 } // namespace ui | 166 } // namespace ui |
| OLD | NEW |