Revert "Move more internal methods from GrContext to GrContextPriv"

This reverts commit f440cecbfdf1910104f36aedd0e963da2ae8b6a8.

Reason for revert: breaking android builds. 

Original change's description:
> Move more internal methods from GrContext to GrContextPriv
> 
> TBR=bsalomon@google.com
> Change-Id: Ia8cf0e0d30451c69bc7a08215aafa6abe6e0ddbe
> Reviewed-on: https://skia-review.googlesource.com/97080
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: If263f8161f0fbe3fc6ee8f34bb09e237705c3694
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/97200
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index dac78a8..efa7de2 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -28,7 +28,7 @@
         glctx1->makeCurrent();
         if (grctx1) {
             if (backendTex1 && backendTex1->isValid()) {
-                GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->contextPriv().getGpu());
+                GrGLGpu* gpu1 = static_cast<GrGLGpu*>(grctx1->getGpu());
                 gpu1->deleteTestingOnlyBackendTexture(backendTex1);
             }
         }
@@ -53,7 +53,7 @@
     if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) {
         return;
     }
-    GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->contextPriv().getGpu());
+    GrGLGpu* gpu0 = static_cast<GrGLGpu*>(context0->getGpu());
     if (!gpu0->glCaps().shaderCaps()->externalTextureSupport()) {
         return;
     }
@@ -83,7 +83,7 @@
 
     // Use GL Context 1 to create a texture unknown to GrContext.
     context1->flush();
-    GrGpu* gpu1 = context1->contextPriv().getGpu();
+    GrGpu* gpu1 = context1->getGpu();
     static const int kSize = 100;
     backendTexture1 =
         gpu1->createTestingOnlyBackendTexture(nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig,
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 6c2e8d2..cf92095 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -348,7 +348,7 @@
 
 static int get_glprograms_max_stages(const sk_gpu_test::ContextInfo& ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    GrGLGpu* gpu = static_cast<GrGLGpu*>(context->contextPriv().getGpu());
+    GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());
     int maxStages = 6;
     if (kGLES_GrGLStandard == gpu->glStandard()) {
     // We've had issues with driver crashes and HW limits being exceeded with many effects on
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 006fd00..df1e8ee 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -37,14 +37,12 @@
     if (!context->caps()->mipMapSupport()) {
         return;
     }
-    GrGpu* gpu = context->contextPriv().getGpu();
-
     for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) {
         for (auto isRT : {false, true}) {
             // CreateTestingOnlyBackendTexture currently doesn't support uploading data to mip maps
             // so we don't send any. However, we pretend there is data for the checks below which is
             // fine since we are never actually using these textures for any work on the gpu.
-            GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+            GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
                     nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, isRT, mipMapped);
 
             sk_sp<GrTextureProxy> proxy;
@@ -71,7 +69,7 @@
             }
             REPORTER_ASSERT(reporter, proxy);
             if (!proxy) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -80,7 +78,7 @@
             GrTexture* texture = proxy->priv().peekTexture();
             REPORTER_ASSERT(reporter, texture);
             if (!texture) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -94,7 +92,7 @@
             } else {
                 REPORTER_ASSERT(reporter, GrMipMapped::kNo == texture->texturePriv().mipMapped());
             }
-            gpu->deleteTestingOnlyBackendTexture(&backendTex);
+            context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
         }
     }
 }
@@ -106,11 +104,9 @@
     if (!context->caps()->mipMapSupport()) {
         return;
     }
-    GrGpu* gpu = context->contextPriv().getGpu();
-
     for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) {
         for (auto willUseMips : {false, true}) {
-            GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+            GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
                     nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, false, mipMapped);
 
             sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backendTex,
@@ -122,7 +118,7 @@
             GrTextureProxy* proxy = as_IB(image)->peekProxy();
             REPORTER_ASSERT(reporter, proxy);
             if (!proxy) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -131,7 +127,7 @@
             sk_sp<GrTexture> texture = sk_ref_sp(proxy->priv().peekTexture());
             REPORTER_ASSERT(reporter, texture);
             if (!texture) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -139,7 +135,7 @@
                     texture, kTopLeft_GrSurfaceOrigin, nullptr, kPremul_SkAlphaType, nullptr);
             REPORTER_ASSERT(reporter, imageGen);
             if (!imageGen) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -155,7 +151,7 @@
 
             REPORTER_ASSERT(reporter, genProxy);
             if (!genProxy) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -168,7 +164,7 @@
             GrTexture* genTexture = genProxy->priv().peekTexture();
             REPORTER_ASSERT(reporter, genTexture);
             if (!genTexture) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 return;
             }
 
@@ -206,7 +202,7 @@
             bitmap.allocPixels(imageInfo);
             surfContext->readPixels(imageInfo, bitmap.getPixels(), 0, 0, 0, 0);
 
