summaryrefslogtreecommitdiffstats
path: root/ui/compositor
diff options
context:
space:
mode:
Diffstat (limited to 'ui/compositor')
-rw-r--r--ui/compositor/test/context_factories_for_test.cc7
-rw-r--r--ui/compositor/test/default_context_factory.cc10
-rw-r--r--ui/compositor/test/default_context_factory.h2
-rw-r--r--ui/compositor/test/test_suite.cc4
4 files changed, 17 insertions, 6 deletions
diff --git a/ui/compositor/test/context_factories_for_test.cc b/ui/compositor/test/context_factories_for_test.cc
index b03fa34..795f56d 100644
--- a/ui/compositor/test/context_factories_for_test.cc
+++ b/ui/compositor/test/context_factories_for_test.cc
@@ -10,7 +10,6 @@
#include "ui/compositor/compositor_switches.h"
#include "ui/compositor/test/default_context_factory.h"
#include "ui/compositor/test/test_context_factory.h"
-#include "ui/gl/gl_implementation.h"
namespace ui {
@@ -41,9 +40,11 @@ void InitializeContextFactoryForTests(bool allow_test_contexts) {
if (use_test_contexts) {
g_implicit_factory = new ui::TestContextFactory;
} else {
- DCHECK_NE(gfx::kGLImplementationNone, gfx::GetGLImplementation());
DVLOG(1) << "Using DefaultContextFactory";
- g_implicit_factory = new ui::DefaultContextFactory();
+ scoped_ptr<ui::DefaultContextFactory> instance(
+ new ui::DefaultContextFactory());
+ if (instance->Initialize())
+ g_implicit_factory = instance.release();
}
ContextFactory::SetInstance(g_implicit_factory);
}
diff --git a/ui/compositor/test/default_context_factory.cc b/ui/compositor/test/default_context_factory.cc
index 21c004d..4839e1f1 100644
--- a/ui/compositor/test/default_context_factory.cc
+++ b/ui/compositor/test/default_context_factory.cc
@@ -15,12 +15,20 @@
namespace ui {
DefaultContextFactory::DefaultContextFactory() {
- DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone);
}
DefaultContextFactory::~DefaultContextFactory() {
}
+bool DefaultContextFactory::Initialize() {
+ if (!gfx::GLSurface::InitializeOneOff() ||
+ gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
+ LOG(ERROR) << "Could not load the GL bindings";
+ return false;
+ }
+ return true;
+}
+
scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
Compositor* compositor, bool software_fallback) {
DCHECK(!software_fallback);
diff --git a/ui/compositor/test/default_context_factory.h b/ui/compositor/test/default_context_factory.h
index f377f2f..7b8501b 100644
--- a/ui/compositor/test/default_context_factory.h
+++ b/ui/compositor/test/default_context_factory.h
@@ -37,6 +37,8 @@ class DefaultContextFactory : public ContextFactory {
virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
virtual bool DoesCreateTestContexts() OVERRIDE;
+ bool Initialize();
+
private:
scoped_refptr<webkit::gpu::ContextProviderInProcess>
offscreen_compositor_contexts_;
diff --git a/ui/compositor/test/test_suite.cc b/ui/compositor/test/test_suite.cc
index 18b4060..aa21ece 100644
--- a/ui/compositor/test/test_suite.cc
+++ b/ui/compositor/test/test_suite.cc
@@ -9,7 +9,7 @@
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_switches.h"
#include "ui/gfx/gfx_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/gl_implementation.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
@@ -31,8 +31,8 @@ void CompositorTestSuite::Initialize() {
#if defined(USE_X11)
XInitThreads();
#endif
+ CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL));
base::TestSuite::Initialize();
- gfx::GLSurface::InitializeOneOffForTests();
gfx::RegisterPathProvider();