[go: nahoru, domu]

gl/test: Move some initialization code used in tests to a separate component.

Moving test-code to a separete component, so that adding more test-only
dependencies does not affect non-test code.

BUG=none
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
TBR=jam@ for non-ui/gl/ changes, since trivial #include/gyp-gn updates

Review URL: https://codereview.chromium.org/1238443004

Cr-Commit-Position: refs/heads/master@{#339539}
diff --git a/android_webview/android_webview_tests.gypi b/android_webview/android_webview_tests.gypi
index 0d7c28c..9fe47b1 100644
--- a/android_webview/android_webview_tests.gypi
+++ b/android_webview/android_webview_tests.gypi
@@ -120,6 +120,7 @@
         '../testing/gtest.gyp:gtest',
         '../ui/base/ui_base.gyp:ui_base_jni_headers',
         '../ui/gl/gl.gyp:gl',
+        '../ui/gl/gl.gyp:gl_test_support',
         'android_webview_common',
         'android_webview_unittests_jni',
       ],
diff --git a/android_webview/lib/main/webview_tests.cc b/android_webview/lib/main/webview_tests.cc
index ec849c8..38624f8 100644
--- a/android_webview/lib/main/webview_tests.cc
+++ b/android_webview/lib/main/webview_tests.cc
@@ -8,11 +8,12 @@
 #include "base/test/test_suite.h"
 #include "content/public/common/content_switches.h"
 #include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 int main(int argc, char** argv) {
   android_webview::RegisterJni(base::android::AttachCurrentThread());
   base::CommandLine::ForCurrentProcess()->AppendSwitch(
       switches::kSingleProcess);
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
   return base::TestSuite(argc, argv).Run();
 }
