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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/renderer/layout_test/blink_test_runner.cc
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc
index da1272fb7a1e550451d50f6f90cd46e5ebaa14ec..34e71594f9fa37d627021c66f6c0dcd9fccb51b3 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.cc
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -31,6 +31,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "components/plugins/renderer/plugin_placeholder.h"
+#include "components/test_runner/app_banner_service.h"
#include "components/test_runner/gamepad_controller.h"
#include "components/test_runner/layout_and_paint_async_then.h"
#include "components/test_runner/pixel_dump.h"
@@ -74,7 +75,7 @@
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
-#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerPromptReply.h"
+#include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom.h"
#include "third_party/WebKit/public/web/WebArrayBufferView.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
#include "third_party/WebKit/public/web/WebDataSource.h"
@@ -693,8 +694,19 @@ void BlinkTestRunner::DispatchBeforeInstallPromptEvent(
int request_id,
const std::vector<std::string>& event_platforms,
const base::Callback<void(bool)>& callback) {
+ // Set up a blink::mojom::AppBannerService shim to capture the Mojo request
+ // that the BeforeInstallPromptEvent sends to the browser.
+ app_banner_service_.reset(new test_runner::AppBannerService(request_id));
+ shell::InterfaceProvider* remote_interfaces =
+ render_view()->GetMainRenderFrame()->GetRemoteInterfaces();
+ shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+ test_api.SetBinderForName(
+ blink::mojom::AppBannerService::Name_,
+ base::Bind(&test_runner::AppBannerService::BindHandle,
+ base::Unretained(app_banner_service_.get())));
+
// Send the event to the frame.
- blink::WebAppBannerPromptReply reply;
+ blink::mojom::AppBannerPromptReply reply;
std::vector<blink::WebString> blink_web_strings;
for (const auto& platform : event_platforms)
blink_web_strings.push_back(blink::WebString::fromUTF8(platform));
@@ -705,7 +717,13 @@ void BlinkTestRunner::DispatchBeforeInstallPromptEvent(
main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms,
&reply);
- callback.Run(reply == blink::WebAppBannerPromptReply::Cancel);
+ callback.Run(reply == blink::mojom::AppBannerPromptReply::CANCEL);
+}
+
+void BlinkTestRunner::ResolveBeforeInstallPromptPromise(
+ int request_id,
+ const std::string& platform) {
+ app_banner_service_->ResolvePromise(request_id, platform);
}
blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder(

Powered by Google App Engine
This is Rietveld 408576698