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

Unified Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Rebase 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..ee2a33a100df40f65966dc43dd6764ddbb333fbe 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"
@@ -690,11 +691,12 @@ cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() {
}
void BlinkTestRunner::DispatchBeforeInstallPromptEvent(
- int request_id,
const std::vector<std::string>& event_platforms,
const base::Callback<void(bool)>& callback) {
+ app_banner_service_.reset(new test_runner::AppBannerService());
+
// 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));
@@ -702,10 +704,19 @@ void BlinkTestRunner::DispatchBeforeInstallPromptEvent(
WebLocalFrame* main_frame =
render_view()->GetWebView()->mainFrame()->toWebLocalFrame();
- main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms,
- &reply);
+ main_frame->willShowInstallBannerPrompt(
+ app_banner_service_->GetServiceHandle(),
+ app_banner_service_->GetEventHandle(), blink_event_platforms, &reply);
+
+ callback.Run(reply == blink::mojom::AppBannerPromptReply::CANCEL);
+}
- callback.Run(reply == blink::WebAppBannerPromptReply::Cancel);
+void BlinkTestRunner::ResolveBeforeInstallPromptPromise(
+ const std::string& platform) {
+ if (app_banner_service_) {
+ app_banner_service_->ResolvePromise(platform);
+ app_banner_service_.reset(nullptr);
+ }
}
blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder(

Powered by Google App Engine
This is Rietveld 408576698