| 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/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "cc/blink/web_layer_impl.h" | 18 #include "cc/blink/web_layer_impl.h" |
| 19 #include "cc/trees/layer_tree_settings.h" | 19 #include "cc/trees/layer_tree_settings.h" |
| 20 #include "components/scheduler/renderer/renderer_scheduler_impl.h" | 20 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
| 21 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 21 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
| 22 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" | 22 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" |
| 23 #include "content/test/mock_webclipboard_impl.h" | 23 #include "content/test/mock_webclipboard_impl.h" |
| 24 #include "content/test/web_gesture_curve_mock.h" | 24 #include "content/test/web_gesture_curve_mock.h" |
| 25 #include "media/base/media.h" | 25 #include "media/base/media.h" |
| 26 #include "net/cookies/cookie_monster.h" | 26 #include "net/cookies/cookie_monster.h" |
| 27 #include "storage/browser/database/vfs_backend.h" | 27 #include "storage/browser/database/vfs_backend.h" |
| 28 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 28 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
| 29 #include "third_party/WebKit/public/platform/WebData.h" | 29 #include "third_party/WebKit/public/platform/WebData.h" |
| 30 #include "third_party/WebKit/public/platform/WebFileSystem.h" | |
| 31 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 30 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 32 #include "third_party/WebKit/public/platform/WebStorageArea.h" | |
| 33 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" | |
| 34 #include "third_party/WebKit/public/platform/WebString.h" | 31 #include "third_party/WebKit/public/platform/WebString.h" |
| 35 #include "third_party/WebKit/public/platform/WebURL.h" | 32 #include "third_party/WebKit/public/platform/WebURL.h" |
| 36 #include "third_party/WebKit/public/web/WebCache.h" | |
| 37 #include "third_party/WebKit/public/web/WebDatabase.h" | |
| 38 #include "third_party/WebKit/public/web/WebKit.h" | 33 #include "third_party/WebKit/public/web/WebKit.h" |
| 39 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 34 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
| 40 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 35 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 41 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | |
| 42 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" | |
| 43 #include "v8/include/v8.h" | 36 #include "v8/include/v8.h" |
| 44 | 37 |
| 45 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
| 46 #include "base/mac/foundation_util.h" | 39 #include "base/mac/foundation_util.h" |
| 47 #include "base/mac/scoped_nsautorelease_pool.h" | 40 #include "base/mac/scoped_nsautorelease_pool.h" |
| 48 #endif | 41 #endif |
| 49 | 42 |
| 50 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 43 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 51 #include "gin/v8_initializer.h" | 44 #include "gin/v8_initializer.h" |
| 52 #endif | 45 #endif |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 286 } |
| 294 | 287 |
| 295 blink::WebGestureCurve* TestBlinkWebUnitTestSupport::createFlingAnimationCurve( | 288 blink::WebGestureCurve* TestBlinkWebUnitTestSupport::createFlingAnimationCurve( |
| 296 blink::WebGestureDevice device_source, | 289 blink::WebGestureDevice device_source, |
| 297 const blink::WebFloatPoint& velocity, | 290 const blink::WebFloatPoint& velocity, |
| 298 const blink::WebSize& cumulative_scroll) { | 291 const blink::WebSize& cumulative_scroll) { |
| 299 // Caller will retain and release. | 292 // Caller will retain and release. |
| 300 return new WebGestureCurveMock(velocity, cumulative_scroll); | 293 return new WebGestureCurveMock(velocity, cumulative_scroll); |
| 301 } | 294 } |
| 302 | 295 |
| 303 blink::WebUnitTestSupport* TestBlinkWebUnitTestSupport::unitTestSupport() { | 296 blink::WebURLLoaderMockFactory* |
| 304 return this; | 297 TestBlinkWebUnitTestSupport::getURLLoaderMockFactory() { |
| 305 } | 298 return url_loader_factory_.get(); |
| 306 | |
| 307 void TestBlinkWebUnitTestSupport::registerMockedURL( | |
| 308 const blink::WebURL& url, | |
| 309 const blink::WebURLResponse& response, | |
| 310 const blink::WebString& file_path) { | |
| 311 url_loader_factory_->registerURL(url, response, file_path); | |
| 312 } | |
| 313 | |
| 314 void TestBlinkWebUnitTestSupport::registerMockedErrorURL( | |
| 315 const blink::WebURL& url, | |
| 316 const blink::WebURLResponse& response, | |
| 317 const blink::WebURLError& error) { | |
| 318 url_loader_factory_->registerErrorURL(url, response, error); | |
| 319 } | |
| 320 | |
| 321 void TestBlinkWebUnitTestSupport::unregisterMockedURL( | |
| 322 const blink::WebURL& url) { | |
| 323 url_loader_factory_->unregisterURL(url); | |
| 324 } | |
| 325 | |
| 326 void TestBlinkWebUnitTestSupport::unregisterAllMockedURLs() { | |
| 327 url_loader_factory_->unregisterAllURLs(); | |
| 328 blink::WebCache::clear(); | |
| 329 } | |
| 330 | |
| 331 void TestBlinkWebUnitTestSupport::serveAsynchronousMockedRequests() { | |
| 332 url_loader_factory_->serveAsynchronousRequests(); | |
| 333 } | |
| 334 | |
| 335 void TestBlinkWebUnitTestSupport::setLoaderDelegate( | |
| 336 blink::WebURLLoaderTestDelegate* delegate) { | |
| 337 url_loader_factory_->setLoaderDelegate(delegate); | |
| 338 } | 299 } |
| 339 | 300 |
| 340 blink::WebThread* TestBlinkWebUnitTestSupport::currentThread() { | 301 blink::WebThread* TestBlinkWebUnitTestSupport::currentThread() { |
| 341 if (web_thread_ && web_thread_->isCurrentThread()) | 302 if (web_thread_ && web_thread_->isCurrentThread()) |
| 342 return web_thread_.get(); | 303 return web_thread_.get(); |
| 343 return BlinkPlatformImpl::currentThread(); | 304 return BlinkPlatformImpl::currentThread(); |
| 344 } | 305 } |
| 345 | 306 |
| 346 void TestBlinkWebUnitTestSupport::getPluginList( | 307 void TestBlinkWebUnitTestSupport::getPluginList( |
| 347 bool refresh, blink::WebPluginListBuilder* builder) { | 308 bool refresh, blink::WebPluginListBuilder* builder) { |
| 348 builder->addPlugin("pdf", "pdf", "pdf-files"); | 309 builder->addPlugin("pdf", "pdf", "pdf-files"); |
| 349 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 310 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
| 350 } | 311 } |
| 351 | 312 |
| 352 } // namespace content | 313 } // namespace content |
| OLD | NEW |