diff --git a/ash/accelerators/accelerator_interactive_uitest_chromeos.cc b/ash/accelerators/accelerator_interactive_uitest_chromeos.cc
index 74cfe1c4..a7762295 100644
--- a/ash/accelerators/accelerator_interactive_uitest_chromeos.cc
+++ b/ash/accelerators/accelerator_interactive_uitest_chromeos.cc
@@ -20,7 +20,7 @@
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/test/ui_controls.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace ash {
 namespace test {
@@ -58,7 +58,7 @@
   AcceleratorInteractiveUITest() : is_in_overview_mode_(false) {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 
     ui::RegisterPathProvider();
     ui::ResourceBundle::InitSharedInstanceWithLocale(
diff --git a/ash/drag_drop/drag_drop_interactive_uitest.cc b/ash/drag_drop/drag_drop_interactive_uitest.cc
index 739847b..b8968dcd 100644
--- a/ash/drag_drop/drag_drop_interactive_uitest.cc
+++ b/ash/drag_drop/drag_drop_interactive_uitest.cc
@@ -15,7 +15,7 @@
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/test/ui_controls.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
 
@@ -123,7 +123,7 @@
   ~DragDropTest() override {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 
     ui::RegisterPathProvider();
     ui::ResourceBundle::InitSharedInstanceWithLocale(
diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc
index d368a21..73de7b3 100644
--- a/ash/test/test_suite.cc
+++ b/ash/test/test_suite.cc
@@ -12,7 +12,7 @@
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
 #include "ui/gfx/gfx_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 #if defined(OS_WIN)
 #include "base/win/windows_version.h"
@@ -33,7 +33,7 @@
 
 void AuraShellTestSuite::Initialize() {
   base::TestSuite::Initialize();
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
 
 #if defined(OS_WIN)
   base::win::Version version = base::win::GetVersion();
diff --git a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc
index 50f160e..a7d0536 100644
--- a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc
+++ b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc
@@ -15,7 +15,7 @@
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/test/ui_controls.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 #if defined(USE_X11)
 #include <X11/Xlib.h>
@@ -31,7 +31,7 @@
   ~AshNativeCursorManagerTest() override {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 
     ui::RegisterPathProvider();
     ui::ResourceBundle::InitSharedInstanceWithLocale(
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 4507545..52f1147 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -688,6 +688,7 @@
     "//ui/gfx/geometry",
     "//ui/gfx:test_support",
     "//ui/gl",
+    "//ui/gl:test_support",
   ]
 
   if (!is_android) {  # TODO(GYP) Enable on Android when osmesa links.
@@ -852,6 +853,7 @@
     "//ui/gfx/geometry",
     "//ui/gfx:test_support",
     "//ui/gl",
+    "//ui/gl:test_support",
   ]
 }
 
@@ -892,6 +894,7 @@
     "//ui/gfx",
     "//ui/gfx/geometry",
     "//ui/gl",
+    "//ui/gl:test_support",
   ]
 
   if (is_android) {
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 8016d00..b44d9d5 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -414,6 +414,7 @@
         '../ui/gfx/gfx.gyp:gfx_geometry',
         '../ui/gfx/gfx.gyp:gfx_test_support',
         '../ui/gl/gl.gyp:gl',
+        '../ui/gl/gl.gyp:gl_test_support',
       ],
       'sources': [
         '<@(cc_tests_support_files)',
diff --git a/cc/test/cc_test_suite.cc b/cc/test/cc_test_suite.cc
index f48f10a..788c383 100644
--- a/cc/test/cc_test_suite.cc
+++ b/cc/test/cc_test_suite.cc
@@ -7,7 +7,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread_id_name_manager.h"
 #include "cc/test/paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace cc {
 
@@ -18,7 +18,7 @@
 
 void CCTestSuite::Initialize() {
   base::TestSuite::Initialize();
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
   CCPaths::RegisterPathProvider();
 
   message_loop_.reset(new base::MessageLoop);
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index a3d4dc6..39ed825 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -2237,6 +2237,7 @@
             '../third_party/webrtc/modules/modules.gyp:desktop_capture',
             '../tools/json_schema_compiler/test/json_schema_compiler_tests.gyp:json_schema_compiler_tests',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
             '../v8/tools/gyp/v8.gyp:v8',
           ],
           # TODO(scr): Use this in browser_tests too.
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc
index a1dd475..08eb2b7 100644
--- a/chrome/test/base/chrome_unit_test_suite.cc
+++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -29,7 +29,7 @@
 
 #if !defined(OS_IOS)
 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #endif
 
 #if defined(OS_POSIX)
@@ -149,7 +149,7 @@
   content::WebUIControllerFactory::RegisterFactory(
       ChromeWebUIControllerFactory::GetInstance());
 
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
 
   update_client::UpdateQueryParams::SetDelegate(
       ChromeUpdateQueryParamsDelegate::GetInstance());
diff --git a/components/test/DEPS b/components/test/DEPS
index ad24217..265c5f79 100644
--- a/components/test/DEPS
+++ b/components/test/DEPS
@@ -19,5 +19,5 @@
   "+ui/base/resource/resource_bundle.h",
   "+ui/base/ui_base_paths.h",
   "+ui/gfx/android/gfx_jni_registrar.h",
-  "+ui/gl/gl_surface.h",  # To initialize GL for tests.
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
 ]
diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc
index a24c284..fd327a18 100644
--- a/components/test/run_all_unittests.cc
+++ b/components/test/run_all_unittests.cc
@@ -17,7 +17,7 @@
 #include "url/url_util.h"
 
 #if !defined(OS_IOS)
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #endif
 
 #if defined(OS_ANDROID)
@@ -44,7 +44,7 @@
     base::StatisticsRecorder::Initialize();
 
 #if !defined(OS_IOS)
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 #endif
 #if defined(OS_ANDROID)
     // Register JNI bindings for android.
diff --git a/components/view_manager/BUILD.gn b/components/view_manager/BUILD.gn
index f077988..c7475d9 100644
--- a/components/view_manager/BUILD.gn
+++ b/components/view_manager/BUILD.gn
@@ -128,6 +128,7 @@
     "//ui/events/platform",
     "//ui/gfx",
     "//ui/gfx/geometry",
+    "//ui/gl:test_support",
     "//ui/mojo/events:interfaces",
     "//ui/mojo/geometry:interfaces",
     "//ui/platform_window:platform_impls",
diff --git a/components/view_manager/view_manager_app.cc b/components/view_manager/view_manager_app.cc
index 1f9f283c6..293efd18 100644
--- a/components/view_manager/view_manager_app.cc
+++ b/components/view_manager/view_manager_app.cc
@@ -19,6 +19,7 @@
 #include "ui/events/event_switches.h"
 #include "ui/events/platform/platform_event_source.h"
 #include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 using mojo::ApplicationConnection;
 using mojo::ApplicationImpl;
@@ -44,7 +45,7 @@
   if (!is_headless_) {
     event_source_ = ui::PlatformEventSource::CreateDefault();
     if (command_line->HasSwitch(mojo::kUseTestConfig))
-      gfx::GLSurface::InitializeOneOffForTests();
+      gfx::GLSurfaceTestSupport::InitializeOneOff();
     else
       gfx::GLSurface::InitializeOneOff();
   }
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 5f9eb4c4..ffcea14 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1058,6 +1058,7 @@
             '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
             '../third_party/libjingle/libjingle.gyp:libjingle',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
           ],
         }],
         ['OS != "win"', {
@@ -1421,6 +1422,7 @@
             '../ui/gfx/gfx.gyp:gfx',
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
             '../ui/resources/ui_resources.gyp:ui_resources',
             '../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs',
             '../ui/snapshot/snapshot.gyp:snapshot',
@@ -1554,6 +1556,7 @@
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gfx/gfx.gyp:gfx_test_support',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
             '../v8/tools/gyp/v8.gyp:v8',
           ],
           'include_dirs': [
@@ -1596,6 +1599,7 @@
             '../ui/gfx/gfx.gyp:gfx',
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
           ],
           'include_dirs': [
             '..',
@@ -1627,6 +1631,7 @@
               '../ui/gfx/gfx.gyp:gfx_test_support',
               '../ui/gfx/gfx.gyp:gfx_geometry',
               '../ui/gl/gl.gyp:gl',
+              '../ui/gl/gl.gyp:gl_test_support',
               'content.gyp:content',
             ],
             'include_dirs': [
@@ -1740,6 +1745,7 @@
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gfx/gfx.gyp:gfx_test_support',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
             'content.gyp:content',
           ],
           'sources': [
@@ -1775,6 +1781,7 @@
             '../ui/gfx/gfx.gyp:gfx',
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gl/gl.gyp:gl',
+            '../ui/gl/gl.gyp:gl_test_support',
             'content.gyp:content',
           ],
           'sources': [
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 4a10b6d..0dbffbdb 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -44,6 +44,7 @@
     "//ui/events:gesture_detection",
     "//ui/gfx:test_support",
     "//ui/gl",
+    "//ui/gl:test_support",
     "//ui/resources",
     "//url",
   ]
@@ -317,6 +318,7 @@
       "//ui/gfx",
       "//ui/gfx/geometry",
       "//ui/gl",
+      "//ui/gl:test_support",
       "//ui/resources",
       "//ui/shell_dialogs",
       "//ui/snapshot",
@@ -487,6 +489,7 @@
       "//third_party/leveldatabase",
       "//third_party/libjingle",
       "//ui/gl",
+      "//ui/gl:test_support",
     ]
   }
 
@@ -669,6 +672,7 @@
       "//ui/gfx:test_support",
       "//ui/gfx/geometry",
       "//ui/gl",
+      "//ui/gl:test_support",
       "//v8",
     ]
 
@@ -699,6 +703,7 @@
       "//ui/gfx",
       "//ui/gfx/geometry",
       "//ui/gl",
+      "//ui/gl:test_support",
     ]
   }
 }
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 116bd0ce..41b4bdb 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -28,7 +28,7 @@
 #include "base/base_switches.h"
 #include "base/command_line.h"
 #include "media/base/media.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #endif
 
 #if defined(OS_ANDROID)
