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

Side by Side Diff: views/run_all_unittests.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsuite subclasses 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/test_suite.h" 5 #include "base/test/test_suite.h"
6 #include "ui/base/resource/resource_bundle.h" 6 #include "ui/base/resource/resource_bundle.h"
7 #include "ui/base/ui_base_paths.h" 7 #include "ui/base/ui_base_paths.h"
8 #include "views/view.h" 8 #include "views/view.h"
9 9
10 #if defined(OS_LINUX)
11 #include "base/command_line.h"
12 #include "ui/gfx/gl/gl_switches.h"
13 #endif
14
15 #if defined(VIEWS_COMPOSITOR)
16 #include "ui/gfx/compositor/compositor.h"
17 #include "ui/gfx/compositor/test_compositor.h"
18 #endif
19
10 class ViewTestSuite : public base::TestSuite { 20 class ViewTestSuite : public base::TestSuite {
11 public: 21 public:
12 ViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} 22 ViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
13 23
14 protected: 24 protected:
15 virtual void Initialize() { 25 virtual void Initialize() {
16 base::TestSuite::Initialize(); 26 base::TestSuite::Initialize();
17 27
18 ui::RegisterPathProvider(); 28 ui::RegisterPathProvider();
19 ui::ResourceBundle::InitSharedInstance("en-US"); 29 ui::ResourceBundle::InitSharedInstance("en-US");
20 30
21 #if defined(OS_LINUX) 31 #if defined(OS_LINUX)
22 // Disable GPU browser compositor during unit tests. 32 EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL));
23 views::View::set_use_acceleration_when_possible(false); 33 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
34 switches::kUseGL, gfx::kGLImplementationOSMesaName);
35 #endif
36
37 #if defined(VIEWS_COMPOSITOR)
38 // Use a mock compositor that noops draws.
39 ui::Compositor::set_compositor_factory_for_testing(
40 ui::TestCompositor::Create);
24 #endif 41 #endif
25 } 42 }
26 }; 43 };
27 44
28 int main(int argc, char** argv) { 45 int main(int argc, char** argv) {
29 return ViewTestSuite(argc, argv).Run(); 46 return ViewTestSuite(argc, argv).Run();
30 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698