Add caps overrides to GMs

Review URL: https://codereview.chromium.org/1158963002
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index eb2cf7d..625bd90 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -73,6 +73,10 @@
     return r;
 }
 
+void GrShaderCaps::applyOptionsOverrides(const GrContextOptions&) {
+    // Currently no overrides apply to shader caps.
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 GrCaps::GrCaps(const GrContextOptions& options) {
@@ -103,6 +107,10 @@
     fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture;
 }
 
+void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
+    fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride);
+}
+
 static SkString map_flags_to_string(uint32_t flags) {
     SkString str;
     if (GrCaps::kNone_MapFlags == flags) {
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index cc7e6c2..5baf722 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -144,7 +144,6 @@
     fSoftwarePathRenderer = NULL;
     fBatchFontCache = NULL;
     fFlushToReduceCacheSize = false;
-    fMaxTextureSizeOverride = 1 << 20;
 }
 
 bool GrContext::init(GrBackend backend, GrBackendContext backendContext,
@@ -292,7 +291,7 @@
 }
 
 int GrContext::getMaxTextureSize() const {
-    return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
+    return fGpu->caps()->maxTextureSize();
 }
 
 int GrContext::getMaxRenderTargetSize() const {
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 8546cf1..37a0feb 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -32,10 +32,6 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) {
-    fMaxTextureSizeOverride = maxTextureSizeOverride;
-}
-
 void GrContext::purgeAllUnlockedResources() {
     fResourceCache->purgeAllUnlocked();
 }
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 6f272b7..13ce507 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -49,7 +49,10 @@
 
     this->init(ctxInfo, glInterface);
 
-    fShaderCaps.reset(SkNEW_ARGS(GrGLSLCaps, (ctxInfo, glInterface, *this)));
+    fShaderCaps.reset(SkNEW_ARGS(GrGLSLCaps, (contextOptions,
+        ctxInfo, glInterface, *this)));
+
+    this->applyOptionsOverrides(contextOptions);
 }
 
 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
@@ -893,7 +896,8 @@
 
 ////////////////////////////////////////////////////////////////////////////////////////////
 
-GrGLSLCaps::GrGLSLCaps(const GrGLContextInfo& ctxInfo,
+GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options,
+                       const GrGLContextInfo& ctxInfo,
                        const GrGLInterface* gli,
                        const GrGLCaps& glCaps) {
     fDropsTileOnZeroDivide = false;
@@ -903,6 +907,7 @@
     fFBFetchColorName = NULL;
     fFBFetchExtensionString = NULL;
     this->init(ctxInfo, gli, glCaps);
+    this->applyOptionsOverrides(options);
 }
 
 void GrGLSLCaps::init(const GrGLContextInfo& ctxInfo,
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 9d38c82..87fc1f4 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -388,7 +388,8 @@
      * Initializes the GrGLSLCaps to the set of features supported in the current
      * OpenGL context accessible via ctxInfo.
      */
-    GrGLSLCaps(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&);
+    GrGLSLCaps(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*,
+               const GrGLCaps&);
 
     /**
      * Some helper functions for encapsulating various extensions to read FB Buffer on openglES