@@ -91,7 +91,7 @@
   // to initialize GL, so don't do it here.
   if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kTestChildProcess)) {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess());
   }
 #endif
diff --git a/extensions/test/extensions_unittests_main.cc b/extensions/test/extensions_unittests_main.cc
index 6fde7a35..aa0108f9 100644
--- a/extensions/test/extensions_unittests_main.cc
+++ b/extensions/test/extensions_unittests_main.cc
@@ -15,7 +15,7 @@
 #include "extensions/test/test_extensions_client.h"
 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
 #include "ui/base/resource/resource_bundle.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace {
 
@@ -65,7 +65,7 @@
 
 void ExtensionsTestSuite::Initialize() {
   content::ContentTestSuiteBase::Initialize();
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
 
   // Register the chrome-extension:// scheme via this circuitous path. Note
   // that this does not persistently set up a ContentClient; individual tests
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index e940614..6e8d96b 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -247,6 +247,7 @@
     "//ui/gfx:test_support",
     "//ui/gl",
     "//ui/gl:gl_unittest_utils",
+    "//ui/gl:test_support",
     "//gpu/command_buffer/common:gles2_utils",
     "//gpu/command_buffer/client:gles2_c_lib",
     "//gpu/command_buffer/client:gles2_implementation",
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 66da950..d78ec98 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -23,7 +23,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_mock.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 using ::gfx::MockGLInterface;
 using ::testing::_;
@@ -177,7 +177,7 @@
   Framebuffer::ClearFramebufferCompleteComboMap();
 
   gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
-  gfx::GLSurface::InitializeOneOffWithMockBindingsForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOffWithMockBindings();
 
   gl_.reset(new StrictMock<MockGLInterface>());
   ::gfx::MockGLInterface::SetGLInterface(gl_.get());
@@ -210,7 +210,7 @@
   context_->SetGLVersionString(normalized_init.gl_version.c_str());
 
   context_->GLContextStubWithExtensions::MakeCurrent(surface_.get());
-  gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_.get());
+  gfx::GLSurfaceTestSupport::InitializeDynamicMockBindings(context_.get());
 
   TestHelper::SetupContextGroupInitExpectations(
       gl_.get(),
diff --git a/gpu/command_buffer/service/gpu_service_test.cc b/gpu/command_buffer/service/gpu_service_test.cc
index d0b9117..5be0b9b 100644
--- a/gpu/command_buffer/service/gpu_service_test.cc
+++ b/gpu/command_buffer/service/gpu_service_test.cc
@@ -9,7 +9,7 @@
 #include "ui/gl/gl_context_stub_with_extensions.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_mock.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace gpu {
 namespace gles2 {
@@ -26,14 +26,14 @@
   testing::Test::SetUp();
 
   gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
-  gfx::GLSurface::InitializeOneOffWithMockBindingsForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOffWithMockBindings();
   gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
   ::gfx::MockGLInterface::SetGLInterface(gl_.get());
 
   context_ = new gfx::GLContextStubWithExtensions;
   context_->AddExtensionsString(gl_extensions);
   context_->SetGLVersionString(gl_version);
-  gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_.get());
+  gfx::GLSurfaceTestSupport::InitializeDynamicMockBindings(context_.get());
   ran_setup_ = true;
 }
 