-            gpu->deleteTestingOnlyBackendTexture(&backendTex);
+            context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
         }
     }
 }
@@ -220,13 +216,12 @@
     }
 
     auto resourceProvider = context->contextPriv().resourceProvider();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     for (auto willUseMips : {false, true}) {
         for (auto isWrapped : {false, true}) {
             GrMipMapped mipMapped = willUseMips ? GrMipMapped::kYes : GrMipMapped::kNo;
             sk_sp<SkSurface> surface;
-            GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+            GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
                     nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, true, mipMapped);
             if (isWrapped) {
                 surface = SkSurface::MakeFromBackendTexture(context,
@@ -245,7 +240,7 @@
             }
             REPORTER_ASSERT(reporter, surface);
             if (!surface) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
             }
             SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice();
             GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy();
@@ -258,7 +253,7 @@
             sk_sp<SkImage> image = surface->makeImageSnapshot();
             REPORTER_ASSERT(reporter, image);
             if (!image) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
             }
             texProxy = as_IB(image)->peekProxy();
             REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
@@ -270,7 +265,7 @@
             // Must flush the context to make sure all the cmds (copies, etc.) from above are sent
             // to the gpu before we delete the backendHandle.
             context->flush();
-            gpu->deleteTestingOnlyBackendTexture(&backendTex);
+            context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
         }
     }
 }
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 7e938c7..6c1f209 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -30,7 +30,7 @@
 static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps);
 
 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrPorterDuff, reporter, ctxInfo) {
-    const GrCaps& caps = *ctxInfo.grContext()->contextPriv().getGpu()->caps();
+    const GrCaps& caps = *ctxInfo.grContext()->getGpu()->caps();
     if (!caps.shaderCaps()->dualSourceBlendingSupport()) {
         SK_ABORT("Null context does not support dual source blending.");
         return;
@@ -1061,7 +1061,6 @@
         return;
     }
 
-    GrGpu* gpu = ctx->contextPriv().getGpu();
     GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider();
     const GrCaps& caps = *ctx->caps();
     if (caps.shaderCaps()->dualSourceBlendingSupport()) {
@@ -1070,8 +1069,8 @@
     }
 
     GrBackendTexture backendTex =
-        gpu->createTestingOnlyBackendTexture(nullptr, 100, 100, kRGBA_8888_GrPixelConfig,
-                                             false, GrMipMapped::kNo);
+        ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100, kRGBA_8888_GrPixelConfig,
+                                                       false, GrMipMapped::kNo);
 
     GrXferProcessor::DstProxy fakeDstProxy;
     {
@@ -1102,7 +1101,7 @@
             }
         }
     }
-    gpu->deleteTestingOnlyBackendTexture(&backendTex);
+    ctx->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
 }
 
 #endif
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 72a92a7..eab9301 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -25,7 +25,6 @@
 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     auto resourceProvider = context->contextPriv().resourceProvider();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrSurfaceDesc desc;
     desc.fFlags = kRenderTarget_GrSurfaceFlag;
@@ -52,7 +51,7 @@
     REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
     REPORTER_ASSERT(reporter, static_cast<GrSurface*>(tex1.get()) == tex1->asTexture());
 
-    GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+    GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
         nullptr, 256, 256, kRGBA_8888_GrPixelConfig, false, GrMipMapped::kNo);
 
     sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
@@ -67,7 +66,7 @@
     REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
                     static_cast<GrSurface*>(texRT2->asTexture()));
 
-    gpu->deleteTestingOnlyBackendTexture(&backendTex);
+    context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
 }
 
 // This test checks that the isConfigTexturable and isConfigRenderable are
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 83ff47c..078bd7c 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -723,9 +723,8 @@
     std::unique_ptr<uint32_t[]> pixels(new uint32_t[kWidth * kHeight]);
 
     GrContext* ctx = ctxInfo.grContext();
-    GrGpu* gpu = ctx->contextPriv().getGpu();
 
-    GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+    GrBackendTexture backendTex = ctxInfo.grContext()->getGpu()->createTestingOnlyBackendTexture(
                pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
 
     TextureReleaseChecker releaseChecker;
@@ -757,7 +756,7 @@
     refImg.reset(nullptr); // force a release of the image
     REPORTER_ASSERT(reporter, 1 == releaseChecker.fReleaseCount);
 
-    gpu->deleteTestingOnlyBackendTexture(&backendTex);
+    ctxInfo.grContext()->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
 }
 
 static void test_cross_context_image(skiatest::Reporter* reporter, const GrContextOptions& options,
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 406d5e2..b8b9e6f 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -111,9 +111,6 @@
 
 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-#if GR_GPU_STATS
-    GrGpu* gpu = context->contextPriv().getGpu();
-#endif
 
     sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
                                                                      SkBackingFit::kApprox,
@@ -131,23 +128,23 @@
     context->flush();
     context->resetGpuStats();
 #if GR_GPU_STATS
-    REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);
-    REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
     GrPaint grPaint;
     // This one should succeed.
     renderTargetContext->priv().testingOnly_addDrawOp(Op::Make(attribCnt));
     context->flush();
 #if GR_GPU_STATS
