Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: media/blink/run_all_unittests.cc

Issue 1938263002: Get media_blink_unittests running on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/blink/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/rand_util.h"
10 #include "base/test/launcher/unit_test_launcher.h" 9 #include "base/test/launcher/unit_test_launcher.h"
11 #include "base/test/test_suite.h" 10 #include "base/test/test_suite.h"
12 #include "build/build_config.h" 11 #include "build/build_config.h"
13 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" 12 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h"
14 #include "components/scheduler/child/web_task_runner_impl.h" 13 #include "components/scheduler/child/web_task_runner_impl.h"
15 #include "components/scheduler/renderer/renderer_scheduler_impl.h" 14 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
16 #include "components/scheduler/renderer/renderer_web_scheduler_impl.h" 15 #include "components/scheduler/renderer/renderer_web_scheduler_impl.h"
17 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes ts.h" 16 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes ts.h"
18 #include "media/base/media.h" 17 #include "media/base/media.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/WebKit/public/platform/WebScheduler.h" 19 #include "third_party/WebKit/public/platform/WebScheduler.h"
21 #include "third_party/WebKit/public/platform/WebTaskRunner.h" 20 #include "third_party/WebKit/public/platform/WebTaskRunner.h"
22 #include "third_party/WebKit/public/platform/WebThread.h" 21 #include "third_party/WebKit/public/platform/WebThread.h"
23 #include "third_party/WebKit/public/web/WebKit.h" 22 #include "third_party/WebKit/public/web/WebKit.h"
24 23
25 #if defined(OS_ANDROID) 24 #if defined(OS_ANDROID)
26 #include "base/android/jni_android.h" 25 #include "base/android/jni_android.h"
27 #include "media/base/android/media_jni_registrar.h" 26 #include "media/base/android/media_jni_registrar.h"
28 #include "ui/gl/android/gl_jni_registrar.h"
29 #endif 27 #endif
30 28
31 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 29 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
32 #include "gin/v8_initializer.h" 30 #include "gin/v8_initializer.h"
33 #endif 31 #endif
34 32
35 class CurrentThreadMock : public blink::WebThread { 33 class CurrentThreadMock : public blink::WebThread {
36 public: 34 public:
37 CurrentThreadMock() 35 CurrentThreadMock()
38 : task_runner_delegate_( 36 : task_runner_delegate_(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 blink_platform_support_(new TestBlinkPlatformSupport()) { 98 blink_platform_support_(new TestBlinkPlatformSupport()) {
101 } 99 }
102 100
103 BlinkMediaTestSuite::~BlinkMediaTestSuite() {} 101 BlinkMediaTestSuite::~BlinkMediaTestSuite() {}
104 102
105 void BlinkMediaTestSuite::Initialize() { 103 void BlinkMediaTestSuite::Initialize() {
106 // Run TestSuite::Initialize first so that logging is initialized. 104 // Run TestSuite::Initialize first so that logging is initialized.
107 base::TestSuite::Initialize(); 105 base::TestSuite::Initialize();
108 106
109 #if defined(OS_ANDROID) 107 #if defined(OS_ANDROID)
110 // Register JNI bindings for android. 108 media::RegisterJni(base::android::AttachCurrentThread());
111 JNIEnv* env = base::android::AttachCurrentThread();
112 // Needed for surface texture support.
113 ui::gl::android::RegisterJni(env);
114 media::RegisterJni(env);
115 #endif 109 #endif
116 110
117 // Run this here instead of main() to ensure an AtExitManager is already 111 // Run this here instead of main() to ensure an AtExitManager is already
118 // present. 112 // present.
119 media::InitializeMediaLibrary(); 113 media::InitializeMediaLibrary();
120 114
121 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 115 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
122 gin::V8Initializer::LoadV8Snapshot(); 116 gin::V8Initializer::LoadV8Snapshot();
123 gin::V8Initializer::LoadV8Natives(); 117 gin::V8Initializer::LoadV8Natives();
124 #endif 118 #endif
125 119
126 // Dummy task runner is initialized here because the blink::initialize creates 120 // Dummy task runner is initialized here because the blink::initialize creates
127 // IsolateHolder which needs the current task runner handle. There should be 121 // IsolateHolder which needs the current task runner handle. There should be
128 // no task posted to this task runner. 122 // no task posted to this task runner.
129 std::unique_ptr<base::MessageLoop> message_loop; 123 std::unique_ptr<base::MessageLoop> message_loop;
130 if (!base::MessageLoop::current()) 124 if (!base::MessageLoop::current())
131 message_loop.reset(new base::MessageLoop()); 125 message_loop.reset(new base::MessageLoop());
132 blink::initialize(blink_platform_support_.get()); 126 blink::initialize(blink_platform_support_.get());
133 } 127 }
134 128
135 int main(int argc, char** argv) { 129 int main(int argc, char** argv) {
136 BlinkMediaTestSuite test_suite(argc, argv); 130 BlinkMediaTestSuite test_suite(argc, argv);
137 131
138 return base::LaunchUnitTests( 132 return base::LaunchUnitTests(
139 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, 133 argc, argv, base::Bind(&BlinkMediaTestSuite::Run,
140 base::Unretained(&test_suite))); 134 base::Unretained(&test_suite)));
141 } 135 }
OLDNEW
« no previous file with comments | « media/blink/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698