summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsadrul <sadrul@chromium.org>2015-07-20 15:34:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-20 22:35:29 +0000
commitba162cdaf95c99b67da214be4cc8117db9ad2a5f (patch)
tree814ef1c3c6d82f7193494ffece674371b68e8bfc /ui
parentc2e5ab72a5cc817cdb86189670c9f535ed67bd4e (diff)
downloadchromium_src-ba162cdaf95c99b67da214be4cc8117db9ad2a5f.zip
chromium_src-ba162cdaf95c99b67da214be4cc8117db9ad2a5f.tar.gz
chromium_src-ba162cdaf95c99b67da214be4cc8117db9ad2a5f.tar.bz2
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}
Diffstat (limited to 'ui')
-rw-r--r--ui/app_list/test/DEPS2
-rw-r--r--ui/app_list/test/run_all_unittests.cc4
-rw-r--r--ui/aura/test/run_all_unittests.cc3
-rw-r--r--ui/chromeos/run_all_unittests.cc4
-rw-r--r--ui/chromeos/touch_exploration_controller_unittest.cc4
-rw-r--r--ui/compositor/test/in_process_context_factory.cc4
-rw-r--r--ui/compositor/test/test_suite.cc4
-rw-r--r--ui/gl/BUILD.gn19
-rw-r--r--ui/gl/gl.gyp23
-rw-r--r--ui/gl/gl_implementation.h3
-rw-r--r--ui/gl/gl_surface.cc64
-rw-r--r--ui/gl/gl_surface.h7
-rw-r--r--ui/gl/gl_tests.gyp1
-rw-r--r--ui/gl/gpu_timing_unittest.cc6
-rw-r--r--ui/gl/test/gl_surface_test_support.cc84
-rw-r--r--ui/gl/test/gl_surface_test_support.h21
-rw-r--r--ui/keyboard/DEPS2
-rw-r--r--ui/keyboard/test/run_all_unittests.cc4
-rw-r--r--ui/message_center/test/DEPS2
-rw-r--r--ui/message_center/test/run_all_unittests.cc4
-rw-r--r--ui/views/DEPS2
-rw-r--r--ui/views/corewm/desktop_capture_controller_unittest.cc4
-rw-r--r--ui/views/run_all_unittests.cc4
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc4
-rw-r--r--ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc4
-rw-r--r--ui/views/widget/widget_interactive_uitest.cc6
-rw-r--r--ui/wm/test/run_all_unittests.cc4
27 files changed, 187 insertions, 106 deletions
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 07d09cb..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 @@ class AppListTestSuite : public base::TestSuite {
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 @@ class UIChromeOSTestSuite : public base::TestSuite {
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..1f584ba 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 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
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 @@ InProcessContextFactory::InProcessContextFactory(
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 @@ CompositorTestSuite::~CompositorTestSuite() {}
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 f5f4134..8d20112 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -280,6 +280,24 @@ source_set("gl_unittest_utils") {
]
}
+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 @@ test("gl_unittests") {
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 c0ac42e..d76f438 100644
--- a/ui/gl/gl_implementation.h
+++ b/ui/gl/gl_implementation.h
@@ -36,7 +36,8 @@ struct GL_EXPORT GLWindowSystemBindingInfo {
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 8a60ca5..a4a6035 100644
--- a/ui/gl/gl_surface.cc
+++ b/ui/gl/gl_surface.cc
@@ -97,70 +97,6 @@ bool GLSurface::InitializeOneOffImplementation(GLImplementation impl,
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 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
// 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 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
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 37dec4f..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 @@ class GPUTimingTest : public testing::Test {
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 @@ class GPUTimingTest : public testing::Test {
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..fde1a1b
--- /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 @@ include_rules = [
"+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 @@ class KeyboardTestSuite : public base::TestSuite {
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 @@ class MessageCenterTestSuite : public base::TestSuite {
#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 @@ include_rules = [
"+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 @@ class DesktopCaptureControllerTest : public ViewsTestBase {
~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 @@ class ViewTestSuite : public base::TestSuite {
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 @@ class DesktopWindowTreeHostX11Test : public ViewsTestBase {
~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 05bd690..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 @@ class X11TopmostWindowFinderTest : public ViewsTestBase {
}
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 @@ class WidgetTestInteractive : public WidgetTest {
~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 @@ class WidgetCaptureTest : public ViewsTestBase {
~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 @@ class WMTestSuite : public base::TestSuite {
protected:
void Initialize() override {
base::TestSuite::Initialize();
- gfx::GLSurface::InitializeOneOffForTests();
+ gfx::GLSurfaceTestSupport::InitializeOneOff();
ui::RegisterPathProvider();
base::FilePath ui_test_pak_path;