-    REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 1);
-    REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
     context->resetGpuStats();
     renderTargetContext->priv().testingOnly_addDrawOp(Op::Make(attribCnt + 1));
     context->flush();
 #if GR_GPU_STATS
-    REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);
-    REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 1);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
+    REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 1);
 #endif
 }
 #endif
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 121cf86..55a7766 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -47,17 +47,16 @@
 static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p,
                                           GrBackendTexture* backendTex) {
     GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
-    *backendTex = gpu->createTestingOnlyBackendTexture(nullptr, p.fSize, p.fSize,
-                                                       p.fConfig, false,
-                                                       GrMipMapped::kNo);
+    *backendTex = context->getGpu()->createTestingOnlyBackendTexture(nullptr, p.fSize, p.fSize,
+                                                                     p.fConfig, false,
+                                                                     GrMipMapped::kNo);
 
     return proxyProvider->createWrappedTextureProxy(*backendTex, p.fOrigin);
 }
 
 static void cleanup_backend(GrContext* context, GrBackendTexture* backendTex) {
-    context->contextPriv().getGpu()->deleteTestingOnlyBackendTexture(backendTex);
+    context->getGpu()->deleteTestingOnlyBackendTexture(backendTex);
 }
 
 // Basic test that two proxies with overlapping intervals and compatible descriptors are
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 34ed4f7..dd122a0 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -200,7 +200,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
-    GrGpu* gpu = context->contextPriv().getGpu();
+    GrGpu* gpu = context->getGpu();
     // this test is only valid for GL
     if (!gpu || !gpu->glContextForTesting()) {
         return;
@@ -370,13 +370,12 @@
     Mock mock(10, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // Create a bunch of resources with no keys
-    TestResource* a = new TestResource(gpu);
-    TestResource* b = new TestResource(gpu);
-    TestResource* c = new TestResource(gpu);
-    TestResource* d = new TestResource(gpu);
+    TestResource* a = new TestResource(context->getGpu());
+    TestResource* b = new TestResource(context->getGpu());
+    TestResource* c = new TestResource(context->getGpu());
+    TestResource* d = new TestResource(context->getGpu());
     a->setSize(11);
     b->setSize(12);
     c->setSize(13);
@@ -428,21 +427,21 @@
     Mock mock(10, 300);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrUniqueKey uniqueKey;
     make_unique_key<0>(&uniqueKey, 0);
 
     // Create a scratch, a unique, and a wrapped resource
     TestResource* scratch =
-            TestResource::CreateScratch(gpu, SkBudgeted::kYes, TestResource::kB_SimulatedProperty);
+            TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes, TestResource::kB_SimulatedProperty);
     scratch->setSize(10);
-    TestResource* unique = new TestResource(gpu);
+    TestResource* unique = new TestResource(context->getGpu());
     unique->setSize(11);
     unique->resourcePriv().setUniqueKey(uniqueKey);
-    TestResource* wrapped = TestResource::CreateWrapped(gpu);
+    TestResource* wrapped = TestResource::CreateWrapped(context->getGpu());
     wrapped->setSize(12);
-    TestResource* unbudgeted = new TestResource(gpu, SkBudgeted::kNo);
+    TestResource* unbudgeted =
+            new TestResource(context->getGpu(), SkBudgeted::kNo);
     unbudgeted->setSize(13);
 
     // Make sure we can add a unique key to the wrapped resource
@@ -484,7 +483,7 @@
     REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes());
 
     // Now try freeing the budgeted resources first
-    wrapped = TestResource::CreateWrapped(gpu);
+    wrapped = TestResource::CreateWrapped(context->getGpu());
     scratch->setSize(12);
     unique->unref();
     REPORTER_ASSERT(reporter, 11 == cache->getPurgeableBytes());
@@ -525,7 +524,6 @@
     Mock mock(10, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrUniqueKey uniqueKey;
     make_unique_key<0>(&uniqueKey, 0);
@@ -536,7 +534,7 @@
     TestResource* unbudgeted;
 
     // A large uncached or wrapped resource shouldn't evict anything.
-    scratch = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    scratch = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                           TestResource::kB_SimulatedProperty);
 
     scratch->setSize(10);
@@ -547,7 +545,7 @@
     REPORTER_ASSERT(reporter, 10 == cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 10 == cache->getPurgeableBytes());
 
-    unique = new TestResource(gpu);
+    unique = new TestResource(context->getGpu());
     unique->setSize(11);
     unique->resourcePriv().setUniqueKey(uniqueKey);
     unique->unref();
@@ -558,7 +556,7 @@
     REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes());
 
     size_t large = 2 * cache->getResourceBytes();
