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

Unified Diff: content/browser/service_worker/embedded_worker_test_helper.h

Issue 2352173004: Mojoify FetchEvent of Service Worker. (Closed)
Patch Set: Use EnumTraits Created 4 years, 3 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/embedded_worker_test_helper.h
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h
index 88bf11bee43571ba4fb8a2c205c564bd3de553f9..4f10a307301fba8b9f8c266e5efac4677f07f48d 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.h
+++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -15,6 +15,8 @@
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "content/common/service_worker/service_worker_status_code.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_test_sink.h"
#include "services/shell/public/interfaces/interface_provider.mojom.h"
@@ -60,6 +62,10 @@ struct ServiceWorkerFetchRequest;
class EmbeddedWorkerTestHelper : public IPC::Sender,
public IPC::Listener {
public:
+ using FetchCallback =
+ base::Callback<void(ServiceWorkerStatusCode,
+ base::Time /* dispatch_event_time */)>;
+
// If |user_data_directory| is empty, the context makes storage stuff in
// memory.
explicit EmbeddedWorkerTestHelper(const base::FilePath& user_data_directory);
@@ -121,7 +127,8 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
// Called to setup mojo for a new embedded worker. Override to register
// interfaces the worker should expose to the browser.
- virtual void OnSetupMojo(shell::InterfaceRegistry* interface_registry);
+ virtual void OnSetupMojo(int thread_id,
+ shell::InterfaceRegistry* interface_registry);
// On*Event handlers. Called by the default implementation of
// OnMessageToWorker when events are sent to the embedded
@@ -132,8 +139,8 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
virtual void OnInstallEvent(int embedded_worker_id, int request_id);
virtual void OnFetchEvent(int embedded_worker_id,
int response_id,
- int event_finish_id,
- const ServiceWorkerFetchRequest& request);
+ const ServiceWorkerFetchRequest& request,
+ const FetchCallback& callback);
virtual void OnPushEvent(int embedded_worker_id,
int request_id,
const PushEventPayload& payload);
@@ -157,6 +164,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
std::unique_ptr<shell::InterfaceProvider>>;
class MockEmbeddedWorkerSetup;
+ class MockFetchEventDispatcher;
void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
void OnResumeAfterDownloadStub(int embedded_worker_id);
@@ -169,9 +177,10 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
int request_id,
const ServiceWorkerMsg_ExtendableMessageEvent_Params& params);
void OnInstallEventStub(int request_id);
- void OnFetchEventStub(int response_id,
- int event_finish_id,
- const ServiceWorkerFetchRequest& request);
+ void OnFetchEventStub(int thread_id,
+ int response_id,
+ const ServiceWorkerFetchRequest& request,
+ const FetchCallback& callback);
void OnPushEventStub(int request_id, const PushEventPayload& payload);
void OnSetupMojoStub(int thread_id,
shell::mojom::InterfaceProviderRequest services,
@@ -193,6 +202,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
std::unique_ptr<shell::InterfaceRegistry> render_process_interface_registry_;
std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_;
+ std::map<int, int> thread_id_embedded_worker_id_map_;
// Stores the InterfaceRegistry/InterfaceProviders that are associated with
// each individual service worker.
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.cc » ('j') | content/common/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698