| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell/renderer/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <clocale> | 10 #include <clocale> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/single_thread_task_runner.h" | 24 #include "base/single_thread_task_runner.h" |
| 25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 27 #include "base/strings/sys_string_conversions.h" | 27 #include "base/strings/sys_string_conversions.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 29 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
| 31 #include "base/values.h" | 31 #include "base/values.h" |
| 32 #include "build/build_config.h" | 32 #include "build/build_config.h" |
| 33 #include "components/plugins/renderer/plugin_placeholder.h" | 33 #include "components/plugins/renderer/plugin_placeholder.h" |
| 34 #include "components/test_runner/app_banner_service.h" |
| 34 #include "components/test_runner/gamepad_controller.h" | 35 #include "components/test_runner/gamepad_controller.h" |
| 35 #include "components/test_runner/layout_and_paint_async_then.h" | 36 #include "components/test_runner/layout_and_paint_async_then.h" |
| 36 #include "components/test_runner/pixel_dump.h" | 37 #include "components/test_runner/pixel_dump.h" |
| 37 #include "components/test_runner/web_test_interfaces.h" | 38 #include "components/test_runner/web_test_interfaces.h" |
| 38 #include "components/test_runner/web_test_runner.h" | 39 #include "components/test_runner/web_test_runner.h" |
| 39 #include "components/test_runner/web_view_test_proxy.h" | 40 #include "components/test_runner/web_view_test_proxy.h" |
| 40 #include "content/common/content_switches_internal.h" | 41 #include "content/common/content_switches_internal.h" |
| 41 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
| 42 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
| 43 #include "content/public/common/web_preferences.h" | 44 #include "content/public/common/web_preferences.h" |
| 44 #include "content/public/renderer/media_stream_utils.h" | 45 #include "content/public/renderer/media_stream_utils.h" |
| 45 #include "content/public/renderer/render_frame.h" | 46 #include "content/public/renderer/render_frame.h" |
| 46 #include "content/public/renderer/render_view.h" | 47 #include "content/public/renderer/render_view.h" |
| 47 #include "content/public/renderer/render_view_visitor.h" | 48 #include "content/public/renderer/render_view_visitor.h" |
| 48 #include "content/public/renderer/renderer_gamepad_provider.h" | 49 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 49 #include "content/public/test/layouttest_support.h" | 50 #include "content/public/test/layouttest_support.h" |
| 50 #include "content/shell/common/layout_test/layout_test_messages.h" | 51 #include "content/shell/common/layout_test/layout_test_messages.h" |
| 51 #include "content/shell/common/shell_messages.h" | 52 #include "content/shell/common/shell_messages.h" |
| 52 #include "content/shell/common/shell_switches.h" | 53 #include "content/shell/common/shell_switches.h" |
| 53 #include "content/shell/renderer/layout_test/blink_test_helpers.h" | 54 #include "content/shell/renderer/layout_test/blink_test_helpers.h" |
| 54 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer.
h" | 55 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer.
h" |
| 55 #include "content/shell/renderer/layout_test/leak_detector.h" | 56 #include "content/shell/renderer/layout_test/leak_detector.h" |
| 56 #include "media/base/audio_capturer_source.h" | 57 #include "media/base/audio_capturer_source.h" |
| 57 #include "media/base/audio_parameters.h" | 58 #include "media/base/audio_parameters.h" |
| 58 #include "media/capture/video_capturer_source.h" | 59 #include "media/capture/video_capturer_source.h" |
| 59 #include "net/base/filename_util.h" | 60 #include "net/base/filename_util.h" |
| 60 #include "net/base/net_errors.h" | 61 #include "net/base/net_errors.h" |
| 61 #include "services/service_manager/public/cpp/interface_provider.h" | 62 #include "services/service_manager/public/cpp/interface_provider.h" |
| 63 #include "services/service_manager/public/cpp/interface_registry.h" |
| 62 #include "skia/ext/platform_canvas.h" | 64 #include "skia/ext/platform_canvas.h" |
| 63 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 65 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
| 64 #include "third_party/WebKit/public/platform/Platform.h" | 66 #include "third_party/WebKit/public/platform/Platform.h" |
| 65 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 67 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 66 #include "third_party/WebKit/public/platform/WebPoint.h" | 68 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 67 #include "third_party/WebKit/public/platform/WebRect.h" | 69 #include "third_party/WebKit/public/platform/WebRect.h" |
| 68 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 70 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 69 #include "third_party/WebKit/public/platform/WebSize.h" | 71 #include "third_party/WebKit/public/platform/WebSize.h" |
| 70 #include "third_party/WebKit/public/platform/WebString.h" | 72 #include "third_party/WebKit/public/platform/WebString.h" |
| 71 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 73 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 72 #include "third_party/WebKit/public/platform/WebThread.h" | 74 #include "third_party/WebKit/public/platform/WebThread.h" |
| 73 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 75 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 74 #include "third_party/WebKit/public/platform/WebURL.h" | 76 #include "third_party/WebKit/public/platform/WebURL.h" |
| 75 #include "third_party/WebKit/public/platform/WebURLError.h" | 77 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 76 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 78 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 77 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 79 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 78 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" | 80 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom
.h" |
| 79 #include "third_party/WebKit/public/web/WebArrayBufferView.h" | 81 #include "third_party/WebKit/public/web/WebArrayBufferView.h" |
| 80 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 82 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 81 #include "third_party/WebKit/public/web/WebDataSource.h" | 83 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 82 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 84 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" |
| 83 #include "third_party/WebKit/public/web/WebDocument.h" | 85 #include "third_party/WebKit/public/web/WebDocument.h" |
| 84 #include "third_party/WebKit/public/web/WebElement.h" | 86 #include "third_party/WebKit/public/web/WebElement.h" |
| 85 #include "third_party/WebKit/public/web/WebFrame.h" | 87 #include "third_party/WebKit/public/web/WebFrame.h" |
| 86 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 88 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 87 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 89 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 88 #include "third_party/WebKit/public/web/WebKit.h" | 90 #include "third_party/WebKit/public/web/WebKit.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 701 |
| 700 void BlinkTestRunner::ResetPermissions() { | 702 void BlinkTestRunner::ResetPermissions() { |
| 701 Send(new LayoutTestHostMsg_ResetPermissions(routing_id())); | 703 Send(new LayoutTestHostMsg_ResetPermissions(routing_id())); |
| 702 } | 704 } |
| 703 | 705 |
| 704 cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() { | 706 cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() { |
| 705 return RenderThread::Get()->GetSharedBitmapManager(); | 707 return RenderThread::Get()->GetSharedBitmapManager(); |
| 706 } | 708 } |
| 707 | 709 |
| 708 void BlinkTestRunner::DispatchBeforeInstallPromptEvent( | 710 void BlinkTestRunner::DispatchBeforeInstallPromptEvent( |
| 709 int request_id, | |
| 710 const std::vector<std::string>& event_platforms, | 711 const std::vector<std::string>& event_platforms, |
| 711 const base::Callback<void(bool)>& callback) { | 712 const base::Callback<void(bool)>& callback) { |
| 712 // Send the event to the frame. | 713 app_banner_service_.reset(new test_runner::AppBannerService()); |
| 713 blink::WebAppBannerPromptReply reply; | |
| 714 std::vector<blink::WebString> blink_web_strings; | |
| 715 for (const auto& platform : event_platforms) | |
| 716 blink_web_strings.push_back(blink::WebString::fromUTF8(platform)); | |
| 717 blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings); | |
| 718 | 714 |
| 719 WebLocalFrame* main_frame = | 715 service_manager::InterfaceRegistry::TestApi test_api( |
| 720 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); | 716 render_view()->GetMainRenderFrame()->GetInterfaceRegistry()); |
| 721 main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms, | 717 test_api.GetLocalInterface( |
| 722 &reply); | 718 mojo::GetProxy(&app_banner_service_->controller())); |
| 723 | 719 |
| 724 callback.Run(reply == blink::WebAppBannerPromptReply::Cancel); | 720 app_banner_service_->SendBannerPromptRequest(event_platforms, callback); |
| 721 } |
| 722 |
| 723 void BlinkTestRunner::ResolveBeforeInstallPromptPromise( |
| 724 const std::string& platform) { |
| 725 if (app_banner_service_) { |
| 726 app_banner_service_->ResolvePromise(platform); |
| 727 app_banner_service_.reset(nullptr); |
| 728 } |
| 725 } | 729 } |
| 726 | 730 |
| 727 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( | 731 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( |
| 728 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { | 732 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { |
| 729 if (params.mimeType != "application/x-plugin-placeholder-test") | 733 if (params.mimeType != "application/x-plugin-placeholder-test") |
| 730 return nullptr; | 734 return nullptr; |
| 731 | 735 |
| 732 plugins::PluginPlaceholder* placeholder = | 736 plugins::PluginPlaceholder* placeholder = |
| 733 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, | 737 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, |
| 734 params, "<div>Test content</div>"); | 738 params, "<div>Test content</div>"); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 void BlinkTestRunner::ReportLeakDetectionResult( | 1030 void BlinkTestRunner::ReportLeakDetectionResult( |
| 1027 const LeakDetectionResult& report) { | 1031 const LeakDetectionResult& report) { |
| 1028 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1032 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 1029 } | 1033 } |
| 1030 | 1034 |
| 1031 void BlinkTestRunner::OnDestruct() { | 1035 void BlinkTestRunner::OnDestruct() { |
| 1032 delete this; | 1036 delete this; |
| 1033 } | 1037 } |
| 1034 | 1038 |
| 1035 } // namespace content | 1039 } // namespace content |
| OLD | NEW |