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

Side by Side Diff: gpu/command_buffer/common/unittest_main.cc

Issue 332303002: gpu: Add base class for gpu service tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update gpu/build.GN Created 6 years, 6 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
« no previous file with comments | « gpu/BUILD.gn ('k') | gpu/command_buffer/service/buffer_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/test/launcher/unit_test_launcher.h" 8 #include "base/test/launcher/unit_test_launcher.h"
9 #include "base/test/test_suite.h" 9 #include "base/test/test_suite.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gl/gl_implementation.h"
13 #include "ui/gl/gl_mock.h"
14 #include "ui/gl/gl_surface.h"
15 12
16 namespace { 13 namespace {
17 14
18 class NoAtExitBaseTestSuite : public base::TestSuite { 15 class NoAtExitBaseTestSuite : public base::TestSuite {
19 public: 16 public:
20 NoAtExitBaseTestSuite(int argc, char** argv) 17 NoAtExitBaseTestSuite(int argc, char** argv)
21 : base::TestSuite(argc, argv, false) { 18 : base::TestSuite(argc, argv, false) {
22 } 19 }
23
24 virtual void Initialize() OVERRIDE {
25 base::TestSuite::Initialize();
26 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
27 gfx::GLSurface::InitializeOneOffWithMockBindingsForTests();
28 gfx::GLSurface::InitializeDynamicMockBindingsForTests(NULL);
29 }
30 }; 20 };
31 21
32 int RunTestSuite(int argc, char** argv) { 22 int RunTestSuite(int argc, char** argv) {
33 return NoAtExitBaseTestSuite(argc, argv).Run(); 23 return NoAtExitBaseTestSuite(argc, argv).Run();
34 } 24 }
35 25
36 } // namespace 26 } // namespace
37 27
38 int main(int argc, char** argv) { 28 int main(int argc, char** argv) {
39 // On Android, AtExitManager is created in 29 // On Android, AtExitManager is created in
40 // testing/android/native_test_wrapper.cc before main() is called. 30 // testing/android/native_test_wrapper.cc before main() is called.
41 // The same thing is also done in base/test/test_suite.cc 31 // The same thing is also done in base/test/test_suite.cc
42 #if !defined(OS_ANDROID) 32 #if !defined(OS_ANDROID)
43 base::AtExitManager exit_manager; 33 base::AtExitManager exit_manager;
44 #endif 34 #endif
45 CommandLine::Init(argc, argv); 35 CommandLine::Init(argc, argv);
46 testing::InitGoogleMock(&argc, argv); 36 testing::InitGoogleMock(&argc, argv);
47 return base::LaunchUnitTests(argc, 37 return base::LaunchUnitTests(argc,
48 argv, 38 argv,
49 base::Bind(&RunTestSuite, argc, argv)); 39 base::Bind(&RunTestSuite, argc, argv));
50 } 40 }
OLDNEW
« no previous file with comments | « gpu/BUILD.gn ('k') | gpu/command_buffer/service/buffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698