Revert of Cleanup NQE (patchset #5 id:80001 of https://codereview.chromium.org/127748...
[chromium-blink-merge.git] / media / base / run_all_unittests.cc
blob7c0c14aa2e6ff3bc104bc98135e81b32f81c6193
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/bind.h"
6 #include "base/command_line.h"
7 #include "base/test/launcher/unit_test_launcher.h"
8 #include "base/test/test_suite.h"
9 #include "build/build_config.h"
10 #include "media/base/media.h"
11 #include "media/base/media_switches.h"
13 #if defined(OS_ANDROID)
14 #include "base/android/jni_android.h"
15 #include "media/base/android/media_jni_registrar.h"
16 #include "ui/gl/android/gl_jni_registrar.h"
17 #endif
19 class TestSuiteNoAtExit : public base::TestSuite {
20 public:
21 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
22 ~TestSuiteNoAtExit() override {}
24 protected:
25 void Initialize() override;
28 void TestSuiteNoAtExit::Initialize() {
29 // Run TestSuite::Initialize first so that logging is initialized.
30 base::TestSuite::Initialize();
32 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
33 command_line->AppendSwitch(switches::kEnableInbandTextTracks);
35 #if defined(OS_ANDROID)
36 // Register JNI bindings for android.
37 JNIEnv* env = base::android::AttachCurrentThread();
38 // Needed for surface texture support.
39 ui::gl::android::RegisterJni(env);
40 media::RegisterJni(env);
41 #endif
43 // Run this here instead of main() to ensure an AtExitManager is already
44 // present.
45 media::InitializeMediaLibrary();
48 int main(int argc, char** argv) {
49 TestSuiteNoAtExit test_suite(argc, argv);
51 return base::LaunchUnitTests(
52 argc, argv, base::Bind(&TestSuiteNoAtExit::Run,
53 base::Unretained(&test_suite)));