Chromium Code Reviews| 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 #if defined(USE_OZONE) | |
| 19 #include "ui/ozone/public/ozone_platform.h" | |
| 20 #endif | |
| 18 | 21 |
| 19 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
| 20 #include "base/android/jni_android.h" | 23 #include "base/android/jni_android.h" |
| 21 #include "ui/gl/android/gl_jni_registrar.h" | 24 #include "ui/gl/android/gl_jni_registrar.h" |
| 22 #endif | 25 #endif |
| 23 | 26 |
| 24 namespace { | 27 namespace { |
| 25 | 28 |
| 26 int RunHelper(base::TestSuite* testSuite) { | 29 int RunHelper(base::TestSuite* testSuite) { |
| 30 #if defined(USE_OZONE) | |
| 31 base::MessageLoopForUI main_loop; | |
| 32 ui::OzonePlatform::InitializeForUI(); | |
| 33 ui::OzonePlatform::InitializeForGPU(); | |
| 34 gfx::GLSurface::InitializeOneOff(); | |
| 35 #else | |
| 27 base::MessageLoopForIO message_loop; | 36 base::MessageLoopForIO message_loop; |
| 37 #endif | |
| 28 return testSuite->Run(); | 38 return testSuite->Run(); |
| 29 } | 39 } |
| 30 | 40 |
| 31 } // namespace | 41 } // namespace |
| 32 | 42 |
| 33 int main(int argc, char** argv) { | 43 int main(int argc, char** argv) { |
| 34 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
| 35 ui::gl::android::RegisterJni(base::android::AttachCurrentThread()); | 45 ui::gl::android::RegisterJni(base::android::AttachCurrentThread()); |
| 36 #endif | 46 #endif |
| 37 base::TestSuite test_suite(argc, argv); | 47 base::TestSuite test_suite(argc, argv); |
| 38 base::CommandLine::Init(argc, argv); | 48 base::CommandLine::Init(argc, argv); |
| 39 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
| 40 base::mac::ScopedNSAutoreleasePool pool; | 50 base::mac::ScopedNSAutoreleasePool pool; |
| 41 #endif | 51 #endif |
| 52 #if !defined(USE_OZONE) | |
| 42 gfx::GLSurface::InitializeOneOff(); | 53 gfx::GLSurface::InitializeOneOff(); |
| 43 ::gles2::Initialize(); | 54 ::gles2::Initialize(); |
| 55 #endif | |
|
piman
2015/03/26 20:50:13
This concerns me slightly because ApplyGpuDriverBu
vignatti (out of this project)
2015/03/26 21:18:28
I tried to be conservative and not tackle other OS
piman
2015/03/26 21:32:49
Why would InitializeOneOff run twice?
vignatti (out of this project)
2015/03/27 16:00:16
I'm not sure how the batch logic works, but the Ru
| |
| 44 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 56 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
| 45 testing::InitGoogleMock(&argc, argv); | 57 testing::InitGoogleMock(&argc, argv); |
| 46 return base::LaunchUnitTestsSerially( | 58 return base::LaunchUnitTestsSerially( |
| 47 argc, | 59 argc, |
| 48 argv, | 60 argv, |
| 49 base::Bind(&RunHelper, base::Unretained(&test_suite))); | 61 base::Bind(&RunHelper, base::Unretained(&test_suite))); |
| 50 } | 62 } |
| OLD | NEW |