Add testing only helper to flush and sync gpu.

The use case for this is mostly for Vulkan where we need to make sure the
gpu is done with resources before we delete or use them in some way.
Previously we used readPixels to do this which was just an ugly hack.

Bug: skia:
Change-Id: I7949ebc695032533675133aabca0e32840b417ba
Reviewed-on: https://skia-review.googlesource.com/113122
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 1462648..484b7bf 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -203,14 +203,9 @@
             }
 
             // Must make sure the uses of the backend texture have finished (we possibly have a
-            // queued up copy) before we delete the backend texture. Thus we use readPixels here
-            // just to force the synchronization.
-            sk_sp<GrSurfaceContext> surfContext =
-                    context->contextPriv().makeWrappedSurfaceContext(genProxy);
-
-            SkBitmap bitmap;
-            bitmap.allocPixels(imageInfo);
-            surfContext->readPixels(imageInfo, bitmap.getPixels(), 0, 0, 0, 0);
+            // queued up copy) before we delete the backend texture.
+            context->flush();
+            gpu->testingOnly_flushGpuAndSync();
 
             gpu->deleteTestingOnlyBackendTexture(&backendTex);
         }