Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Fix Win clang compile Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int request_id,
694 const std::vector<std::string>& event_platforms, 695 const std::vector<std::string>& event_platforms,
695 const base::Callback<void(bool)>& callback) { 696 const base::Callback<void(bool)>& callback) {
697 // Set up a blink::mojom::AppBannerService shim to capture the Mojo request
698 // that the BeforeInstallPromptEvent sends to the browser.
699 app_banner_service_.reset(new test_runner::AppBannerService(request_id));
700 shell::InterfaceProvider* remote_interfaces =
701 render_view()->GetMainRenderFrame()->GetRemoteInterfaces();
702 shell::InterfaceProvider::TestApi test_api(remote_interfaces);
703 test_api.SetBinderForName(
704 blink::mojom::AppBannerService::Name_,
705 base::Bind(&test_runner::AppBannerService::BindHandle,
706 base::Unretained(app_banner_service_.get())));
707
696 // Send the event to the frame. 708 // Send the event to the frame.
697 blink::WebAppBannerPromptReply reply; 709 blink::mojom::AppBannerPromptReply reply;
698 std::vector<blink::WebString> blink_web_strings; 710 std::vector<blink::WebString> blink_web_strings;
699 for (const auto& platform : event_platforms) 711 for (const auto& platform : event_platforms)
700 blink_web_strings.push_back(blink::WebString::fromUTF8(platform)); 712 blink_web_strings.push_back(blink::WebString::fromUTF8(platform));
701 blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings); 713 blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings);
702 714
703 WebLocalFrame* main_frame = 715 WebLocalFrame* main_frame =
704 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); 716 render_view()->GetWebView()->mainFrame()->toWebLocalFrame();
705 main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms, 717 main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms,
706 &reply); 718 &reply);
707 719
708 callback.Run(reply == blink::WebAppBannerPromptReply::Cancel); 720 callback.Run(reply == blink::mojom::AppBannerPromptReply::CANCEL);
721 }
722
723 void BlinkTestRunner::ResolveBeforeInstallPromptPromise(
724 int request_id,
725 const std::string& platform) {
726 app_banner_service_->ResolvePromise(request_id, platform);
709 } 727 }
710 728
711 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( 729 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder(
712 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { 730 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) {
713 if (params.mimeType != "application/x-plugin-placeholder-test") 731 if (params.mimeType != "application/x-plugin-placeholder-test")
714 return nullptr; 732 return nullptr;
715 733
716 plugins::PluginPlaceholder* placeholder = 734 plugins::PluginPlaceholder* placeholder =
717 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, 735 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame,
718 params, "<div>Test content</div>"); 736 params, "<div>Test content</div>");
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 void BlinkTestRunner::ReportLeakDetectionResult( 1028 void BlinkTestRunner::ReportLeakDetectionResult(
1011 const LeakDetectionResult& report) { 1029 const LeakDetectionResult& report) {
1012 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1030 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1013 } 1031 }
1014 1032
1015 void BlinkTestRunner::OnDestruct() { 1033 void BlinkTestRunner::OnDestruct() {
1016 delete this; 1034 delete this;
1017 } 1035 }
1018 1036
1019 } // namespace content 1037 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698