diff --git a/gpu/config/gpu_info_collector_unittest.cc b/gpu/config/gpu_info_collector_unittest.cc
index f89eb4d..25c22ea 100644
--- a/gpu/config/gpu_info_collector_unittest.cc
+++ b/gpu/config/gpu_info_collector_unittest.cc
@@ -9,7 +9,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_mock.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 using ::gfx::MockGLInterface;
 using ::testing::Return;
@@ -26,7 +26,7 @@
   void SetUp() override {
     testing::Test::SetUp();
     gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
-    gfx::GLSurface::InitializeOneOffWithMockBindingsForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOffWithMockBindings();
     gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
     ::gfx::MockGLInterface::SetGLInterface(gl_.get());
 #if defined(OS_WIN)
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 5004bc7..bbfc719 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -155,10 +155,11 @@
         '../testing/gmock.gyp:gmock',
         '../testing/gtest.gyp:gtest',
         '<(angle_path)/src/angle.gyp:translator',
-        '../ui/gl/gl.gyp:gl',
         '../ui/gfx/gfx.gyp:gfx',
         '../ui/gfx/gfx.gyp:gfx_geometry',
         '../ui/gfx/gfx.gyp:gfx_test_support',
+        '../ui/gl/gl.gyp:gl',
+        '../ui/gl/gl.gyp:gl_test_support',
         'command_buffer/command_buffer.gyp:gles2_utils',
         'command_buffer_client',
         'command_buffer_common',
diff --git a/ui/app_list/test/DEPS b/ui/app_list/test/DEPS
index 8d1340d..c451d9c 100644
--- a/ui/app_list/test/DEPS
+++ b/ui/app_list/test/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+ui/gl/gl_surface.h",  # To initialize GL for tests.
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
 ]
