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

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

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Add TODO 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 577d6ad87b87e990cb20eb158fc2b8f7658e7cb1..f888fd8692c64334427f7c12700a81fad4056314 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"
@@ -59,6 +60,7 @@
#include "net/base/filename_util.h"
#include "net/base/net_errors.h"
#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/platform/FilePathConversion.h"
#include "third_party/WebKit/public/platform/Platform.h"
@@ -75,7 +77,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"
@@ -706,22 +708,24 @@ cc::SharedBitmapManager* BlinkTestRunner::GetSharedBitmapManager() {
}
void BlinkTestRunner::DispatchBeforeInstallPromptEvent(
- int request_id,
const std::vector<std::string>& event_platforms,
const base::Callback<void(bool)>& callback) {
- // Send the event to the frame.
- blink::WebAppBannerPromptReply reply;
- std::vector<blink::WebString> blink_web_strings;
- for (const auto& platform : event_platforms)
- blink_web_strings.push_back(blink::WebString::fromUTF8(platform));
- blink::WebVector<blink::WebString> blink_event_platforms(blink_web_strings);
-
- WebLocalFrame* main_frame =
- render_view()->GetWebView()->mainFrame()->toWebLocalFrame();
- main_frame->willShowInstallBannerPrompt(request_id, blink_event_platforms,
- &reply);
-
- callback.Run(reply == blink::WebAppBannerPromptReply::Cancel);
+ app_banner_service_.reset(new test_runner::AppBannerService());
+
+ service_manager::InterfaceRegistry::TestApi test_api(
+ render_view()->GetMainRenderFrame()->GetInterfaceRegistry());
+ test_api.GetLocalInterface(
+ mojo::GetProxy(&app_banner_service_->controller()));
+
+ app_banner_service_->SendBannerPromptRequest(event_platforms, callback);
+}
+
+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