| 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 68 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 68 #include "third_party/WebKit/public/platform/WebSize.h" | 69 #include "third_party/WebKit/public/platform/WebSize.h" |
| 69 #include "third_party/WebKit/public/platform/WebString.h" | 70 #include "third_party/WebKit/public/platform/WebString.h" |
| 70 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 71 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 71 #include "third_party/WebKit/public/platform/WebThread.h" | 72 #include "third_party/WebKit/public/platform/WebThread.h" |
| 72 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 73 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 73 #include "third_party/WebKit/public/platform/WebURL.h" | 74 #include "third_party/WebKit/public/platform/WebURL.h" |
| 74 #include "third_party/WebKit/public/platform/WebURLError.h" | 75 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 75 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 76 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 76 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 77 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 77 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" | 78 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom
.h" |
| 78 #include "third_party/WebKit/public/web/WebArrayBufferView.h" | 79 #include "third_party/WebKit/public/web/WebArrayBufferView.h" |
| 79 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 80 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 80 #include "third_party/WebKit/public/web/WebDataSource.h" | 81 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 81 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 82 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" |
| 82 #include "third_party/WebKit/public/web/WebDocument.h" | 83 #include "third_party/WebKit/public/web/WebDocument.h" |
| 83 #include "third_party/WebKit/public/web/WebElement.h" | 84 #include "third_party/WebKit/public/web/WebElement.h" |
| 84 #include "third_party/WebKit/public/web/WebFrame.h" | 85 #include "third_party/WebKit/public/web/WebFrame.h" |
| 85 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 86 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 86 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 87 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 87 #include "third_party/WebKit/public/web/WebKit.h" | 88 #include "third_party/WebKit/public/web/WebKit.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 684 |
| 684 void BlinkTestRunner::ResetPermissions() { | 685 void BlinkTestRunner::ResetPermissions() { |
| 685 Send(new LayoutTestHostMsg_ResetPermissions(routing_id())); | 686 Send(new LayoutTestHostMsg_ResetPermissions(routing_id())); |
| 686 } | 687 } |
| 687 | 688 |
| 688 cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() { | 689 cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() { |
| 689 return RenderThread::Get()->GetSharedBitmapManager(); | 690 return RenderThread::Get()->GetSharedBitmapManager(); |
| 690 } | 691 } |
| 691 | 692 |
| 692 void BlinkTestRunner::DispatchBeforeInstallPromptEvent( | 693 void BlinkTestRunner::DispatchBeforeInstallPromptEvent( |
| 693 int request_id, | |
| 694 const std::vector<std::string>& event_platforms, | 694 const std::vector<std::string>& event_platforms, |
| 695 const base::Callback<void(bool)>& callback) { | 695 const base::Callback<void(bool)>& callback) { |
| 696 app_banner_service_.reset(new test_runner::AppBannerService()); |
| 697 |
| 696 // Send the event to the frame. | 698 // Send the event to the frame. |
| 697 blink::WebAppBannerPromptReply reply; | 699 blink::mojom::AppBannerPromptReply reply; |
| 698 std::vector<blink::WebString> blink_web_strings; | 700 std::vector<blink::WebString> blink_web_strings; |
| 699 for (const auto& platform : event_platforms) | 701 for (const auto& platform : event_platforms) |
| 700 blink_web_strings.push_back(blink::WebString::fromUTF8(platform)); | 702 blink_web_strings.push_back(blink::WebString::fromUTF8(platform)); |
| 701 blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings); | 703 blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings); |
| 702 | 704 |
| 703 WebLocalFrame* main_frame = | 705 WebLocalFrame* main_frame = |
| 704 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); | 706 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); |
| 705 main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms, | 707 main_frame->willShowInstallBannerPrompt( |
| 706 &reply); | 708 app_banner_service_->GetServiceHandle(), |
| 709 app_banner_service_->GetEventHandle(), blink_event_platforms, &reply); |
| 707 | 710 |
| 708 callback.Run(reply == blink::WebAppBannerPromptReply::Cancel); | 711 callback.Run(reply == blink::mojom::AppBannerPromptReply::CANCEL); |
| 712 } |
| 713 |
| 714 void BlinkTestRunner::ResolveBeforeInstallPromptPromise( |
| 715 const std::string& platform) { |
| 716 if (app_banner_service_) { |
| 717 app_banner_service_->ResolvePromise(platform); |
| 718 app_banner_service_.reset(nullptr); |
| 719 } |
| 709 } | 720 } |
| 710 | 721 |
| 711 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( | 722 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( |
| 712 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { | 723 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { |
| 713 if (params.mimeType != "application/x-plugin-placeholder-test") | 724 if (params.mimeType != "application/x-plugin-placeholder-test") |
| 714 return nullptr; | 725 return nullptr; |
| 715 | 726 |
| 716 plugins::PluginPlaceholder* placeholder = | 727 plugins::PluginPlaceholder* placeholder = |
| 717 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, | 728 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, |
| 718 params, "<div>Test content</div>"); | 729 params, "<div>Test content</div>"); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 void BlinkTestRunner::ReportLeakDetectionResult( | 1021 void BlinkTestRunner::ReportLeakDetectionResult( |
| 1011 const LeakDetectionResult& report) { | 1022 const LeakDetectionResult& report) { |
| 1012 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1023 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 1013 } | 1024 } |
| 1014 | 1025 |
| 1015 void BlinkTestRunner::OnDestruct() { | 1026 void BlinkTestRunner::OnDestruct() { |
| 1016 delete this; | 1027 delete this; |
| 1017 } | 1028 } |
| 1018 | 1029 |
| 1019 } // namespace content | 1030 } // namespace content |
| OLD | NEW |