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