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 <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/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 14 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
15 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" | 15 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" |
16 #include "third_party/WebKit/public/web/WebKit.h" | 16 #include "third_party/WebKit/public/web/WebKit.h" |
17 | 17 |
18 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
19 #include "base/android/jni_android.h" | 19 #include "base/android/jni_android.h" |
20 #include "media/base/android/media_jni_registrar.h" | 20 #include "media/base/android/media_jni_registrar.h" |
21 #endif | 21 #endif |
22 | 22 |
| 23 #if !defined(OS_IOS) |
| 24 #include "mojo/edk/embedder/embedder.h" |
| 25 #endif |
| 26 |
23 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
24 #include "gin/v8_initializer.h" | 28 #include "gin/v8_initializer.h" |
25 #endif | 29 #endif |
26 | 30 |
27 class TestBlinkPlatformSupport : public blink::Platform { | 31 class TestBlinkPlatformSupport : public blink::Platform { |
28 public: | 32 public: |
29 TestBlinkPlatformSupport() | 33 TestBlinkPlatformSupport() |
30 : renderer_scheduler_( | 34 : renderer_scheduler_( |
31 blink::scheduler::CreateRendererSchedulerForTests()), | 35 blink::scheduler::CreateRendererSchedulerForTests()), |
32 main_thread_(renderer_scheduler_->CreateMainThread()) {} | 36 main_thread_(renderer_scheduler_->CreateMainThread()) {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 79 |
76 // Run this here instead of main() to ensure an AtExitManager is already | 80 // Run this here instead of main() to ensure an AtExitManager is already |
77 // present. | 81 // present. |
78 media::InitializeMediaLibrary(); | 82 media::InitializeMediaLibrary(); |
79 | 83 |
80 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 84 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
81 gin::V8Initializer::LoadV8Snapshot(); | 85 gin::V8Initializer::LoadV8Snapshot(); |
82 gin::V8Initializer::LoadV8Natives(); | 86 gin::V8Initializer::LoadV8Natives(); |
83 #endif | 87 #endif |
84 | 88 |
| 89 // Initialize mojo firstly to enable Blink initialization to use it. |
| 90 #if !defined(OS_IOS) |
| 91 mojo::edk::Init(); |
| 92 #endif |
85 // Dummy task runner is initialized here because the blink::initialize creates | 93 // Dummy task runner is initialized here because the blink::initialize creates |
86 // IsolateHolder which needs the current task runner handle. There should be | 94 // IsolateHolder which needs the current task runner handle. There should be |
87 // no task posted to this task runner. | 95 // no task posted to this task runner. |
88 std::unique_ptr<base::MessageLoop> message_loop; | 96 std::unique_ptr<base::MessageLoop> message_loop; |
89 if (!base::MessageLoop::current()) | 97 if (!base::MessageLoop::current()) |
90 message_loop.reset(new base::MessageLoop()); | 98 message_loop.reset(new base::MessageLoop()); |
91 blink::initialize(blink_platform_support_.get()); | 99 blink::initialize(blink_platform_support_.get()); |
92 } | 100 } |
93 | 101 |
94 int main(int argc, char** argv) { | 102 int main(int argc, char** argv) { |
95 BlinkMediaTestSuite test_suite(argc, argv); | 103 BlinkMediaTestSuite test_suite(argc, argv); |
96 | 104 |
97 return base::LaunchUnitTests( | 105 return base::LaunchUnitTests( |
98 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, | 106 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, |
99 base::Unretained(&test_suite))); | 107 base::Unretained(&test_suite))); |
100 } | 108 } |
OLD | NEW |