| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 blink::WebString::fromUTF8("test-shell-resource")); | 122 blink::WebString::fromUTF8("test-shell-resource")); |
| 123 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( | 123 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( |
| 124 blink::WebString::fromUTF8("test-shell-resource")); | 124 blink::WebString::fromUTF8("test-shell-resource")); |
| 125 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( | 125 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( |
| 126 blink::WebString::fromUTF8("test-shell-resource")); | 126 blink::WebString::fromUTF8("test-shell-resource")); |
| 127 blink::WebRuntimeFeatures::enableApplicationCache(true); | 127 blink::WebRuntimeFeatures::enableApplicationCache(true); |
| 128 blink::WebRuntimeFeatures::enableDatabase(true); | 128 blink::WebRuntimeFeatures::enableDatabase(true); |
| 129 blink::WebRuntimeFeatures::enableNotifications(true); | 129 blink::WebRuntimeFeatures::enableNotifications(true); |
| 130 blink::WebRuntimeFeatures::enableTouch(true); | 130 blink::WebRuntimeFeatures::enableTouch(true); |
| 131 | 131 |
| 132 // Load libraries for media and enable the media player. | 132 // Initialize libraries for media and enable the media player. |
| 133 bool enable_media = false; | 133 media::InitializeMediaLibrary(); |
| 134 base::FilePath module_path; | 134 blink::WebRuntimeFeatures::enableMediaPlayer(true); |
| 135 if (PathService::Get(base::DIR_MODULE, &module_path)) { | |
| 136 #if defined(OS_MACOSX) | |
| 137 if (base::mac::AmIBundled()) | |
| 138 module_path = module_path.DirName().DirName().DirName(); | |
| 139 #endif | |
| 140 if (media::InitializeMediaLibrary(module_path)) | |
| 141 enable_media = true; | |
| 142 } | |
| 143 blink::WebRuntimeFeatures::enableMediaPlayer(enable_media); | |
| 144 LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n"; | |
| 145 | 135 |
| 146 file_utilities_.set_sandbox_enabled(false); | 136 file_utilities_.set_sandbox_enabled(false); |
| 147 | 137 |
| 148 if (!file_system_root_.CreateUniqueTempDir()) { | 138 if (!file_system_root_.CreateUniqueTempDir()) { |
| 149 LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 139 LOG(WARNING) << "Failed to create a temp dir for the filesystem." |
| 150 "FileSystem feature will be disabled."; | 140 "FileSystem feature will be disabled."; |
| 151 DCHECK(file_system_root_.path().empty()); | 141 DCHECK(file_system_root_.path().empty()); |
| 152 } | 142 } |
| 153 | 143 |
| 154 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 base::MessageLoop::current()->Quit(); | 372 base::MessageLoop::current()->Quit(); |
| 383 } | 373 } |
| 384 | 374 |
| 385 void TestBlinkWebUnitTestSupport::getPluginList( | 375 void TestBlinkWebUnitTestSupport::getPluginList( |
| 386 bool refresh, blink::WebPluginListBuilder* builder) { | 376 bool refresh, blink::WebPluginListBuilder* builder) { |
| 387 builder->addPlugin("pdf", "pdf", "pdf-files"); | 377 builder->addPlugin("pdf", "pdf", "pdf-files"); |
| 388 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 378 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
| 389 } | 379 } |
| 390 | 380 |
| 391 } // namespace content | 381 } // namespace content |
| OLD | NEW |