Use ES3 in iOS test harness

Bug: skia:
Change-Id: I365c82a058c97e8741ee91e999cb6faab5a5ecf5
Reviewed-on: https://skia-review.googlesource.com/c/175422
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 537b5fe..5dd360d 100644
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -68,7 +68,12 @@
     // set up the data
     const int kTextureWidth = 16;
     const int kTextureHeight = 16;
+#ifdef SK_BUILD_FOR_IOS
+    // UNPACK_ROW_LENGTH is broken on iOS so rowBytes needs to match data width
+    const int kBufferWidth = GrBackendApi::kOpenGL == context->contextPriv().getBackend() ? 16 : 20;
+#else
     const int kBufferWidth = 20;
+#endif
     const int kBufferHeight = 16;
     size_t rowBytes = kBufferWidth * sizeof(GrColor);
     SkAutoTMalloc<GrColor> srcBuffer(kBufferWidth*kBufferHeight);
@@ -137,7 +142,12 @@
 
         //////////////////////////
         // transfer partial data
-
+#ifdef SK_BUILD_FOR_IOS
+        // UNPACK_ROW_LENGTH is broken on iOS so we can't do partial transfers
+        if (GrBackendApi::kOpenGL == context->contextPriv().getBackend()) {
+            continue;
+        }
+#endif
         const int kLeft = 2;
         const int kTop = 10;
         const int kWidth = 10;
diff --git a/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm b/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm
index c62a330..2b0ad81 100644
--- a/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm
+++ b/tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm
@@ -42,10 +42,17 @@
 
     if (shareContext) {
         EAGLContext* iosShareContext = shareContext->fEAGLContext;
-        fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
-                                            sharegroup: [iosShareContext sharegroup]];
+        fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3
+                                            sharegroup:[iosShareContext sharegroup]];
+        if (fEAGLContext == nil) {
+            fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
+                                                sharegroup:[iosShareContext sharegroup]];
+        }
     } else {
-        fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+        fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
+        if (fEAGLContext == nil) {
+            fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+        }
     }
     SkScopeExit restorer(context_restorer());
     [EAGLContext setCurrentContext:fEAGLContext];