Index: cc/test/test_context_provider.cc |
diff --git a/cc/test/test_context_provider.cc b/cc/test/test_context_provider.cc |
index e7697f17d25ea69618c976a058cb81d1b1a350f4..2a2b6f6e67e766056e95c2bc094154069b538b2f 100644 |
--- a/cc/test/test_context_provider.cc |
+++ b/cc/test/test_context_provider.cc |
@@ -12,6 +12,8 @@ |
#include "base/logging.h" |
#include "cc/test/test_gles2_interface.h" |
#include "cc/test/test_web_graphics_context_3d.h" |
+#include "third_party/skia/include/gpu/GrContext.h" |
+#include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
namespace cc { |
@@ -90,8 +92,14 @@ class GrContext* TestContextProvider::GrContext() { |
DCHECK(bound_); |
DCHECK(context_thread_checker_.CalledOnValidThread()); |
- // TODO(danakj): Make a test GrContext that works with a test Context3d. |
- return NULL; |
+ if (gr_context_) |
+ return gr_context_.get(); |
+ |
+ auto null_interface = skia::AdoptRef(GrGLCreateNullInterface()); |
+ gr_context_ = skia::AdoptRef(GrContext::Create( |
+ kOpenGL_GrBackend, |
+ reinterpret_cast<GrBackendContext>(null_interface.get()))); |
+ return gr_context_.get(); |
} |
bool TestContextProvider::IsContextLost() { |