Index: ui/ozone/public/ozone_gpu_test_helper.cc |
diff --git a/ui/ozone/public/ozone_gpu_test_helper.cc b/ui/ozone/public/ozone_gpu_test_helper.cc |
index fe5a17b31cdb9775f7337863131e9ac4c3f14c02..ab7fea96026f44e5301431347aea2610c27a325b 100644 |
--- a/ui/ozone/public/ozone_gpu_test_helper.cc |
+++ b/ui/ozone/public/ozone_gpu_test_helper.cc |
@@ -4,6 +4,7 @@ |
#include "ui/ozone/public/ozone_gpu_test_helper.h" |
+#include "base/run_loop.h" |
#include "base/thread_task_runner_handle.h" |
#include "ipc/ipc_listener.h" |
#include "ipc/ipc_message.h" |
@@ -131,4 +132,35 @@ bool OzoneGpuTestHelper::Initialize( |
return true; |
} |
+// static |
+scoped_ptr<OzoneInitializerForTest> OzoneInitializerForTest::Create() { |
+ scoped_ptr<OzoneInitializerForTest> self(new OzoneInitializerForTest()); |
+ if (!self->Initialize()) |
+ return nullptr; |
+ return self.Pass(); |
+} |
+ |
+OzoneInitializerForTest::OzoneInitializerForTest() {} |
+ |
+OzoneInitializerForTest::~OzoneInitializerForTest() {} |
+ |
+bool OzoneInitializerForTest::Initialize() { |
+ // On Ozone, the backend initializes the event system using a UI thread. |
+ 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
|
+ |
+ OzonePlatform::InitializeForUI(); |
+ OzonePlatform::InitializeForGPU(); |
+ gpu_helper_.reset(new OzoneGpuTestHelper); |
+ if (!gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get(), |
+ base::ThreadTaskRunnerHandle::Get())) { |
+ return false; |
+ } |
+ { |
+ base::MessageLoop::ScopedNestableTaskAllower allow( |
+ base::MessageLoop::current()); |
+ base::RunLoop().RunUntilIdle(); |
+ } |
+ return true; |
+} |
+ |
} // namespace ui |