implemented getting format from texture as virtual in gpu caps

Bug: skia:
Change-Id: If6bbbd212ff472ea322d2bbed61995fe7ba85df7
Reviewed-on: https://skia-review.googlesource.com/138240
Commit-Queue: Timothy Liang <timliang@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index e8d1cbd..3f301ea 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -107,6 +107,15 @@
     }
 
 private:
+#ifdef GR_TEST_UTILS
+    GrBackendFormat onCreateFormatFromBackendTexture(
+            const GrBackendTexture& backendTex) const override {
+        GrMockTextureInfo mockInfo;
+        SkAssertResult(backendTex.getMockTextureInfo(&mockInfo));
+        return GrBackendFormat::MakeMock(mockInfo.fConfig);
+    }
+#endif
+
     static const int kMaxSampleCnt = 16;
 
     GrMockOptions fOptions;