diff --git a/ui/app_list/test/run_all_unittests.cc b/ui/app_list/test/run_all_unittests.cc
index 07d09cb5..9b4d3771 100644
--- a/ui/app_list/test/run_all_unittests.cc
+++ b/ui/app_list/test/run_all_unittests.cc
@@ -18,7 +18,7 @@
 #endif
 
 #if defined(TOOLKIT_VIEWS)
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #endif
 
 namespace {
@@ -33,7 +33,7 @@
     mock_cr_app::RegisterMockCrApp();
 #endif
 #if defined(TOOLKIT_VIEWS)
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 #endif
     base::TestSuite::Initialize();
     ui::RegisterPathProvider();
diff --git a/ui/aura/test/run_all_unittests.cc b/ui/aura/test/run_all_unittests.cc
index 48ea16e..83c02d2 100644
--- a/ui/aura/test/run_all_unittests.cc
+++ b/ui/aura/test/run_all_unittests.cc
@@ -6,10 +6,11 @@
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
 #include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 int main(int argc, char** argv) {
   base::TestSuite test_suite(argc, argv);
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
 
   return base::LaunchUnitTests(
       argc,
diff --git a/ui/chromeos/run_all_unittests.cc b/ui/chromeos/run_all_unittests.cc
index a677d66..91cd23d 100644
--- a/ui/chromeos/run_all_unittests.cc
+++ b/ui/chromeos/run_all_unittests.cc
@@ -11,7 +11,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace {
 
@@ -23,7 +23,7 @@
  protected:
   void Initialize() override {
     base::TestSuite::Initialize();
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
 
     base::FilePath ui_test_pak_path;
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index 1b7faf5..1f584ba3 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -17,7 +17,7 @@
 #include "ui/events/test/events_test_utils.h"
 #include "ui/gfx/geometry/point.h"
 #include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace ui {
 
@@ -197,7 +197,7 @@
 
   void SetUp() override {
     if (gfx::GetGLImplementation() == gfx::kGLImplementationNone)
-      gfx::GLSurface::InitializeOneOffForTests();
+      gfx::GLSurfaceTestSupport::InitializeOneOff();
     aura::test::AuraTestBase::SetUp();
     cursor_client_.reset(new aura::test::TestCursorClient(root_window()));
     root_window()->AddPreTargetHandler(&event_capturer_);
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index 4597a86..d606f5b 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -23,7 +23,7 @@
 #include "ui/compositor/reflector.h"
 #include "ui/compositor/test/in_process_context_provider.h"
 #include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace ui {
 namespace {
@@ -83,7 +83,7 @@
       surface_manager_(surface_manager) {
   DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone)
       << "If running tests, ensure that main() is calling "
-      << "gfx::GLSurface::InitializeOneOffForTests()";
+      << "gfx::GLSurfaceTestSupport::InitializeOneOff()";
 
   Layer::InitializeUILayerSettings();
 }
diff --git a/ui/compositor/test/test_suite.cc b/ui/compositor/test/test_suite.cc
index d98f52d..0e7e165 100644
--- a/ui/compositor/test/test_suite.cc
+++ b/ui/compositor/test/test_suite.cc
@@ -9,7 +9,7 @@
 #include "ui/compositor/compositor.h"
 #include "ui/compositor/compositor_switches.h"
 #include "ui/gfx/gfx_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 #if defined(OS_WIN)
 #include "ui/gfx/win/dpi.h"
@@ -25,7 +25,7 @@
 
 void CompositorTestSuite::Initialize() {
   base::TestSuite::Initialize();
-  gfx::GLSurface::InitializeOneOffForTests();
+  gfx::GLSurfaceTestSupport::InitializeOneOff();
 
   gfx::RegisterPathProvider();
 
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
index f5f41342..8d20112 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -280,6 +280,24 @@
   ]
 }
 
+source_set("test_support") {
+  sources = [
+    "test/gl_surface_test_support.cc",
+    "test/gl_surface_test_support.h",
+  ]
+
+  configs += [ "//third_party/khronos:khronos_headers" ]
+
+  deps = [
+    ":gl",
+  ]
+
+  if (use_x11) {
+    configs += [ "//build/config/linux:x11" ]
+    deps += [ "//ui/gfx/x" ]
+  }
+}
+
 test("gl_unittests") {
   sources = [
     "gl_api_unittest.cc",
@@ -299,6 +317,7 @@
   deps = [
     ":gl",
     ":gl_unittest_utils",
+    ":test_support",
     "//base",
     "//base/test:test_support",
     "//testing/gmock",
diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp
index 6d4d1f9..3edd4d4 100644
--- a/ui/gl/gl.gyp
+++ b/ui/gl/gl.gyp
@@ -291,6 +291,29 @@
         'gpu_timing_fake.h',
       ],
     },
+    {
+      'target_name': 'gl_test_support',
+      'type': 'static_library',
+      'dependencies': [
+        '../../third_party/khronos/khronos.gyp:khronos_headers',
+        'gl',
+      ],
+      'include_dirs': [
+        '../..',
+      ],
+      'sources': [
+        'test/gl_surface_test_support.cc',
+        'test/gl_surface_test_support.h',
+      ],
+      'conditions': [
+        ['use_x11==1', {
+          'dependencies': [
+            '../../build/linux/system.gyp:x11',
+            '../gfx/x/gfx_x11.gyp:gfx_x11',
+          ],
+        }],
+      ],
+    },
   ],
   'conditions': [
     ['OS=="android"' , {
diff --git a/ui/gl/gl_implementation.h b/ui/gl/gl_implementation.h
index c0ac42ea..d76f438 100644
--- a/ui/gl/gl_implementation.h
+++ b/ui/gl/gl_implementation.h
@@ -36,7 +36,8 @@
   bool direct_rendering;
 };
 
-void GetAllowedGLImplementations(std::vector<GLImplementation>* impls);
+void GL_EXPORT
+GetAllowedGLImplementations(std::vector<GLImplementation>* impls);
 
 #if defined(OS_WIN)
 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name);
diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc
index 8a60ca54..a4a6035 100644
--- a/ui/gl/gl_surface.cc
+++ b/ui/gl/gl_surface.cc
@@ -97,70 +97,6 @@
   return initialized;
 }
 
-// static
-void GLSurface::InitializeOneOffForTests() {
-  DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
-
-#if defined(USE_X11)
-  XInitThreads();
-#endif
-
-  bool use_osmesa = true;
-
-  // We usually use OSMesa as this works on all bots. The command line can
-  // override this behaviour to use hardware GL.
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kUseGpuInTests))
-    use_osmesa = false;
-
-#if defined(OS_ANDROID)
-  // On Android we always use hardware GL.
-  use_osmesa = false;
-#endif
-
-  std::vector<GLImplementation> allowed_impls;
-  GetAllowedGLImplementations(&allowed_impls);
-  DCHECK(!allowed_impls.empty());
-
-  GLImplementation impl = allowed_impls[0];
-  if (use_osmesa)
-    impl = kGLImplementationOSMesaGL;
-
-  DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
-      << "kUseGL has not effect in tests";
-
-  bool fallback_to_osmesa = false;
-  bool gpu_service_logging = false;
-  bool disable_gl_drawing = true;
-
-  CHECK(InitializeOneOffImplementation(
-      impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing));
-}
-
-// static
-void GLSurface::InitializeOneOffWithMockBindingsForTests() {
-  DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
-      << "kUseGL has not effect in tests";
-
-  // This method may be called multiple times in the same process to set up
-  // mock bindings in different ways.
-  ClearGLBindings();
-
-  bool fallback_to_osmesa = false;
-  bool gpu_service_logging = false;
-  bool disable_gl_drawing = false;
-
-  CHECK(InitializeOneOffImplementation(kGLImplementationMockGL,
-                                       fallback_to_osmesa,
-                                       gpu_service_logging,
-                                       disable_gl_drawing));
-}
-
-// static
-void GLSurface::InitializeDynamicMockBindingsForTests(GLContext* context) {
-  CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context));
-}
-
 GLSurface::GLSurface() {}
 
 bool GLSurface::Initialize() {
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h
index 9fee0a3..2f9ad84 100644
--- a/ui/gl/gl_surface.h
+++ b/ui/gl/gl_surface.h
@@ -99,12 +99,6 @@
   // Initialize GL bindings.
   static bool InitializeOneOff();
 
-  // Unit tests should call these instead of InitializeOneOff() to set up
-  // GL bindings appropriate for tests.
-  static void InitializeOneOffForTests();
-  static void InitializeOneOffWithMockBindingsForTests();
-  static void InitializeDynamicMockBindingsForTests(GLContext* context);
-
   // Called after a context is made current with this surface. Returns false
   // on error.
   virtual bool OnMakeCurrent(GLContext* context);
@@ -189,6 +183,7 @@
  private:
   friend class base::RefCounted<GLSurface>;
   friend class GLContext;
+  friend class GLSurfaceTestSupport;
 
   DISALLOW_COPY_AND_ASSIGN(GLSurface);
 };
