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

Unified Diff: content/browser/service_worker/service_worker_test_utils.cc

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Skip unittest for CrossSiteTransfer when PlzNavigate Created 3 years, 7 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/browser/service_worker/service_worker_test_utils.cc
diff --git a/content/browser/service_worker/service_worker_test_utils.cc b/content/browser/service_worker/service_worker_test_utils.cc
index 5b0ee5d90ef780065ca06fa6834471f1be281c7a..4c8f7390b91924cba6bc779d126ad9be89b5cfe6 100644
--- a/content/browser/service_worker/service_worker_test_utils.cc
+++ b/content/browser/service_worker/service_worker_test_utils.cc
@@ -10,14 +10,32 @@
namespace content {
+ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint() {}
+ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint(
+ ServiceWorkerRemoteProviderEndpoint&& other)
+ : host_ptr_(std::move(other.host_ptr_)),
+ client_request_(std::move(other.client_request_)) {}
+
+ServiceWorkerRemoteProviderEndpoint::~ServiceWorkerRemoteProviderEndpoint() {}
+
+void ServiceWorkerRemoteProviderEndpoint::BindWithProviderHostInfo(
+ content::ServiceWorkerProviderHostInfo* info) {
+ mojom::ServiceWorkerProviderAssociatedPtr client_ptr;
+ client_request_ = mojo::MakeIsolatedRequest(&client_ptr);
+ info->client_ptr_info = client_ptr.PassInterface();
+ info->host_request = mojo::MakeIsolatedRequest(&host_ptr_);
+}
+
std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow(
int process_id,
int provider_id,
bool is_parent_frame_secure,
- base::WeakPtr<ServiceWorkerContextCore> context) {
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ ServiceWorkerRemoteProviderEndpoint* output_endpoint) {
ServiceWorkerProviderHostInfo info(provider_id, 1 /* route_id */,
SERVICE_WORKER_PROVIDER_FOR_WINDOW,
is_parent_frame_secure);
+ output_endpoint->BindWithProviderHostInfo(&info);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), nullptr);
}
@@ -27,10 +45,12 @@ CreateProviderHostForServiceWorkerContext(
int process_id,
int provider_id,
bool is_parent_frame_secure,
- base::WeakPtr<ServiceWorkerContextCore> context) {
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ ServiceWorkerRemoteProviderEndpoint* output_endpoint) {
ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE,
SERVICE_WORKER_PROVIDER_FOR_CONTROLLER,
is_parent_frame_secure);
+ output_endpoint->BindWithProviderHostInfo(&info);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), nullptr);
}
@@ -40,9 +60,11 @@ std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost(
int provider_id,
base::WeakPtr<ServiceWorkerContextCore> context,
int route_id,
- ServiceWorkerDispatcherHost* dispatcher_host) {
+ ServiceWorkerDispatcherHost* dispatcher_host,
+ ServiceWorkerRemoteProviderEndpoint* output_endpoint) {
ServiceWorkerProviderHostInfo info(provider_id, route_id,
SERVICE_WORKER_PROVIDER_FOR_WINDOW, true);
+ output_endpoint->BindWithProviderHostInfo(&info);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), dispatcher_host);
}

Powered by Google App Engine
This is Rietveld 408576698