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 8490a322c2f638e931060326296115412ef864c6..e6152ee64cabcd75e653189eb37f39bdb5a1f635 100644 |
--- a/ui/ozone/public/ozone_gpu_test_helper.cc |
+++ b/ui/ozone/public/ozone_gpu_test_helper.cc |
@@ -4,6 +4,8 @@ |
#include "ui/ozone/public/ozone_gpu_test_helper.h" |
+#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
#include "base/thread_task_runner_handle.h" |
#include "ipc/ipc_listener.h" |
#include "ipc/ipc_message.h" |
@@ -112,4 +114,38 @@ 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() { |
+ scoped_ptr<base::MessageLoop> message_loop; |
+ if (!base::MessageLoop::current()) |
+ message_loop.reset(new base::MessageLoopForUI); |
dshwang
2015/07/15 16:02:41
MessageLoopForUI creation is ugly, but OzonePlatfo
dshwang
2015/07/15 16:07:19
another solution is to move `gfx::GLSurface::Initi
|
+ |
+ 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 |