diff --git a/ui/gl/gl_tests.gyp b/ui/gl/gl_tests.gyp
index 37dec4fb..4f7e2dd 100644
--- a/ui/gl/gl_tests.gyp
+++ b/ui/gl/gl_tests.gyp
@@ -24,6 +24,7 @@
         '<(DEPTH)/testing/gmock.gyp:gmock',
         '<(DEPTH)/testing/gtest.gyp:gtest',
         '<(DEPTH)/ui/gl/gl.gyp:gl',
+        '<(DEPTH)/ui/gl/gl.gyp:gl_test_support',
         '<(DEPTH)/ui/gl/gl.gyp:gl_unittest_utils',
       ],
       'conditions': [
diff --git a/ui/gl/gpu_timing_unittest.cc b/ui/gl/gpu_timing_unittest.cc
index 946d231..2b95574 100644
--- a/ui/gl/gpu_timing_unittest.cc
+++ b/ui/gl/gpu_timing_unittest.cc
@@ -8,10 +8,10 @@
 #include "ui/gl/gl_context_stub_with_extensions.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_mock.h"
-#include "ui/gl/gl_surface.h"
 #include "ui/gl/gpu_preference.h"
 #include "ui/gl/gpu_timing.h"
 #include "ui/gl/gpu_timing_fake.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace gfx {
 
@@ -38,7 +38,7 @@
   void SetupGLContext(const char* gl_version, const char* gl_extensions) {
     ASSERT_FALSE(setup_) << "Cannot setup GL context twice.";
     SetGLGetProcAddressProc(MockGLInterface::GetGLProcAddress);
-    GLSurface::InitializeOneOffWithMockBindingsForTests();
+    GLSurfaceTestSupport::InitializeOneOffWithMockBindings();
     gl_.reset(new ::testing::StrictMock<MockGLInterface>());
     MockGLInterface::SetGLInterface(gl_.get());
 
@@ -46,7 +46,7 @@
     context_->AddExtensionsString(gl_extensions);
     context_->SetGLVersionString(gl_version);
     gpu_timing_fake_queries_.Reset();
-    GLSurface::InitializeDynamicMockBindingsForTests(context_.get());
+    GLSurfaceTestSupport::InitializeDynamicMockBindings(context_.get());
 
     setup_ = true;
   }
diff --git a/ui/gl/test/gl_surface_test_support.cc b/ui/gl/test/gl_surface_test_support.cc
new file mode 100644
index 0000000..fde1a1b0
--- /dev/null
+++ b/ui/gl/test/gl_surface_test_support.cc
@@ -0,0 +1,84 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gl/test/gl_surface_test_support.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "ui/gl/gl_context.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface.h"
+#include "ui/gl/gl_switches.h"
+
+#if defined(USE_X11)
+#include <X11/Xlib.h>
+#endif
+
+namespace gfx {
+
+// static
+void GLSurfaceTestSupport::InitializeOneOff() {
+  DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
+
+#if defined(USE_X11)
+  XInitThreads();
+#endif
+
+  bool use_osmesa = true;
+
+  // We usually use OSMesa as this works on all bots. The command line can
+  // override this behaviour to use hardware GL.
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kUseGpuInTests)) {
+    use_osmesa = false;
+  }
+
+#if defined(OS_ANDROID)
+  // On Android we always use hardware GL.
+  use_osmesa = false;
+#endif
+
+  std::vector<GLImplementation> allowed_impls;
+  GetAllowedGLImplementations(&allowed_impls);
+  DCHECK(!allowed_impls.empty());
+
+  GLImplementation impl = allowed_impls[0];
+  if (use_osmesa)
+    impl = kGLImplementationOSMesaGL;
+
+  DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
+      << "kUseGL has not effect in tests";
+
+  bool fallback_to_osmesa = false;
+  bool gpu_service_logging = false;
+  bool disable_gl_drawing = true;
+
+  CHECK(GLSurface::InitializeOneOffImplementation(
+      impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing));
+}
+
+// static
+void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() {
+  DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
+      << "kUseGL has not effect in tests";
+
+  // This method may be called multiple times in the same process to set up
+  // mock bindings in different ways.
+  ClearGLBindings();
+
+  bool fallback_to_osmesa = false;
+  bool gpu_service_logging = false;
+  bool disable_gl_drawing = false;
+
+  CHECK(GLSurface::InitializeOneOffImplementation(
+      kGLImplementationMockGL, fallback_to_osmesa, gpu_service_logging,
+      disable_gl_drawing));
+}
+
+// static
+void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) {
+  CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context));
+}
+
+}  // namespace gfx
diff --git a/ui/gl/test/gl_surface_test_support.h b/ui/gl/test/gl_surface_test_support.h
new file mode 100644
index 0000000..6e53c69
--- /dev/null
+++ b/ui/gl/test/gl_surface_test_support.h
@@ -0,0 +1,21 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_TEST_GL_SURFACE_TEST_SUPPORT_H_
+#define UI_GL_TEST_GL_SURFACE_TEST_SUPPORT_H_
+
+namespace gfx {
+
+class GLContext;
+
+class GLSurfaceTestSupport {
+ public:
+  static void InitializeOneOff();
+  static void InitializeOneOffWithMockBindings();
+  static void InitializeDynamicMockBindings(GLContext* context);
+};
+
+}  // namespace gfx
+
+#endif  // UI_GL_TEST_GL_SURFACE_TEST_SUPPORT_H_
diff --git a/ui/keyboard/DEPS b/ui/keyboard/DEPS
index 4c1c204..3f9f8cb 100644
--- a/ui/keyboard/DEPS
+++ b/ui/keyboard/DEPS
@@ -7,7 +7,7 @@
   "+ui/compositor",
   "+ui/events",
   "+ui/gfx",
