Index: ui/gl/test/run_all_unittests.cc |
diff --git a/ui/gl/test/run_all_unittests.cc b/ui/gl/test/run_all_unittests.cc |
index e9af318893aae5aa8e402bc30135e04485935725..c12715d6c062c53120e39d70c1b7a7361f7cf283 100644 |
--- a/ui/gl/test/run_all_unittests.cc |
+++ b/ui/gl/test/run_all_unittests.cc |
@@ -11,6 +11,10 @@ |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
#include "base/test/mock_chrome_application_mac.h" |
#endif |
+#if defined(USE_OZONE) |
+#include "base/message_loop/message_loop.h" |
+#include "ui/ozone/public/client_native_pixmap_factory.h" |
+#endif |
namespace { |
@@ -26,6 +30,13 @@ class GlTestSuite : public base::TestSuite { |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
mock_cr_app::RegisterMockCrApp(); |
#endif |
+#if defined(USE_OZONE) |
+ // On Ozone, the backend initializes the event system using a UI thread. |
+ message_loop_.reset(new base::MessageLoopForUI); |
+ client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
+ ui::ClientNativePixmapFactory::SetInstance( |
+ client_native_pixmap_factory_.get()); |
+#endif |
} |
void Shutdown() override { |
@@ -33,6 +44,10 @@ class GlTestSuite : public base::TestSuite { |
} |
private: |
+#if defined(USE_OZONE) |
+ std::unique_ptr<base::MessageLoop> message_loop_; |
+ std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
+#endif |
DISALLOW_COPY_AND_ASSIGN(GlTestSuite); |
}; |