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/command_line.h" | 7 #include "base/command_line.h" |
7 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
8 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
9 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
10 #endif | 11 #endif |
| 12 #include "base/test/launcher/unit_test_launcher.h" |
| 13 #include "base/test/test_suite.h" |
11 #include "gpu/command_buffer/client/gles2_lib.h" | 14 #include "gpu/command_buffer/client/gles2_lib.h" |
12 #include "gpu/command_buffer/tests/gl_test_utils.h" | |
13 #include "gpu/config/gpu_util.h" | 15 #include "gpu/config/gpu_util.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
15 | 18 |
16 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
17 #include "base/android/jni_android.h" | 20 #include "base/android/jni_android.h" |
18 #include "ui/gl/android/gl_jni_registrar.h" | 21 #include "ui/gl/android/gl_jni_registrar.h" |
19 #endif | 22 #endif |
20 | 23 |
| 24 namespace { |
| 25 |
| 26 int RunHelper(base::TestSuite* testSuite) { |
| 27 base::MessageLoopForIO message_loop; |
| 28 return testSuite->Run(); |
| 29 } |
| 30 |
| 31 } // namespace |
| 32 |
21 int main(int argc, char** argv) { | 33 int main(int argc, char** argv) { |
22 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
23 ui::gl::android::RegisterJni(base::android::AttachCurrentThread()); | 35 ui::gl::android::RegisterJni(base::android::AttachCurrentThread()); |
24 #else | |
25 base::AtExitManager exit_manager; | |
26 #endif | 36 #endif |
| 37 base::TestSuite test_suite(argc, argv); |
27 CommandLine::Init(argc, argv); | 38 CommandLine::Init(argc, argv); |
28 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
29 base::mac::ScopedNSAutoreleasePool pool; | 40 base::mac::ScopedNSAutoreleasePool pool; |
30 #endif | 41 #endif |
31 gfx::GLSurface::InitializeOneOff(); | 42 gfx::GLSurface::InitializeOneOff(); |
32 ::gles2::Initialize(); | 43 ::gles2::Initialize(); |
33 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); | 44 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); |
34 base::MessageLoop main_message_loop; | 45 testing::InitGoogleMock(&argc, argv); |
35 return GLTestHelper::RunTests(argc, argv); | 46 return base::LaunchUnitTestsSerially( |
| 47 argc, |
| 48 argv, |
| 49 base::Bind(&RunHelper, base::Unretained(&test_suite))); |
36 } | 50 } |
37 | |
38 | |
OLD | NEW |