Add localized default audio device names.
[chromium-blink-merge.git] / media / base / run_all_unittests.cc
blob97e799b031786506180abd67c46802d94783f471
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_discardable_memory_allocator.h"
9 #include "base/test/test_suite.h"
10 #include "build/build_config.h"
11 #include "media/base/fake_media_resources.h"
12 #include "media/base/media.h"
13 #include "media/base/media_switches.h"
15 #if defined(OS_ANDROID)
16 #include "base/android/jni_android.h"
17 #include "media/base/android/media_jni_registrar.h"
18 #include "ui/gl/android/gl_jni_registrar.h"
19 #endif
21 class TestSuiteNoAtExit : public base::TestSuite {
22 public:
23 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
24 ~TestSuiteNoAtExit() override {}
26 protected:
27 void Initialize() override;
29 private:
30 base::TestDiscardableMemoryAllocator discardable_memory_allocator_;
33 void TestSuiteNoAtExit::Initialize() {
34 // Run TestSuite::Initialize first so that logging is initialized.
35 base::TestSuite::Initialize();
37 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
38 command_line->AppendSwitch(switches::kEnableInbandTextTracks);
40 #if defined(OS_ANDROID)
41 // Register JNI bindings for android.
42 JNIEnv* env = base::android::AttachCurrentThread();
43 // Needed for surface texture support.
44 ui::gl::android::RegisterJni(env);
45 media::RegisterJni(env);
46 #endif
48 // Run this here instead of main() to ensure an AtExitManager is already
49 // present.
50 media::InitializeMediaLibrary();
51 media::SetUpFakeMediaResources();
53 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
56 int main(int argc, char** argv) {
57 TestSuiteNoAtExit test_suite(argc, argv);
59 return base::LaunchUnitTests(
60 argc, argv, base::Bind(&TestSuiteNoAtExit::Run,
61 base::Unretained(&test_suite)));