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