Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: ui/gfx/test/gfx_test_utils.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ui/gfx/test/gfx_test_utils x4 Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/test/gfx_test_utils.cc
diff --git a/ui/gfx/test/gfx_test_utils.cc b/ui/gfx/test/gfx_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1b80d340f67ae4525047a76d9dee949ba842e85d
--- /dev/null
+++ b/ui/gfx/test/gfx_test_utils.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 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/gfx/test/gfx_test_utils.h"
+
+#include "base/command_line.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/gl/gl_switches.h"
+
+#if defined(VIEWS_COMPOSITOR)
+#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/test_compositor.h"
+#endif
+
+namespace ui {
+namespace gfx_test_utils {
+
+void SetupTestCompositor() {
+#if defined(OS_LINUX)
+ // Test bots don't have DesktopGL/EGL.
+ EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL));
Paweł Hajdan Jr. 2011/10/19 08:49:37 Please convert it so that the function returns boo
danakj 2011/10/19 13:55:48 So if you have GL set to something already the tes
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kUseGL, gfx::kGLImplementationOSMesaName);
+#endif
+
+#if defined(VIEWS_COMPOSITOR)
+ // Use a mock compositor that noops draws.
+ ui::Compositor::set_compositor_factory_for_testing(
+ ui::TestCompositor::Create);
+#endif
+}
+
+} // namespace gfx_test_utils
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698