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..098f117c440b7b73bfd7140c426d8008622ac43e 100644 |
--- a/content/browser/service_worker/embedded_worker_test_helper.h |
+++ b/content/browser/service_worker/embedded_worker_test_helper.h |
@@ -15,10 +15,12 @@ |
#include "base/containers/hash_tables.h" |
#include "base/macros.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/time/time.h" |
#include "ipc/ipc_listener.h" |
#include "ipc/ipc_test_sink.h" |
#include "services/shell/public/interfaces/interface_provider.mojom.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h" |
#include "url/gurl.h" |
class GURL; |
@@ -60,6 +62,10 @@ struct ServiceWorkerFetchRequest; |
class EmbeddedWorkerTestHelper : public IPC::Sender, |
public IPC::Listener { |
public: |
+ using FetchCallback = |
+ base::Callback<void(blink::mojom::ServiceWorkerEventStatus, |
shimazu
2016/09/23 03:26:11
Now we can use EnumTraits<blink::mojom::ServiceWor
horo
2016/09/23 05:57:56
Is it possible to convert 'const Callback<void (::
horo
2016/09/23 09:13:35
Ah, I misunderstood about typemap and EnumTraits.
|
+ 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. |