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.
6 #include "base/command_line.h"
7 #include "base/test/launcher/unit_test_launcher.h"
8 #include "base/test/test_discardable_memory_allocator.h"
9 #include "base/test/test_suite.h"
10 #include "build/build_config.h"
11 #include "media/base/media.h"
12 #include "media/base/media_switches.h"
14 #if defined(OS_ANDROID)
15 #include "base/android/jni_android.h"
16 #include "media/base/android/media_jni_registrar.h"
17 #include "ui/gl/android/gl_jni_registrar.h"
20 class TestSuiteNoAtExit
: public base::TestSuite
{
22 TestSuiteNoAtExit(int argc
, char** argv
) : TestSuite(argc
, argv
) {}
23 ~TestSuiteNoAtExit() override
{}
26 void Initialize() override
;
29 base::TestDiscardableMemoryAllocator discardable_memory_allocator_
;
32 void TestSuiteNoAtExit::Initialize() {
33 // Run TestSuite::Initialize first so that logging is initialized.
34 base::TestSuite::Initialize();
36 base::CommandLine
* command_line
= base::CommandLine::ForCurrentProcess();
37 command_line
->AppendSwitch(switches::kEnableInbandTextTracks
);
39 #if defined(OS_ANDROID)
40 // Register JNI bindings for android.
41 JNIEnv
* env
= base::android::AttachCurrentThread();
42 // Needed for surface texture support.
43 ui::gl::android::RegisterJni(env
);
44 media::RegisterJni(env
);
47 // Run this here instead of main() to ensure an AtExitManager is already
49 media::InitializeMediaLibrary();
51 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_
);
54 int main(int argc
, char** argv
) {
55 TestSuiteNoAtExit
test_suite(argc
, argv
);
57 return base::LaunchUnitTests(
58 argc
, argv
, base::Bind(&TestSuiteNoAtExit::Run
,
59 base::Unretained(&test_suite
)));