OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/bind.h" | |
6 #include "base/test/launcher/unit_test_launcher.h" | |
7 #include "base/test/test_suite.h" | |
8 #include "build/build_config.h" | |
9 #include "media/base/media.h" | |
10 #include "third_party/WebKit/public/web/WebKit.h" | |
11 | |
12 #if defined(OS_ANDROID) | |
13 #include "base/android/jni_android.h" | |
14 #include "media/base/android/media_jni_registrar.h" | |
15 #include "ui/gl/android/gl_jni_registrar.h" | |
16 #endif | |
17 | |
18 class TestBlinkPlatformSupport : NON_EXPORTED_BASE(public blink::Platform) { | |
19 public: | |
scherkus (not reviewing)
2014/09/04 23:00:36
indent one extra space
acolwell GONE FROM CHROMIUM
2014/09/05 00:23:44
Done.
| |
20 virtual ~TestBlinkPlatformSupport(); | |
scherkus (not reviewing)
2014/09/04 23:00:36
it's a bit odd how you inline some methods, but no
acolwell GONE FROM CHROMIUM
2014/09/05 00:23:44
Removed inlines.
| |
21 | |
22 virtual void cryptographicallyRandomValues(unsigned char* buffer, | |
23 size_t length) OVERRIDE; | |
24 virtual const unsigned char* getTraceCategoryEnabledFlag( | |
25 const char* categoryName) OVERRIDE; | |
26 }; | |
27 | |
28 TestBlinkPlatformSupport::~TestBlinkPlatformSupport() {} | |
29 void TestBlinkPlatformSupport::cryptographicallyRandomValues( | |
30 unsigned char* buffer, | |
31 size_t length) { | |
32 } | |
33 | |
34 const unsigned char* TestBlinkPlatformSupport::getTraceCategoryEnabledFlag( | |
35 const char* categoryName) | |
36 { | |
scherkus (not reviewing)
2014/09/04 23:00:36
{ on previous line
acolwell GONE FROM CHROMIUM
2014/09/05 00:23:44
Done.
| |
37 static const unsigned char tracingIsDisabled = 0; | |
38 return &tracingIsDisabled; | |
39 } | |
40 | |
41 class BlinkMediaTestSuite : public base::TestSuite { | |
42 public: | |
43 BlinkMediaTestSuite(int argc, char** argv) | |
44 : TestSuite(argc, argv), | |
45 blink_platform_support_(new TestBlinkPlatformSupport()) { | |
46 } | |
47 virtual ~BlinkMediaTestSuite() {} | |
48 protected: | |
49 virtual void Initialize() OVERRIDE; | |
50 | |
51 private: | |
52 scoped_ptr<TestBlinkPlatformSupport> blink_platform_support_; | |
53 }; | |
54 | |
55 void BlinkMediaTestSuite::Initialize() { | |
56 // Run TestSuite::Initialize first so that logging is initialized. | |
57 base::TestSuite::Initialize(); | |
58 | |
59 #if defined(OS_ANDROID) | |
60 // Register JNI bindings for android. | |
61 JNIEnv* env = base::android::AttachCurrentThread(); | |
62 // Needed for surface texture support. | |
63 ui::gl::android::RegisterJni(env); | |
64 media::RegisterJni(env); | |
65 #endif | |
66 | |
67 // Run this here instead of main() to ensure an AtExitManager is already | |
68 // present. | |
69 media::InitializeMediaLibraryForTesting(); | |
70 | |
71 blink::initialize(blink_platform_support_.get()); | |
72 } | |
73 | |
74 int main(int argc, char** argv) { | |
75 BlinkMediaTestSuite test_suite(argc, argv); | |
76 | |
77 return base::LaunchUnitTests( | |
78 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, | |
79 base::Unretained(&test_suite))); | |
80 } | |
OLD | NEW |