Return GrGLContext from GrTestTarget

BUG=skia:

Review URL: https://codereview.chromium.org/1207393002
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index b618abe..b39a4dc 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -105,7 +105,7 @@
         }
 
         // We currently hav only implemented the texture uploads for GL.
-        const GrGLInterface* gl = tt.glInterface();
+        const GrGLInterface* gl = tt.glContext()->interface();
         if (!gl) {
             return;
         }
@@ -139,7 +139,7 @@
             return;
         }
 
-        const GrGLInterface* gl = tt.glInterface();
+        const GrGLInterface* gl = tt.glContext()->interface();
         if (!gl) {
             return;
         }
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 3bb84a4..8d449b7 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -17,7 +17,7 @@
 
 class GrBatchTracker;
 class GrContext;
-struct GrGLInterface;
+class GrGLContext;
 class GrIndexBuffer;
 class GrNonInstancedVertices;
 class GrPath;
@@ -366,7 +366,7 @@
     bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
 
     // This is only to be used in tests.
-    virtual const GrGLInterface* glInterfaceForTesting() const { return NULL; }
+    virtual const GrGLContext* glContextForTesting() const { return NULL; }
 
 protected:
     // Functions used to map clip-respecting stencil tests into normal
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 470bc58..3e1ef6c 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -11,15 +11,14 @@
 #include "GrGpuResourceCacheAccess.h"
 #include "GrInOrderDrawBuffer.h"
 #include "GrResourceCache.h"
-#include "gl/GrGLInterface.h"
 #include "SkString.h"
 
-void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterface* gl) {
+void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext* gl) {
     SkASSERT(!fContext);
 
     fContext.reset(SkRef(ctx));
     fDrawTarget.reset(SkRef(target));
-    fGLInterface.reset(SkSafeRef(gl));
+    fGLContext.reset(SkRef(gl));
 }
 
 void GrContext::getTestTarget(GrTestTarget* tar) {
@@ -28,7 +27,7 @@
     // then disconnects. This would help prevent test writers from mixing using the returned
     // GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
     // until ~GrTestTarget().
-    tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glInterfaceForTesting());
+    tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting());
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrTest.h b/src/gpu/GrTest.h
index f1f3cf6..7e2ffed 100644
--- a/src/gpu/GrTest.h
+++ b/src/gpu/GrTest.h
@@ -11,26 +11,26 @@
 
 #include "GrContext.h"
 #include "GrDrawTarget.h"
-#include "gl/GrGLInterface.h"
+#include "gl/GrGLContext.h"
 
 /** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
     should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
     GrContext. In the future this object may provide some guards to prevent this. */
 class GrTestTarget {
 public:
-    GrTestTarget() {};
+    GrTestTarget() : fGLContext(NULL) {};
 
-    void init(GrContext*, GrDrawTarget*, const GrGLInterface*);
+    void init(GrContext*, GrDrawTarget*, const GrGLContext*);
 
     GrDrawTarget* target() { return fDrawTarget.get(); }
 
-    /** Returns a GrGLInterface if the GrContext is backed by OpenGL. */
-    const GrGLInterface* glInterface() { return fGLInterface.get(); }
+    /** Returns a GrGLContext if the GrContext is backed by OpenGL. */
+    const GrGLContext* glContext() { return fGLContext; }
 
 private:
     SkAutoTUnref<GrDrawTarget>              fDrawTarget;
     SkAutoTUnref<GrContext>                 fContext;
-    SkAutoTUnref<const GrGLInterface>       fGLInterface;
+    SkAutoTUnref<const GrGLContext>         fGLContext;
 };
 
 #endif
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index f86007a..6016f68 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -20,7 +20,7 @@
  * Encapsulates information about an OpenGL context including the OpenGL
  * version, the GrGLStandard type of the context, and GLSL version.
  */
-class GrGLContextInfo : public SkNoncopyable {
+class GrGLContextInfo : public SkRefCnt {
 public:
     GrGLStandard standard() const { return fInterface->fStandard; }
     GrGLVersion version() const { return fGLVersion; }
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 98d0ffc..4872db7 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -109,8 +109,8 @@
                           const GrPipeline&,
                           const GrBatchTracker&) const override;
 
-    virtual const GrGLInterface* glInterfaceForTesting() const {
-        return this->glInterface();
+    const GrGLContext* glContextForTesting() const override {
+        return &this->glContext();
     }
 
 private:
@@ -300,7 +300,7 @@
 
     void unbindTextureFromFBO(GrGLenum fboTarget);
 
-    SkAutoTDelete<GrGLContext>  fGLContext;
+    SkAutoTUnref<GrGLContext>  fGLContext;
 
     void createCopyProgram();
 
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index f0e7bfa..6f1d404 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -181,7 +181,7 @@
     GrTestTarget tt;
     context->getTestTarget(&tt);
 
-    const GrGLInterface* gl = tt.glInterface();
+    const GrGLInterface* gl = tt.glContext()->interface();
     if (!gl) {
         return;
     }
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index cfaa669..c45e94e 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -115,7 +115,7 @@
     }
 
     // We currently have only implemented the texture uploads for GL.
-    const GrGLInterface* gl = tt.glInterface();
+    const GrGLInterface* gl = tt.glContext()->interface();
     if (!gl) {
         return;
     }