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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/test/test_suite.h" | 6 #include "base/test/test_suite.h" |
| 7 #include "build/build_config.h" |
7 #include "media/base/media.h" | 8 #include "media/base/media.h" |
8 #include "media/base/media_switches.h" | 9 #include "media/base/media_switches.h" |
9 | 10 |
| 11 #if defined(OS_ANDROID) |
| 12 #include "base/android/jni_android.h" |
| 13 #include "media/base/android/media_jni_registrar.h" |
| 14 #endif |
| 15 |
10 class TestSuiteNoAtExit : public base::TestSuite { | 16 class TestSuiteNoAtExit : public base::TestSuite { |
11 public: | 17 public: |
12 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} | 18 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} |
13 virtual ~TestSuiteNoAtExit() {} | 19 virtual ~TestSuiteNoAtExit() {} |
14 protected: | 20 protected: |
15 virtual void Initialize() OVERRIDE; | 21 virtual void Initialize() OVERRIDE; |
16 }; | 22 }; |
17 | 23 |
18 void TestSuiteNoAtExit::Initialize() { | 24 void TestSuiteNoAtExit::Initialize() { |
19 // Run TestSuite::Initialize first so that logging is initialized. | 25 // Run TestSuite::Initialize first so that logging is initialized. |
20 base::TestSuite::Initialize(); | 26 base::TestSuite::Initialize(); |
| 27 |
| 28 #if defined(OS_ANDROID) |
| 29 // Register JNI bindings for android. |
| 30 JNIEnv* env = base::android::AttachCurrentThread(); |
| 31 media::RegisterJni(env); |
| 32 #endif |
| 33 |
21 // Run this here instead of main() to ensure an AtExitManager is already | 34 // Run this here instead of main() to ensure an AtExitManager is already |
22 // present. | 35 // present. |
23 media::InitializeMediaLibraryForTesting(); | 36 media::InitializeMediaLibraryForTesting(); |
24 // Enable VP9 video codec support for all media tests. | 37 // Enable VP9 video codec support for all media tests. |
25 // TODO(tomfinegan): Remove this once the VP9 flag is removed or negated. | 38 // TODO(tomfinegan): Remove this once the VP9 flag is removed or negated. |
26 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 39 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
27 cmd_line->AppendSwitch(switches::kEnableVp9Playback); | 40 cmd_line->AppendSwitch(switches::kEnableVp9Playback); |
28 } | 41 } |
29 | 42 |
30 int main(int argc, char** argv) { | 43 int main(int argc, char** argv) { |
31 return TestSuiteNoAtExit(argc, argv).Run(); | 44 return TestSuiteNoAtExit(argc, argv).Run(); |
32 } | 45 } |
OLD | NEW |