-    unbudgeted = new TestResource(gpu, SkBudgeted::kNo, large);
+    unbudgeted = new TestResource(context->getGpu(), SkBudgeted::kNo, large);
     REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -572,7 +570,7 @@
     REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes());
 
-    wrapped = TestResource::CreateWrapped(gpu, large);
+    wrapped = TestResource::CreateWrapped(context->getGpu(), large);
     REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -600,10 +598,10 @@
     Mock mock(10, 300);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     TestResource* resource =
-        TestResource::CreateScratch(gpu, SkBudgeted::kNo, TestResource::kA_SimulatedProperty);
+        TestResource::CreateScratch(context->getGpu(), SkBudgeted::kNo,
+                                    TestResource::kA_SimulatedProperty);
     GrScratchKey key;
     TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &key);
 
@@ -664,13 +662,12 @@
     Mock mock(5, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // Create two resources that have the same scratch key.
-    TestResource* a = TestResource::CreateScratch(gpu,
+    TestResource* a = TestResource::CreateScratch(context->getGpu(),
                                                   SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
-    TestResource* b = TestResource::CreateScratch(gpu,
+    TestResource* b = TestResource::CreateScratch(context->getGpu(),
                                                   SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
     a->setSize(11);
@@ -712,12 +709,11 @@
     Mock mock(5, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // Create two resources that have the same scratch key.
-    TestResource* a = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    TestResource* a = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
-    TestResource* b = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    TestResource* b = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
     a->unref();
     b->unref();
@@ -772,12 +768,11 @@
     Mock mock(5, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // Create two resources that have the same scratch key.
-    TestResource* a = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    TestResource* a = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
-    TestResource* b = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    TestResource* b = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                   TestResource::kB_SimulatedProperty);
     a->unref();
     b->unref();
@@ -832,13 +827,12 @@
     Mock mock(5, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrUniqueKey key;
     make_unique_key<0>(&key, 0);
 
     // Create two resources that we will attempt to register with the same unique key.
-    TestResource* a = new TestResource(gpu);
+    TestResource* a = new TestResource(context->getGpu());
     a->setSize(11);
 
     // Set key on resource a.
@@ -855,7 +849,7 @@
     REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
 
     // Create resource b and set the same key. It should replace a's unique key cache entry.
-    TestResource* b = new TestResource(gpu);
+    TestResource* b = new TestResource(context->getGpu());
     b->setSize(12);
     b->resourcePriv().setUniqueKey(key);
     REPORTER_ASSERT(reporter, b == cache->findAndRefUniqueResource(key));
@@ -875,7 +869,7 @@
     // Now replace b with c, but make sure c can start with one unique key and change it to b's key.
     // Also make b be unreffed when replacement occurs.
     b->unref();
-    TestResource* c = new TestResource(gpu);
+    TestResource* c = new TestResource(context->getGpu());
     GrUniqueKey differentKey;
     make_unique_key<0>(&differentKey, 1);
     c->setSize(13);
@@ -912,7 +906,7 @@
     {
         GrUniqueKey key2;
         make_unique_key<0>(&key2, 0);
-        sk_sp<TestResource> d(new TestResource(gpu));
+        sk_sp<TestResource> d(new TestResource(context->getGpu()));
         int foo = 4132;
         key2.setCustomData(SkData::MakeWithCopy(&foo, sizeof(foo)));
         d->resourcePriv().setUniqueKey(key2);
@@ -928,7 +922,6 @@
     Mock mock(5, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrUniqueKey key1, key2, key3;
     make_unique_key<0>(&key1, 1);
@@ -936,9 +929,9 @@
     make_unique_key<0>(&key3, 3);
 
     // Add three resources to the cache. Only c is usable as scratch.
-    TestResource* a = new TestResource(gpu);
-    TestResource* b = new TestResource(gpu);
-    TestResource* c = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+    TestResource* a = new TestResource(context->getGpu());
+    TestResource* b = new TestResource(context->getGpu());
+    TestResource* c = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                   TestResource::kA_SimulatedProperty);
     a->resourcePriv().setUniqueKey(key1);
     b->resourcePriv().setUniqueKey(key2);
@@ -997,14 +990,13 @@
     Mock mock(3, 30000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     GrUniqueKey key1, key2;
     make_unique_key<0>(&key1, 1);
     make_unique_key<0>(&key2, 2);
 
-    TestResource* a = new TestResource(gpu);
-    TestResource* b = new TestResource(gpu);
+    TestResource* a = new TestResource(context->getGpu());
+    TestResource* b = new TestResource(context->getGpu());
     a->resourcePriv().setUniqueKey(key1);
     b->resourcePriv().setUniqueKey(key2);
 
@@ -1040,13 +1032,12 @@
         Mock mock(3, 30000);
         GrContext* context = mock.context();
         GrResourceCache* cache = mock.cache();
-        GrGpu* gpu = context->contextPriv().getGpu();
 
-        TestResource* a = new TestResource(gpu);
+        TestResource* a = new TestResource(context->getGpu());
         a->resourcePriv().setUniqueKey(key1);
         a->unref();
 
-        TestResource* b = new TestResource(gpu);
+        TestResource* b = new TestResource(context->getGpu());
         b->resourcePriv().setUniqueKey(key2);
         b->unref();
 
@@ -1070,14 +1061,13 @@
         Mock mock(2, 300);
         GrContext* context = mock.context();
         GrResourceCache* cache = mock.cache();
-        GrGpu* gpu = context->contextPriv().getGpu();
 
-        TestResource* a = new TestResource(gpu);
+        TestResource* a = new TestResource(context->getGpu());
         a->setSize(100);
         a->resourcePriv().setUniqueKey(key1);
         a->unref();
 
-        TestResource* b = new TestResource(gpu);
+        TestResource* b = new TestResource(context->getGpu());
         b->setSize(100);
         b->resourcePriv().setUniqueKey(key2);
         b->unref();
@@ -1110,7 +1100,6 @@
         Mock mock(kBudgetCnt, kBudgetSize);
         GrContext* context = mock.context();
         GrResourceCache* cache = mock.cache();
-        GrGpu* gpu = context->contextPriv().getGpu();
 
         // Pick a random number of resources to add before the timestamp will wrap.
         cache->changeTimestamp(SK_MaxU32 - random.nextULessThan(kCount + 1));
@@ -1127,7 +1116,7 @@
             GrUniqueKey key;
             make_unique_key<0>(&key, j);
 
-            TestResource* r = new TestResource(gpu);
+            TestResource* r = new TestResource(context->getGpu());
             r->resourcePriv().setUniqueKey(key);
             if (random.nextU() % kLockedFreq) {
                 // Make this is purgeable.
@@ -1167,7 +1156,6 @@
     Mock mock(1000000, 1000000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // The current cache impl will round the max flush count to the next power of 2. So we choose a
     // power of two here to keep things simpler.
@@ -1177,7 +1165,7 @@
     {
         // Insert a resource and send a flush notification kFlushCount times.
         for (int i = 0; i < kFlushCount; ++i) {
-            TestResource* r = new TestResource(gpu);
+            TestResource* r = new TestResource(context->getGpu());
             GrUniqueKey k;
             make_unique_key<1>(&k, i);
             r->resourcePriv().setUniqueKey(k);
@@ -1207,7 +1195,7 @@
     {
         GrGpuResource* refedResources[kFlushCount >> 1];
         for (int i = 0; i < kFlushCount; ++i) {
-            TestResource* r = new TestResource(gpu);
+            TestResource* r = new TestResource(context->getGpu());
             GrUniqueKey k;
             make_unique_key<1>(&k, i);
             r->resourcePriv().setUniqueKey(k);
@@ -1248,7 +1236,7 @@
     // eviction.
     context->flush();
     for (int i = 0; i < 10; ++i) {
-        TestResource* r = new TestResource(gpu);
+        TestResource* r = new TestResource(context->getGpu());
         GrUniqueKey k;
         make_unique_key<1>(&k, i);
         r->resourcePriv().setUniqueKey(k);
@@ -1265,7 +1253,6 @@
     Mock mock(1000000, 1000000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     static constexpr int kCnts[] = {1, 10, 1024};
     auto nowish = []() {
@@ -1284,7 +1271,7 @@
         {
             // Insert resources and get time points between each addition.
             for (int i = 0; i < cnt; ++i) {
-                TestResource* r = new TestResource(gpu);
+                TestResource* r = new TestResource(context->getGpu());
                 GrUniqueKey k;
                 make_unique_key<1>(&k, i);
                 r->resourcePriv().setUniqueKey(k);
@@ -1315,7 +1302,7 @@
         {
             std::unique_ptr<GrGpuResource* []> refedResources(new GrGpuResource*[cnt / 2]);
             for (int i = 0; i < cnt; ++i) {
-                TestResource* r = new TestResource(gpu);
+                TestResource* r = new TestResource(context->getGpu());
                 GrUniqueKey k;
                 make_unique_key<1>(&k, i);
                 r->resourcePriv().setUniqueKey(k);
@@ -1350,7 +1337,7 @@
         // eviction
         context->flush();
         for (int i = 0; i < 10; ++i) {
-            TestResource* r = new TestResource(gpu);
+            TestResource* r = new TestResource(context->getGpu());
             GrUniqueKey k;
             make_unique_key<1>(&k, i);
             r->resourcePriv().setUniqueKey(k);
@@ -1368,7 +1355,6 @@
     Mock mock(6, 100);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     enum TestsCase {
         kOnlyScratch_TestCase = 0,
@@ -1388,9 +1374,9 @@
         make_unique_key<0>(&key3, 3);
 
         // Add three unique resources to the cache.
-        TestResource *unique1 = new TestResource(gpu);
-        TestResource *unique2 = new TestResource(gpu);
-        TestResource *unique3 = new TestResource(gpu);
+        TestResource *unique1 = new TestResource(context->getGpu());
+        TestResource *unique2 = new TestResource(context->getGpu());
+        TestResource *unique3 = new TestResource(context->getGpu());
 
         unique1->resourcePriv().setUniqueKey(key1);
         unique2->resourcePriv().setUniqueKey(key2);
@@ -1401,9 +1387,9 @@
         unique3->setSize(12);
 
         // Add two scratch resources to the cache.
-        TestResource *scratch1 = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+        TestResource *scratch1 = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                              TestResource::kA_SimulatedProperty);
-        TestResource *scratch2 = TestResource::CreateScratch(gpu, SkBudgeted::kYes,
+        TestResource *scratch2 = TestResource::CreateScratch(context->getGpu(), SkBudgeted::kYes,
                                                              TestResource::kB_SimulatedProperty);
         scratch1->setSize(13);
         scratch2->setSize(14);
@@ -1482,7 +1468,6 @@
     Mock mock(2 * kResourceCnt, 2 * kResourceCnt + 1000);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     for (int i = 0; i < kResourceCnt; ++i) {
         GrUniqueKey key1, key2;
@@ -1491,12 +1476,12 @@
 
         TestResource* resource;
 
-        resource = new TestResource(gpu);
+        resource = new TestResource(context->getGpu());
         resource->resourcePriv().setUniqueKey(key1);
         resource->setSize(1);
         resource->unref();
 
-        resource = new TestResource(gpu);
+        resource = new TestResource(context->getGpu());
         resource->resourcePriv().setUniqueKey(key2);
         resource->setSize(1);
         resource->unref();
@@ -1552,9 +1537,7 @@
 static void test_abandoned(skiatest::Reporter* reporter) {
     Mock mock(10, 300);
     GrContext* context = mock.context();
-    GrGpu* gpu = context->contextPriv().getGpu();
-
-    sk_sp<GrGpuResource> resource(new TestResource(gpu));
+    sk_sp<GrGpuResource> resource(new TestResource(context->getGpu()));
     context->abandonContext();
 
     REPORTER_ASSERT(reporter, resource->wasDestroyed());
@@ -1588,14 +1571,13 @@
     Mock mock(kNumResources, kNumResources * TestResource::kDefaultSize);
     GrContext* context = mock.context();
     GrResourceCache* cache = mock.cache();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     SkString tagStr;
     int tagIdx = 0;
     int currTagCnt = 0;
 
     for (int i = 0; i < kNumResources; ++i, ++currTagCnt) {
-        sk_sp<GrGpuResource> resource(new TestResource(gpu));
+        sk_sp<GrGpuResource> resource(new TestResource(context->getGpu()));
         GrUniqueKey key;
         if (currTagCnt == tagIdx) {
             tagIdx += 1;
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index b24b7f7..7d6f6a9 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -169,7 +169,7 @@
     //
     // TODO: Once Vulkan supports legacy mip-mapping, we can promote this to GrCaps. Right now,
     // Vulkan has most of the functionality, but not the mip-mapping part that's being tested here.
-    GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->contextPriv().getGpu());
+    GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->getGpu());
     if (glGpu->glCaps().srgbDecodeDisableSupport() &&
         glGpu->glCaps().srgbDecodeDisableAffectsMipmaps()) {
         read_and_check_pixels(reporter, l32RenderTargetContext.get(), expectedLinear, iiRGBA,
diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp
index eea6e37..b4f63fe 100644
--- a/tests/SurfaceSemaphoreTest.cpp
+++ b/tests/SurfaceSemaphoreTest.cpp
@@ -8,7 +8,6 @@
 #include "SkTypes.h"
 
 #if SK_SUPPORT_GPU
-#include "GrContextPriv.h"
 #include "GrContextFactory.h"
 #include "GrTest.h"
 #include "Test.h"
@@ -133,7 +132,7 @@
 #ifdef SK_VULKAN
     if (kVulkan_GrBackend == mainInfo.backend()) {
         // Initialize the secondary semaphore instead of having Ganesh create one internally
-        GrVkGpu* gpu = static_cast<GrVkGpu*>(mainCtx->contextPriv().getGpu());
+        GrVkGpu* gpu = static_cast<GrVkGpu*>(mainCtx->getGpu());
         const GrVkInterface* interface = gpu->vkInterface();
         VkDevice device = gpu->device();
 
@@ -236,7 +235,7 @@
     REPORTER_ASSERT(reporter, GrSemaphoresSubmitted::kYes == submitted);
 
     if (kOpenGL_GrBackend == ctxInfo.backend()) {
-        GrGLGpu* gpu = static_cast<GrGLGpu*>(ctx->contextPriv().getGpu());
+        GrGLGpu* gpu = static_cast<GrGLGpu*>(ctx->getGpu());
         const GrGLInterface* interface = gpu->glInterface();
         GrGLsync sync = semaphore.glSync();
         REPORTER_ASSERT(reporter, sync);
@@ -247,7 +246,7 @@
 
 #ifdef SK_VULKAN
     if (kVulkan_GrBackend == ctxInfo.backend()) {
-        GrVkGpu* gpu = static_cast<GrVkGpu*>(ctx->contextPriv().getGpu());
+        GrVkGpu* gpu = static_cast<GrVkGpu*>(ctx->getGpu());
         const GrVkInterface* interface = gpu->vkInterface();
         VkDevice device = gpu->device();
         VkQueue queue = gpu->queue();
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index c06ba24..7f0d997 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -584,17 +584,15 @@
 #if SK_SUPPORT_GPU
 static sk_sp<SkSurface> create_gpu_surface_backend_texture(
     GrContext* context, int sampleCnt, uint32_t color, GrBackendTexture* outTexture) {
-    GrGpu* gpu = context->contextPriv().getGpu();
-
     const int kWidth = 10;
     const int kHeight = 10;
     std::unique_ptr<uint32_t[]> pixels(new uint32_t[kWidth * kHeight]);
     sk_memset32(pixels.get(), color, kWidth * kHeight);
 
-    *outTexture = gpu->createTestingOnlyBackendTexture(
+    *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
         pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
 
-    if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
+    if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
         return nullptr;
     }
 
@@ -603,7 +601,7 @@
                                                                  kRGBA_8888_SkColorType,
                                                                  nullptr, nullptr);
     if (!surface) {
-        gpu->deleteTestingOnlyBackendTexture(outTexture);
+        context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
         return nullptr;
     }
     return surface;
@@ -611,17 +609,15 @@
 
 static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
     GrContext* context, int sampleCnt, uint32_t color, GrBackendTexture* outTexture) {
-    GrGpu* gpu = context->contextPriv().getGpu();
-
     const int kWidth = 10;
     const int kHeight = 10;
     std::unique_ptr<uint32_t[]> pixels(new uint32_t[kWidth * kHeight]);
     sk_memset32(pixels.get(), color, kWidth * kHeight);
 
-    *outTexture = gpu->createTestingOnlyBackendTexture(
+    *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
         pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
 
-    if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
+    if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
         return nullptr;
     }
 
@@ -630,7 +626,7 @@
             nullptr, nullptr);
 
     if (!surface) {
-        gpu->deleteTestingOnlyBackendTexture(outTexture);
+        context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
         return nullptr;
     }
     return surface;
@@ -678,7 +674,6 @@
 
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     std::function<sk_sp<GrSurfaceContext>(SkSurface*)> grSurfaceContextGetters[] = {
         [] (SkSurface* s){
@@ -708,7 +703,7 @@
             auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex);
             test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor);
             surface.reset();
-            gpu->deleteTestingOnlyBackendTexture(&backendTex);
+            context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
         }
     }
 }
@@ -756,7 +751,7 @@
 }
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
-    GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
+    GrGpu* gpu = ctxInfo.grContext()->getGpu();
     if (!gpu) {
         return;
     }
@@ -779,7 +774,7 @@
 
 
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) {
-    GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
+    GrGpu* gpu = ctxInfo.grContext()->getGpu();
     if (!gpu) {
         return;
     }
@@ -880,7 +875,6 @@
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-
     bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false);
     auto surfaceMaker = [context](const SkImageInfo& info) {
         return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
@@ -890,16 +884,14 @@
 
     std::vector<GrBackendTexture> backendTextures;
     auto wrappedSurfaceMaker = [ context, &backendTextures ](const SkImageInfo& info) {
-        GrGpu* gpu = context->contextPriv().getGpu();
-
         static const int kSize = 10;
         GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->caps());
 
-        GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+        GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
                 nullptr, kSize, kSize, config, true, GrMipMapped::kNo);
 
         if (!backendTex.isValid() ||
-            !gpu->isTestingOnlyBackendTexture(backendTex)) {
+            !context->getGpu()->isTestingOnlyBackendTexture(backendTex)) {
             return sk_sp<SkSurface>(nullptr);
         }
         backendTextures.push_back(backendTex);
@@ -915,9 +907,8 @@
 
     context->flush();
 
-    GrGpu* gpu = context->contextPriv().getGpu();
     for (auto backendTex : backendTextures) {
-        gpu->deleteTestingOnlyBackendTexture(&backendTex);
+        context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
     }
 }
 #endif
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index ce8d1ed..ee1a233 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -69,7 +69,6 @@
     }
 
     auto resourceProvider = context->contextPriv().resourceProvider();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     // set up the data
     const int kTextureWidth = 16;
@@ -111,13 +110,13 @@
     // transfer full data
 
     bool result;
-    result = gpu->transferPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
-                                 config, buffer.get(), 0, rowBytes);
+    result = context->getGpu()->transferPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
+                                               config, buffer.get(), 0, rowBytes);
     REPORTER_ASSERT(reporter, result);
 
     memset(dstBuffer.get(), 0xCDCD, size);
-    result = gpu->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
-                             config, dstBuffer.get(), rowBytes);
+    result = context->getGpu()->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
+                                           config, dstBuffer.get(), rowBytes);
     if (result) {
         REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
                                                                           dstBuffer,
@@ -143,13 +142,13 @@
     buffer->unmap();
 
     size_t offset = sizeof(GrColor)*(kTop*kBufferWidth + kLeft);
-    result = gpu->transferPixels(tex.get(), kLeft, kTop, kWidth, kHeight, config,
-                                 buffer.get(), offset, rowBytes);
+    result = context->getGpu()->transferPixels(tex.get(), kLeft, kTop, kWidth, kHeight, config,
+                                               buffer.get(), offset, rowBytes);
     REPORTER_ASSERT(reporter, result);
 
     memset(dstBuffer.get(), 0xCDCD, size);
-    result = gpu->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
-                             config, dstBuffer.get(), rowBytes);
+    result = context->getGpu()->readPixels(tex.get(), origin, 0, 0, kTextureWidth, kTextureHeight,
+                                           config, dstBuffer.get(), rowBytes);
     if (result) {
         REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
                                                                           dstBuffer,
diff --git a/tests/VkHeapTests.cpp b/tests/VkHeapTests.cpp
index 29e4e79..fd5f88a 100644
--- a/tests/VkHeapTests.cpp
+++ b/tests/VkHeapTests.cpp
@@ -11,7 +11,6 @@
 
 #if SK_SUPPORT_GPU && defined(SK_VULKAN)
 
-#include "GrContextPriv.h"
 #include "GrContextFactory.h"
 #include "GrTest.h"
 #include "Test.h"
@@ -20,7 +19,7 @@
 using sk_gpu_test::GrContextFactory;
 
 void subheap_test(skiatest::Reporter* reporter, GrContext* context) {
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     // memtype doesn't matter, we're just testing the suballocation algorithm so we'll use 0
     GrVkSubHeap heap(gpu, 0, 0, 64 * 1024, 32);
@@ -117,7 +116,7 @@
 }
 
 void suballoc_test(skiatest::Reporter* reporter, GrContext* context) {
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     // memtype/heap index don't matter, we're just testing the allocation algorithm so we'll use 0
     GrVkHeap heap(gpu, GrVkHeap::kSubAlloc_Strategy, 64 * 1024);
@@ -177,7 +176,7 @@
 }
 
 void singlealloc_test(skiatest::Reporter* reporter, GrContext* context) {
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     // memtype/heap index don't matter, we're just testing the allocation algorithm so we'll use 0
     GrVkHeap heap(gpu, GrVkHeap::kSingleAlloc_Strategy, 64 * 1024);
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index 6cfbba6..cf28586 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -11,7 +11,6 @@
 
 #if SK_SUPPORT_GPU && defined(SK_VULKAN)
 
-#include "GrContextPriv.h"
 #include "GrContextFactory.h"
 #include "GrRenderTarget.h"
 #include "GrTest.h"
@@ -31,7 +30,7 @@
 
 void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) {
 
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH,
                                                                            kPixelConfig, false,
@@ -76,7 +75,7 @@
 }
 
 void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) {
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH,
                                                                            kPixelConfig, true,
@@ -113,7 +112,7 @@
 }
 
 void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) {
-    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->contextPriv().getGpu());
+    GrVkGpu* gpu = static_cast<GrVkGpu*>(context->getGpu());
 
     GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH,
                                                                            kPixelConfig, true,
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index a16752f..a41e8f4 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -427,11 +427,10 @@
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    GrGpu* gpu = context->contextPriv().getGpu();
 
     for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
         for (int sampleCnt : {0, 4}) {
-            GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+            GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
                     nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo);
             SkColorType colorType;
             if (kRGBA_8888_GrPixelConfig == kSkia8888_GrPixelConfig) {
@@ -442,14 +441,14 @@
             sk_sp<SkSurface> surface(SkSurface::MakeFromBackendTextureAsRenderTarget(
                     context, backendTex, origin, sampleCnt, colorType, nullptr, nullptr));
             if (!surface) {
-                gpu->deleteTestingOnlyBackendTexture(&backendTex);
+                context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
                 continue;
             }
 
             test_write_pixels(reporter, surface.get());
 
             surface.reset();
-            gpu->deleteTestingOnlyBackendTexture(&backendTex);
+            context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
         }
     }
 }