| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
| 8 #include "base/test/test_discardable_memory_allocator.h" | 8 #include "base/test/test_discardable_memory_allocator.h" |
| 9 #include "base/test/test_suite.h" | 9 #include "base/test/test_suite.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "media/base/fake_media_resources.h" | 11 #include "media/base/fake_media_resources.h" |
| 12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
| 13 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 16 #include "base/android/jni_android.h" | 16 #include "base/android/jni_android.h" |
| 17 #include "media/base/android/media_codec_util.h" | 17 #include "media/base/android/media_codec_util.h" |
| 18 #include "media/base/android/media_jni_registrar.h" | 18 #include "media/base/android/media_jni_registrar.h" |
| 19 #include "media/capture/video/android/capture_jni_registrar.h" | |
| 20 #include "ui/gl/android/gl_jni_registrar.h" | 19 #include "ui/gl/android/gl_jni_registrar.h" |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 class TestSuiteNoAtExit : public base::TestSuite { | 22 class TestSuiteNoAtExit : public base::TestSuite { |
| 24 public: | 23 public: |
| 25 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} | 24 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} |
| 26 ~TestSuiteNoAtExit() override {} | 25 ~TestSuiteNoAtExit() override {} |
| 27 | 26 |
| 28 protected: | 27 protected: |
| 29 void Initialize() override; | 28 void Initialize() override; |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 base::TestDiscardableMemoryAllocator discardable_memory_allocator_; | 31 base::TestDiscardableMemoryAllocator discardable_memory_allocator_; |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 void TestSuiteNoAtExit::Initialize() { | 34 void TestSuiteNoAtExit::Initialize() { |
| 36 // Run TestSuite::Initialize first so that logging is initialized. | 35 // Run TestSuite::Initialize first so that logging is initialized. |
| 37 base::TestSuite::Initialize(); | 36 base::TestSuite::Initialize(); |
| 38 | 37 |
| 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 40 command_line->AppendSwitch(switches::kEnableInbandTextTracks); | 39 command_line->AppendSwitch(switches::kEnableInbandTextTracks); |
| 41 | 40 |
| 42 #if defined(OS_ANDROID) | 41 #if defined(OS_ANDROID) |
| 43 // Register JNI bindings for android. | 42 // Register JNI bindings for android. |
| 44 JNIEnv* env = base::android::AttachCurrentThread(); | 43 JNIEnv* env = base::android::AttachCurrentThread(); |
| 45 // Needed for surface texture support. | 44 // Needed for surface texture support. |
| 46 ui::gl::android::RegisterJni(env); | 45 ui::gl::android::RegisterJni(env); |
| 47 media::RegisterJni(env); | 46 media::RegisterJni(env); |
| 48 media::RegisterCaptureJni(env); | |
| 49 | 47 |
| 50 if (media::MediaCodecUtil::IsMediaCodecAvailable()) | 48 if (media::MediaCodecUtil::IsMediaCodecAvailable()) |
| 51 media::EnablePlatformDecoderSupport(); | 49 media::EnablePlatformDecoderSupport(); |
| 52 #endif | 50 #endif |
| 53 | 51 |
| 54 // Run this here instead of main() to ensure an AtExitManager is already | 52 // Run this here instead of main() to ensure an AtExitManager is already |
| 55 // present. | 53 // present. |
| 56 media::InitializeMediaLibrary(); | 54 media::InitializeMediaLibrary(); |
| 57 media::SetUpFakeMediaResources(); | 55 media::SetUpFakeMediaResources(); |
| 58 | 56 |
| 59 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 57 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
| 60 } | 58 } |
| 61 | 59 |
| 62 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
| 63 TestSuiteNoAtExit test_suite(argc, argv); | 61 TestSuiteNoAtExit test_suite(argc, argv); |
| 64 | 62 |
| 65 return base::LaunchUnitTests( | 63 return base::LaunchUnitTests( |
| 66 argc, argv, base::Bind(&TestSuiteNoAtExit::Run, | 64 argc, argv, base::Bind(&TestSuiteNoAtExit::Run, |
| 67 base::Unretained(&test_suite))); | 65 base::Unretained(&test_suite))); |
| 68 } | 66 } |
| OLD | NEW |