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

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

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Rebased/Fixed unittests when BrowserSideNavigation is enabled 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 e8439101dd33ce12e128c5005ef8c940b7ee76a6..c9f67f26711021fa5b5225a35c04b85ef83d61a6 100644
--- a/content/browser/service_worker/service_worker_test_utils.cc
+++ b/content/browser/service_worker/service_worker_test_utils.cc
@@ -10,14 +10,27 @@
namespace content {
+ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint() {}
+ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint(
+ ServiceWorkerRemoteProviderEndpoint&& other)
+ : host_ptr(std::move(other.host_ptr)),
+ client_request(std::move(other.client_request)) {}
+
+ServiceWorkerRemoteProviderEndpoint::~ServiceWorkerRemoteProviderEndpoint() {}
+
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, MSG_ROUTING_NONE,
SERVICE_WORKER_PROVIDER_FOR_WINDOW,
is_parent_frame_secure);
+ mojom::ServiceWorkerProviderAssociatedPtr client_ptr;
+ output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr);
+ info.client_ptr_info = client_ptr.PassInterface();
+ info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), nullptr);
}
@@ -27,10 +40,15 @@ 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);
+ mojom::ServiceWorkerProviderAssociatedPtr client_ptr;
+ output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr);
+ info.client_ptr_info = client_ptr.PassInterface();
+ info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), nullptr);
}
@@ -40,9 +58,14 @@ 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);
+ mojom::ServiceWorkerProviderAssociatedPtr client_ptr;
+ output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr);
+ info.client_ptr_info = client_ptr.PassInterface();
+ info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr);
return ServiceWorkerProviderHost::Create(process_id, std::move(info),
std::move(context), dispatcher_host);
}

Powered by Google App Engine
This is Rietveld 408576698