compositor_unittests target is unimplmented on Mac

Adds necessary pieces to get the WebKit compositor working with
compositor_unittests target on Mac.  Required gyp build flags are:

    'use_aura': 1,
    'use_webkit_compositor': 1,
    'use_skia': 1,

BUG=104390, 104555
TEST=compositor_unittests --gtest_filter=LayerWithRealCompositorTest.* passes and shows correct visual results.

Review URL: http://codereview.chromium.org/8486020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110875 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/gl/gl_surface_mac.cc b/ui/gfx/gl/gl_surface_mac.cc
index 0f6cdd4..ebe3cc38 100644
--- a/ui/gfx/gl/gl_surface_mac.cc
+++ b/ui/gfx/gl/gl_surface_mac.cc
@@ -13,6 +13,10 @@
 #include "ui/gfx/gl/gl_surface_osmesa.h"
 #include "ui/gfx/gl/gl_surface_stub.h"
 
+#if defined(USE_AURA)
+#include "ui/gfx/gl/gl_surface_nsview.h"
+#endif
+
 namespace gfx {
 
 bool GLSurface::InitializeOneOffInternal() {
@@ -32,7 +36,27 @@
 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
     bool software,
     gfx::PluginWindowHandle window) {
-  return CreateOffscreenGLSurface(software, gfx::Size(1, 1));
+#if defined(USE_AURA)
+  if (software)
+    return NULL;
+
+  switch (GetGLImplementation()) {
+    case kGLImplementationDesktopGL: {
+      scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window));
+      if (!surface->Initialize())
+        return NULL;
+
+      return surface;
+    }
+    case kGLImplementationMockGL:
+      return new GLSurfaceStub;
+    default:
+      NOTREACHED();
+      return NULL;
+  }
+#else
+  return CreateOffscreenGLSurface(software, gfx::Size(1,1));
+#endif
 }
 
 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(