-  "+ui/gl/gl_surface.h",  # To initialize GL for tests.
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
   "+ui/test",
   "+ui/ozone/public",
   "+ui/wm",
diff --git a/ui/keyboard/test/run_all_unittests.cc b/ui/keyboard/test/run_all_unittests.cc
index c81e199..5f8eb9a 100644
--- a/ui/keyboard/test/run_all_unittests.cc
+++ b/ui/keyboard/test/run_all_unittests.cc
@@ -11,7 +11,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 namespace {
 
@@ -22,7 +22,7 @@
  protected:
   void Initialize() override {
     base::TestSuite::Initialize();
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
 
     base::FilePath ui_test_pak_path;
diff --git a/ui/message_center/test/DEPS b/ui/message_center/test/DEPS
index 8d1340d..c451d9c 100644
--- a/ui/message_center/test/DEPS
+++ b/ui/message_center/test/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+ui/gl/gl_surface.h",  # To initialize GL for tests.
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
 ]
diff --git a/ui/message_center/test/run_all_unittests.cc b/ui/message_center/test/run_all_unittests.cc
index 019df50..cdf8b4f 100644
--- a/ui/message_center/test/run_all_unittests.cc
+++ b/ui/message_center/test/run_all_unittests.cc
@@ -16,7 +16,7 @@
 #if defined(OS_MACOSX)
 #include "base/test/mock_chrome_application_mac.h"
 #else
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #endif
 
 namespace {
@@ -30,7 +30,7 @@
 #if defined(OS_MACOSX)
     mock_cr_app::RegisterMockCrApp();
 #else
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
 #endif
     base::TestSuite::Initialize();
     ui::RegisterPathProvider();
diff --git a/ui/views/DEPS b/ui/views/DEPS
index 3aa9664..d5541ee 100644
--- a/ui/views/DEPS
+++ b/ui/views/DEPS
@@ -9,7 +9,7 @@
   "+ui/display",
   "+ui/events",
   "+ui/gfx",
-  "+ui/gl/gl_surface.h",  # To initialize GL for tests.
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
   "+ui/native_theme",
   "+ui/ozone/public",
   "+ui/resources/grit/ui_resources.h",
diff --git a/ui/views/corewm/desktop_capture_controller_unittest.cc b/ui/views/corewm/desktop_capture_controller_unittest.cc
index e41cec3..0380f10 100644
--- a/ui/views/corewm/desktop_capture_controller_unittest.cc
+++ b/ui/views/corewm/desktop_capture_controller_unittest.cc
@@ -14,7 +14,7 @@
 #include "ui/base/ui_base_paths.h"
 #include "ui/events/event.h"
 #include "ui/events/test/event_generator.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #include "ui/views/test/views_test_base.h"
 #include "ui/views/view.h"
 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -33,7 +33,7 @@
   ~DesktopCaptureControllerTest() override {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
     base::FilePath ui_test_pak_path;
     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc
index 965e7c29..8fb2bb1 100644
--- a/ui/views/run_all_unittests.cc
+++ b/ui/views/run_all_unittests.cc
@@ -11,7 +11,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 class ViewTestSuite : public base::TestSuite {
  public:
@@ -20,7 +20,7 @@
  protected:
   void Initialize() override {
     base::TestSuite::Initialize();
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
 
     base::FilePath ui_test_pak_path;
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc
index 3d06653..0a947b8 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc
@@ -23,7 +23,7 @@
 #include "ui/events/platform/x11/x11_event_source.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/x/x11_atom_cache.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #include "ui/views/controls/textfield/textfield.h"
 #include "ui/views/test/views_test_base.h"
 #include "ui/views/test/x11_property_change_waiter.h"
@@ -126,7 +126,7 @@
   ~DesktopWindowTreeHostX11Test() override {}
 
   static void SetUpTestCase() {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
     base::FilePath ui_test_pak_path;
     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
index 05bd690c6..d745325 100644
--- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
+++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -26,7 +26,7 @@
 #include "ui/gfx/path.h"
 #include "ui/gfx/path_x11.h"
 #include "ui/gfx/x/x11_atom_cache.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #include "ui/views/test/views_test_base.h"
 #include "ui/views/test/x11_property_change_waiter.h"
 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -194,7 +194,7 @@
   }
 
   static void SetUpTestCase() {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
     base::FilePath ui_test_pak_path;
     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
index 4b5a01d..e1e0e49 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -18,7 +18,7 @@
 #include "ui/events/event_utils.h"
 #include "ui/events/test/event_generator.h"
 #include "ui/gfx/native_widget_types.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 #include "ui/views/controls/textfield/textfield.h"
 #include "ui/views/controls/textfield/textfield_test_api.h"
 #include "ui/views/focus/focus_manager.h"
@@ -274,7 +274,7 @@
   ~WidgetTestInteractive() override {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
     base::FilePath ui_test_pak_path;
     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
@@ -1142,7 +1142,7 @@
   ~WidgetCaptureTest() override {}
 
   void SetUp() override {
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
     base::FilePath ui_test_pak_path;
     ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
diff --git a/ui/wm/test/run_all_unittests.cc b/ui/wm/test/run_all_unittests.cc
index ebc0d51..970da37 100644
--- a/ui/wm/test/run_all_unittests.cc
+++ b/ui/wm/test/run_all_unittests.cc
@@ -11,7 +11,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/test/gl_surface_test_support.h"
 
 class WMTestSuite : public base::TestSuite {
  public:
@@ -20,7 +20,7 @@
  protected:
   void Initialize() override {
     base::TestSuite::Initialize();
-    gfx::GLSurface::InitializeOneOffForTests();
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
     ui::RegisterPathProvider();
 
     base::FilePath ui_test_pak_path;