| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
| 7 #include "base/test/test_suite.h" | 7 #include "base/test/test_suite.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "media/base/media.h" | 9 #include "media/base/media.h" |
| 10 | 10 |
| 11 #if defined(OS_ANDROID) | 11 #if defined(OS_ANDROID) |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "media/base/android/media_jni_registrar.h" | 13 #include "media/base/android/media_jni_registrar.h" |
| 14 #include "ui/gl/android/gl_jni_registrar.h" | 14 #include "ui/gl/android/gl_jni_registrar.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 class TestSuiteNoAtExit : public base::TestSuite { | 17 class TestSuiteNoAtExit : public base::TestSuite { |
| 18 public: | 18 public: |
| 19 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} | 19 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} |
| 20 virtual ~TestSuiteNoAtExit() {} | 20 virtual ~TestSuiteNoAtExit() {} |
| 21 protected: | 21 protected: |
| 22 virtual void Initialize() OVERRIDE; | 22 virtual void Initialize() override; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 void TestSuiteNoAtExit::Initialize() { | 25 void TestSuiteNoAtExit::Initialize() { |
| 26 // Run TestSuite::Initialize first so that logging is initialized. | 26 // Run TestSuite::Initialize first so that logging is initialized. |
| 27 base::TestSuite::Initialize(); | 27 base::TestSuite::Initialize(); |
| 28 | 28 |
| 29 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 30 // Register JNI bindings for android. | 30 // Register JNI bindings for android. |
| 31 JNIEnv* env = base::android::AttachCurrentThread(); | 31 JNIEnv* env = base::android::AttachCurrentThread(); |
| 32 // Needed for surface texture support. | 32 // Needed for surface texture support. |
| 33 ui::gl::android::RegisterJni(env); | 33 ui::gl::android::RegisterJni(env); |
| 34 media::RegisterJni(env); | 34 media::RegisterJni(env); |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 // Run this here instead of main() to ensure an AtExitManager is already | 37 // Run this here instead of main() to ensure an AtExitManager is already |
| 38 // present. | 38 // present. |
| 39 media::InitializeMediaLibraryForTesting(); | 39 media::InitializeMediaLibraryForTesting(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 int main(int argc, char** argv) { | 42 int main(int argc, char** argv) { |
| 43 TestSuiteNoAtExit test_suite(argc, argv); | 43 TestSuiteNoAtExit test_suite(argc, argv); |
| 44 | 44 |
| 45 // Always run the perf tests serially, to avoid distorting | 45 // Always run the perf tests serially, to avoid distorting |
| 46 // perf measurements with randomness resulting from running | 46 // perf measurements with randomness resulting from running |
| 47 // in parallel. | 47 // in parallel. |
| 48 return base::LaunchUnitTestsSerially( | 48 return base::LaunchUnitTestsSerially( |
| 49 argc, argv, base::Bind(&TestSuiteNoAtExit::Run, | 49 argc, argv, base::Bind(&TestSuiteNoAtExit::Run, |
| 50 base::Unretained(&test_suite))); | 50 base::Unretained(&test_suite))); |
| 51 } | 51 } |
| OLD | NEW |