run_all_unittests.cc revision b2df76ea8fec9e32f6f3718986dba0d95315b29c
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.
4
5#include "base/command_line.h"
6#include "base/test/test_suite.h"
7#include "build/build_config.h"
8#include "media/base/media.h"
9#include "media/base/media_switches.h"
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
16class TestSuiteNoAtExit : public base::TestSuite {
17 public:
18  TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
19  virtual ~TestSuiteNoAtExit() {}
20 protected:
21  virtual void Initialize() OVERRIDE;
22};
23
24void TestSuiteNoAtExit::Initialize() {
25  // Run TestSuite::Initialize first so that logging is initialized.
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
34  // Run this here instead of main() to ensure an AtExitManager is already
35  // present.
36  media::InitializeMediaLibraryForTesting();
37  // Enable VP9 video codec support for all media tests.
38  // TODO(tomfinegan): Remove this once the VP9 flag is removed or negated.
39  CommandLine* cmd_line = CommandLine::ForCurrentProcess();
40  cmd_line->AppendSwitch(switches::kEnableVp9Playback);
41  // Enable VP8 alpha support for all media tests.
42  // TODO(tomfinegan): Remove this once the VP8 alpha flag is removed or
43  // negated.
44  cmd_line->AppendSwitch(switches::kEnableVp8AlphaPlayback);
45}
46
47int main(int argc, char** argv) {
48  return TestSuiteNoAtExit(argc, argv).Run();
49}
50