| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/child/web_url_loader_impl.h" | 24 #include "content/child/web_url_loader_impl.h" |
| 25 #include "content/test/mock_webclipboard_impl.h" | 25 #include "content/test/mock_webclipboard_impl.h" |
| 26 #include "content/test/web_gesture_curve_mock.h" | 26 #include "content/test/web_gesture_curve_mock.h" |
| 27 #include "media/base/media.h" | 27 #include "media/base/media.h" |
| 28 #include "media/media_features.h" | 28 #include "media/media_features.h" |
| 29 #include "net/cookies/cookie_monster.h" | 29 #include "net/cookies/cookie_monster.h" |
| 30 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 30 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
| 31 #include "third_party/WebKit/public/platform/WebData.h" | 31 #include "third_party/WebKit/public/platform/WebData.h" |
| 32 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" | 32 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" |
| 33 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 33 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 34 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" |
| 34 #include "third_party/WebKit/public/platform/WebString.h" | 35 #include "third_party/WebKit/public/platform/WebString.h" |
| 35 #include "third_party/WebKit/public/platform/WebThread.h" | 36 #include "third_party/WebKit/public/platform/WebThread.h" |
| 36 #include "third_party/WebKit/public/platform/WebURL.h" | 37 #include "third_party/WebKit/public/platform/WebURL.h" |
| 37 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 38 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 38 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" | 39 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t
est_support.h" |
| 39 #include "third_party/WebKit/public/web/WebKit.h" | 40 #include "third_party/WebKit/public/web/WebKit.h" |
| 40 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 41 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 41 #include "v8/include/v8.h" | 42 #include "v8/include/v8.h" |
| 42 | 43 |
| 43 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
| 44 #include "base/mac/foundation_util.h" | 45 #include "base/mac/foundation_util.h" |
| 45 #include "base/mac/scoped_nsautorelease_pool.h" | 46 #include "base/mac/scoped_nsautorelease_pool.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 49 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 49 #include "gin/v8_initializer.h" // nogncheck | 50 #include "gin/v8_initializer.h" // nogncheck |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 #if BUILDFLAG(ENABLE_WEBRTC) | 53 #if BUILDFLAG(ENABLE_WEBRTC) |
| 53 #include "content/renderer/media/rtc_certificate.h" | 54 #include "content/renderer/media/rtc_certificate.h" |
| 54 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" | |
| 55 #include "third_party/webrtc/base/rtccertificate.h" // nogncheck | 55 #include "third_party/webrtc/base/rtccertificate.h" // nogncheck |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 using blink::WebString; | 58 using blink::WebString; |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 class DummyTaskRunner : public base::SingleThreadTaskRunner { | 62 class DummyTaskRunner : public base::SingleThreadTaskRunner { |
| 63 public: | 63 public: |
| 64 DummyTaskRunner() : thread_id_(base::PlatformThread::CurrentId()) {} | 64 DummyTaskRunner() : thread_id_(base::PlatformThread::CurrentId()) {} |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 blink::WebString TestBlinkWebUnitTestSupport::DefaultLocale() { | 263 blink::WebString TestBlinkWebUnitTestSupport::DefaultLocale() { |
| 264 return blink::WebString::FromASCII("en-US"); | 264 return blink::WebString::FromASCII("en-US"); |
| 265 } | 265 } |
| 266 | 266 |
| 267 blink::WebCompositorSupport* TestBlinkWebUnitTestSupport::CompositorSupport() { | 267 blink::WebCompositorSupport* TestBlinkWebUnitTestSupport::CompositorSupport() { |
| 268 return &compositor_support_; | 268 return &compositor_support_; |
| 269 } | 269 } |
| 270 | 270 |
| 271 blink::WebGestureCurve* TestBlinkWebUnitTestSupport::CreateFlingAnimationCurve( | 271 std::unique_ptr<blink::WebGestureCurve> |
| 272 TestBlinkWebUnitTestSupport::CreateFlingAnimationCurve( |
| 272 blink::WebGestureDevice device_source, | 273 blink::WebGestureDevice device_source, |
| 273 const blink::WebFloatPoint& velocity, | 274 const blink::WebFloatPoint& velocity, |
| 274 const blink::WebSize& cumulative_scroll) { | 275 const blink::WebSize& cumulative_scroll) { |
| 275 // Caller will retain and release. | 276 return base::MakeUnique<WebGestureCurveMock>(velocity, cumulative_scroll); |
| 276 return new WebGestureCurveMock(velocity, cumulative_scroll); | |
| 277 } | 277 } |
| 278 | 278 |
| 279 blink::WebURLLoaderMockFactory* | 279 blink::WebURLLoaderMockFactory* |
| 280 TestBlinkWebUnitTestSupport::GetURLLoaderMockFactory() { | 280 TestBlinkWebUnitTestSupport::GetURLLoaderMockFactory() { |
| 281 return url_loader_factory_.get(); | 281 return url_loader_factory_.get(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { | 284 blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { |
| 285 if (web_thread_ && web_thread_->IsCurrentThread()) | 285 if (web_thread_ && web_thread_->IsCurrentThread()) |
| 286 return web_thread_.get(); | 286 return web_thread_.get(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 pem_private_key.Utf8(), pem_certificate.Utf8())); | 322 pem_private_key.Utf8(), pem_certificate.Utf8())); |
| 323 if (!certificate) | 323 if (!certificate) |
| 324 return nullptr; | 324 return nullptr; |
| 325 return base::MakeUnique<RTCCertificate>(certificate); | 325 return base::MakeUnique<RTCCertificate>(certificate); |
| 326 } | 326 } |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 } // namespace | 329 } // namespace |
| 330 #endif // BUILDFLAG(ENABLE_WEBRTC) | 330 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 331 | 331 |
| 332 blink::WebRTCCertificateGenerator* | 332 std::unique_ptr<blink::WebRTCCertificateGenerator> |
| 333 TestBlinkWebUnitTestSupport::CreateRTCCertificateGenerator() { | 333 TestBlinkWebUnitTestSupport::CreateRTCCertificateGenerator() { |
| 334 #if BUILDFLAG(ENABLE_WEBRTC) | 334 #if BUILDFLAG(ENABLE_WEBRTC) |
| 335 return new TestWebRTCCertificateGenerator(); | 335 return base::MakeUnique<TestWebRTCCertificateGenerator>(); |
| 336 #else | 336 #else |
| 337 return nullptr; | 337 return nullptr; |
| 338 #endif | 338 #endif |
| 339 } | 339 } |
| 340 | 340 |
| 341 } // namespace content | 341 } // namespace content |
| OLD | NEW |