| OLD | NEW |
| 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" | 12 #include "ui/gl/gl_surface.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class NoAtExitBaseTestSuite : public base::TestSuite { | 16 class NoAtExitBaseTestSuite : public base::TestSuite { |
| 17 public: | 17 public: |
| 18 NoAtExitBaseTestSuite(int argc, char** argv) | 18 NoAtExitBaseTestSuite(int argc, char** argv) |
| 19 : base::TestSuite(argc, argv, false) { | 19 : base::TestSuite(argc, argv, false) { |
| 20 } | 20 } |
| 21 |
| 22 virtual void Initialize() OVERRIDE { |
| 23 base::TestSuite::Initialize(); |
| 24 gfx::GLSurface::InitializeOneOffWithMockBindingsForTests(); |
| 25 gfx::GLSurface::InitializeDynamicMockBindingsForTests(NULL); |
| 26 } |
| 21 }; | 27 }; |
| 22 | 28 |
| 23 int RunTestSuite(int argc, char** argv) { | 29 int RunTestSuite(int argc, char** argv) { |
| 24 return NoAtExitBaseTestSuite(argc, argv).Run(); | 30 return NoAtExitBaseTestSuite(argc, argv).Run(); |
| 25 } | 31 } |
| 26 | 32 |
| 27 } // namespace | 33 } // namespace |
| 28 | 34 |
| 29 int main(int argc, char** argv) { | 35 int main(int argc, char** argv) { |
| 30 // On Android, AtExitManager is created in | 36 // On Android, AtExitManager is created in |
| 31 // testing/android/native_test_wrapper.cc before main() is called. | 37 // testing/android/native_test_wrapper.cc before main() is called. |
| 32 // The same thing is also done in base/test/test_suite.cc | 38 // The same thing is also done in base/test/test_suite.cc |
| 33 #if !defined(OS_ANDROID) | 39 #if !defined(OS_ANDROID) |
| 34 base::AtExitManager exit_manager; | 40 base::AtExitManager exit_manager; |
| 35 #endif | 41 #endif |
| 36 CommandLine::Init(argc, argv); | 42 CommandLine::Init(argc, argv); |
| 37 gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL); | |
| 38 gfx::InitializeDynamicGLBindings(gfx::kGLImplementationMockGL, NULL); | |
| 39 testing::InitGoogleMock(&argc, argv); | 43 testing::InitGoogleMock(&argc, argv); |
| 40 return base::LaunchUnitTests(argc, | 44 return base::LaunchUnitTests(argc, |
| 41 argv, | 45 argv, |
| 42 base::Bind(&RunTestSuite, argc, argv)); | 46 base::Bind(&RunTestSuite, argc, argv)); |
| 43 } | 47 } |
| OLD | NEW |