| 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/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.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/trees/layer_tree_settings.h" | 20 #include "cc/trees/layer_tree_settings.h" |
| 21 #include "components/scheduler/renderer/renderer_scheduler_impl.h" | 21 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
| 22 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 22 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
| 23 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" | 23 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes
ts.h" |
| 24 #include "content/child/web_url_loader_impl.h" |
| 24 #include "content/test/mock_webclipboard_impl.h" | 25 #include "content/test/mock_webclipboard_impl.h" |
| 25 #include "content/test/web_gesture_curve_mock.h" | 26 #include "content/test/web_gesture_curve_mock.h" |
| 26 #include "media/base/media.h" | 27 #include "media/base/media.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" |
| 34 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 35 #include "third_party/WebKit/public/platform/WebThread.h" |
| 33 #include "third_party/WebKit/public/platform/WebURL.h" | 36 #include "third_party/WebKit/public/platform/WebURL.h" |
| 34 #include "third_party/WebKit/public/web/WebKit.h" | 37 #include "third_party/WebKit/public/web/WebKit.h" |
| 35 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 38 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
| 36 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 39 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 37 #include "v8/include/v8.h" | 40 #include "v8/include/v8.h" |
| 38 | 41 |
| 39 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
| 40 #include "base/mac/foundation_util.h" | 43 #include "base/mac/foundation_util.h" |
| 41 #include "base/mac/scoped_nsautorelease_pool.h" | 44 #include "base/mac/scoped_nsautorelease_pool.h" |
| 42 #endif | 45 #endif |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 NOTREACHED() << | 181 NOTREACHED() << |
| 179 "IndexedDB cannot be tested with in-process harnesses."; | 182 "IndexedDB cannot be tested with in-process harnesses."; |
| 180 return NULL; | 183 return NULL; |
| 181 } | 184 } |
| 182 | 185 |
| 183 blink::WebMimeRegistry* TestBlinkWebUnitTestSupport::mimeRegistry() { | 186 blink::WebMimeRegistry* TestBlinkWebUnitTestSupport::mimeRegistry() { |
| 184 return &mime_registry_; | 187 return &mime_registry_; |
| 185 } | 188 } |
| 186 | 189 |
| 187 blink::WebURLLoader* TestBlinkWebUnitTestSupport::createURLLoader() { | 190 blink::WebURLLoader* TestBlinkWebUnitTestSupport::createURLLoader() { |
| 188 return url_loader_factory_->createURLLoader( | 191 blink::WebThread* currentThread = Platform::current()->currentThread(); |
| 189 BlinkPlatformImpl::createURLLoader()); | 192 // This loader should be used only for process-local resources such as |
| 193 // data URLs. |
| 194 blink::WebURLLoader* default_loader = new WebURLLoaderImpl( |
| 195 nullptr, base::WrapUnique(currentThread->getWebTaskRunner()->clone())); |
| 196 return url_loader_factory_->createURLLoader(default_loader); |
| 190 } | 197 } |
| 191 | 198 |
| 192 blink::WebString TestBlinkWebUnitTestSupport::userAgent() { | 199 blink::WebString TestBlinkWebUnitTestSupport::userAgent() { |
| 193 return blink::WebString::fromUTF8("test_runner/0.0.0.0"); | 200 return blink::WebString::fromUTF8("test_runner/0.0.0.0"); |
| 194 } | 201 } |
| 195 | 202 |
| 196 blink::WebString TestBlinkWebUnitTestSupport::queryLocalizedString( | 203 blink::WebString TestBlinkWebUnitTestSupport::queryLocalizedString( |
| 197 blink::WebLocalizedString::Name name) { | 204 blink::WebLocalizedString::Name name) { |
| 198 // Returns placeholder strings to check if they are correctly localized. | 205 // Returns placeholder strings to check if they are correctly localized. |
| 199 switch (name) { | 206 switch (name) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 return BlinkPlatformImpl::currentThread(); | 292 return BlinkPlatformImpl::currentThread(); |
| 286 } | 293 } |
| 287 | 294 |
| 288 void TestBlinkWebUnitTestSupport::getPluginList( | 295 void TestBlinkWebUnitTestSupport::getPluginList( |
| 289 bool refresh, blink::WebPluginListBuilder* builder) { | 296 bool refresh, blink::WebPluginListBuilder* builder) { |
| 290 builder->addPlugin("pdf", "pdf", "pdf-files"); | 297 builder->addPlugin("pdf", "pdf", "pdf-files"); |
| 291 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); | 298 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); |
| 292 } | 299 } |
| 293 | 300 |
| 294 } // namespace content | 301 } // namespace content |
| OLD | NEW |