| 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/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "cc/blink/web_layer_impl.h" | 19 #include "cc/blink/web_layer_impl.h" |
| 20 #include "cc/test/test_shared_bitmap_manager.h" | 20 #include "cc/test/test_shared_bitmap_manager.h" |
| 21 #include "cc/trees/layer_tree_settings.h" | 21 #include "cc/trees/layer_tree_settings.h" |
| 22 #include "content/app/mojo/mojo_init.h" | 22 #include "content/app/mojo/mojo_init.h" |
| 23 #include "content/child/web_url_loader_impl.h" | 23 #include "content/child/web_url_loader_impl.h" |
| 24 #include "content/test/mock_webclipboard_impl.h" | 24 #include "content/test/mock_webclipboard_impl.h" |
| 25 #include "content/test/web_gesture_curve_mock.h" | 25 #include "content/test/web_gesture_curve_mock.h" |
| 26 #include "media/base/media.h" | 26 #include "media/base/media.h" |
| 27 #include "media/media_features.h" |
| 27 #include "net/cookies/cookie_monster.h" | 28 #include "net/cookies/cookie_monster.h" |
| 28 #include "storage/browser/database/vfs_backend.h" | 29 #include "storage/browser/database/vfs_backend.h" |
| 29 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 30 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
| 30 #include "third_party/WebKit/public/platform/WebData.h" | 31 #include "third_party/WebKit/public/platform/WebData.h" |
| 31 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 32 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 32 #include "third_party/WebKit/public/platform/WebString.h" | 33 #include "third_party/WebKit/public/platform/WebString.h" |
| 33 #include "third_party/WebKit/public/platform/WebThread.h" | 34 #include "third_party/WebKit/public/platform/WebThread.h" |
| 34 #include "third_party/WebKit/public/platform/WebURL.h" | 35 #include "third_party/WebKit/public/platform/WebURL.h" |
| 35 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 36 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 36 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" | 37 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" |
| 37 #include "third_party/WebKit/public/web/WebKit.h" | 38 #include "third_party/WebKit/public/web/WebKit.h" |
| 38 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 39 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
| 39 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 40 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 40 #include "v8/include/v8.h" | 41 #include "v8/include/v8.h" |
| 41 | 42 |
| 42 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
| 43 #include "base/mac/foundation_util.h" | 44 #include "base/mac/foundation_util.h" |
| 44 #include "base/mac/scoped_nsautorelease_pool.h" | 45 #include "base/mac/scoped_nsautorelease_pool.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 48 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 48 #include "gin/v8_initializer.h" // nogncheck | 49 #include "gin/v8_initializer.h" // nogncheck |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 #if defined(ENABLE_WEBRTC) | 52 #if BUILDFLAG(ENABLE_WEBRTC) |
| 52 #include "content/renderer/media/rtc_certificate.h" | 53 #include "content/renderer/media/rtc_certificate.h" |
| 53 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" | 54 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" |
| 54 #include "third_party/webrtc/base/rtccertificate.h" | 55 #include "third_party/webrtc/base/rtccertificate.h" |
| 55 #endif | 56 #endif |
| 56 | 57 |
| 57 namespace { | 58 namespace { |
| 58 | 59 |
| 59 class DummyTaskRunner : public base::SingleThreadTaskRunner { | 60 class DummyTaskRunner : public base::SingleThreadTaskRunner { |
| 60 public: | 61 public: |
| 61 DummyTaskRunner() : thread_id_(base::PlatformThread::CurrentId()) {} | 62 DummyTaskRunner() : thread_id_(base::PlatformThread::CurrentId()) {} |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 303 } |
| 303 | 304 |
| 304 void TestBlinkWebUnitTestSupport::getPluginList( | 305 void TestBlinkWebUnitTestSupport::getPluginList( |
| 305 bool refresh, | 306 bool refresh, |
| 306 const blink::WebSecurityOrigin& mainFrameOrigin, | 307 const blink::WebSecurityOrigin& mainFrameOrigin, |
| 307 blink::WebPluginListBuilder* builder) { | 308 blink::WebPluginListBuilder* builder) { |
| 308 builder->addPlugin("pdf", "pdf", "pdf-files"); | 309 builder->addPlugin("pdf", "pdf", "pdf-files"); |
| 309 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 310 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
| 310 } | 311 } |
| 311 | 312 |
| 312 #if defined(ENABLE_WEBRTC) | 313 #if BUILDFLAG(ENABLE_WEBRTC) |
| 313 namespace { | 314 namespace { |
| 314 | 315 |
| 315 class TestWebRTCCertificateGenerator | 316 class TestWebRTCCertificateGenerator |
| 316 : public blink::WebRTCCertificateGenerator { | 317 : public blink::WebRTCCertificateGenerator { |
| 317 void generateCertificate( | 318 void generateCertificate( |
| 318 const blink::WebRTCKeyParams& key_params, | 319 const blink::WebRTCKeyParams& key_params, |
| 319 std::unique_ptr<blink::WebRTCCertificateCallback> callback) override { | 320 std::unique_ptr<blink::WebRTCCertificateCallback> callback) override { |
| 320 NOTIMPLEMENTED(); | 321 NOTIMPLEMENTED(); |
| 321 } | 322 } |
| 322 void generateCertificateWithExpiration( | 323 void generateCertificateWithExpiration( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 334 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 335 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
| 335 rtc::RTCCertificate::FromPEM(rtc::RTCCertificatePEM( | 336 rtc::RTCCertificate::FromPEM(rtc::RTCCertificatePEM( |
| 336 pem_private_key.utf8(), pem_certificate.utf8())); | 337 pem_private_key.utf8(), pem_certificate.utf8())); |
| 337 if (!certificate) | 338 if (!certificate) |
| 338 return nullptr; | 339 return nullptr; |
| 339 return base::MakeUnique<RTCCertificate>(certificate); | 340 return base::MakeUnique<RTCCertificate>(certificate); |
| 340 } | 341 } |
| 341 }; | 342 }; |
| 342 | 343 |
| 343 } // namespace | 344 } // namespace |
| 344 #endif // defined(ENABLE_WEBRTC) | 345 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 345 | 346 |
| 346 blink::WebRTCCertificateGenerator* | 347 blink::WebRTCCertificateGenerator* |
| 347 TestBlinkWebUnitTestSupport::createRTCCertificateGenerator() { | 348 TestBlinkWebUnitTestSupport::createRTCCertificateGenerator() { |
| 348 #if defined(ENABLE_WEBRTC) | 349 #if BUILDFLAG(ENABLE_WEBRTC) |
| 349 return new TestWebRTCCertificateGenerator(); | 350 return new TestWebRTCCertificateGenerator(); |
| 350 #else | 351 #else |
| 351 return nullptr; | 352 return nullptr; |
| 352 #endif | 353 #endif |
| 353 } | 354 } |
| 354 | 355 |
| 355 } // namespace content | 356 } // namespace content |
| OLD | NEW |