OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/test_blink_web_unit_test_support.h" | 5 #include "content/test/test_blink_web_unit_test_support.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 blink::WebString::fromUTF8("test-shell-resource")); | 120 blink::WebString::fromUTF8("test-shell-resource")); |
121 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( | 121 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( |
122 blink::WebString::fromUTF8("test-shell-resource")); | 122 blink::WebString::fromUTF8("test-shell-resource")); |
123 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( | 123 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( |
124 blink::WebString::fromUTF8("test-shell-resource")); | 124 blink::WebString::fromUTF8("test-shell-resource")); |
125 blink::WebRuntimeFeatures::enableApplicationCache(true); | 125 blink::WebRuntimeFeatures::enableApplicationCache(true); |
126 blink::WebRuntimeFeatures::enableDatabase(true); | 126 blink::WebRuntimeFeatures::enableDatabase(true); |
127 blink::WebRuntimeFeatures::enableNotifications(true); | 127 blink::WebRuntimeFeatures::enableNotifications(true); |
128 blink::WebRuntimeFeatures::enableTouch(true); | 128 blink::WebRuntimeFeatures::enableTouch(true); |
129 | 129 |
130 // Initialize libraries for media and enable the media player. | 130 // Load libraries for media and enable the media player. |
131 media::InitializeMediaLibrary(); | 131 bool enable_media = false; |
132 blink::WebRuntimeFeatures::enableMediaPlayer(true); | 132 base::FilePath module_path; |
| 133 if (PathService::Get(base::DIR_MODULE, &module_path)) { |
| 134 #if defined(OS_MACOSX) |
| 135 if (base::mac::AmIBundled()) |
| 136 module_path = module_path.DirName().DirName().DirName(); |
| 137 #endif |
| 138 if (media::InitializeMediaLibrary(module_path)) |
| 139 enable_media = true; |
| 140 } |
| 141 blink::WebRuntimeFeatures::enableMediaPlayer(enable_media); |
| 142 LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n"; |
133 | 143 |
134 file_utilities_.set_sandbox_enabled(false); | 144 file_utilities_.set_sandbox_enabled(false); |
135 | 145 |
136 if (!file_system_root_.CreateUniqueTempDir()) { | 146 if (!file_system_root_.CreateUniqueTempDir()) { |
137 LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 147 LOG(WARNING) << "Failed to create a temp dir for the filesystem." |
138 "FileSystem feature will be disabled."; | 148 "FileSystem feature will be disabled."; |
139 DCHECK(file_system_root_.path().empty()); | 149 DCHECK(file_system_root_.path().empty()); |
140 } | 150 } |
141 | 151 |
142 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 DCHECK(base::MessageLoop::current()); | 374 DCHECK(base::MessageLoop::current()); |
365 DCHECK(!base::MessageLoop::current()->is_running()); | 375 DCHECK(!base::MessageLoop::current()->is_running()); |
366 base::MessageLoop::current()->Run(); | 376 base::MessageLoop::current()->Run(); |
367 } | 377 } |
368 | 378 |
369 void TestBlinkWebUnitTestSupport::exitRunLoop() { | 379 void TestBlinkWebUnitTestSupport::exitRunLoop() { |
370 base::MessageLoop::current()->Quit(); | 380 base::MessageLoop::current()->Quit(); |
371 } | 381 } |
372 | 382 |
373 } // namespace content | 383 } // namespace content |
OLD | NEW |