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
3 // found in the LICENSE file.
5 #include "base/at_exit.h"
7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h"
10 #include "base/mac/scoped_nsautorelease_pool.h"
12 #include "base/test/launcher/unit_test_launcher.h"
13 #include "base/test/test_suite.h"
14 #include "gpu/command_buffer/client/gles2_lib.h"
15 #include "gpu/config/gpu_util.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "ui/gl/gl_surface.h"
19 #if defined(OS_ANDROID)
20 #include "base/android/jni_android.h"
21 #include "ui/gl/android/gl_jni_registrar.h"
26 int RunHelper(base::TestSuite
* testSuite
) {
27 #if defined(USE_OZONE)
28 base::MessageLoopForUI main_loop
;
30 base::MessageLoopForIO message_loop
;
32 gfx::GLSurface::InitializeOneOff();
33 ::gles2::Initialize();
34 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess());
35 return testSuite
->Run();
40 int main(int argc
, char** argv
) {
41 #if defined(OS_ANDROID)
42 ui::gl::android::RegisterJni(base::android::AttachCurrentThread());
44 base::TestSuite
test_suite(argc
, argv
);
45 base::CommandLine::Init(argc
, argv
);
46 #if defined(OS_MACOSX)
47 base::mac::ScopedNSAutoreleasePool pool
;
49 testing::InitGoogleMock(&argc
, argv
);
50 return base::LaunchUnitTestsSerially(
53 base::Bind(&RunHelper
, base::Unretained(&test_suite
)));