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

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

Issue 2678733002: [ServiceWorker] Mojofy ActivateEvent of Service Worker (Closed)
Patch Set: Rebase and address shimazu, falken and peter's comments Created 3 years, 10 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 094032b43407845bae7fa818ea4ebb29e612ca3e..1826c1fe94b650277d8e72045d2f9ce06f5d4b80 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.h
+++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -65,9 +65,11 @@ struct ServiceWorkerFetchRequest;
class EmbeddedWorkerTestHelper : public IPC::Sender,
public IPC::Listener {
public:
+ enum class Event { Activate };
using FetchCallback =
base::Callback<void(ServiceWorkerStatusCode,
base::Time /* dispatch_event_time */)>;
+ const std::vector<Event>& dispatched_events() const { return events_; }
Peter Beverloo 2017/02/14 15:48:13 nit: this should be next to the other getters arou
xiaofengzhang 2017/02/15 01:59:45 Acknowledged.
xiaofengzhang 2017/02/15 06:14:44 Done.
class MockEmbeddedWorkerInstanceClient
: public mojom::EmbeddedWorkerInstanceClient {
@@ -183,7 +185,9 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
// OnMessageToWorker when events are sent to the embedded
// worker. By default they just return success via
// SimulateSendReplyToBrowser.
- virtual void OnActivateEvent(int embedded_worker_id, int request_id);
+ virtual void OnActivateEvent(
+ const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+ callback);
virtual void OnExtendableMessageEvent(
mojom::ExtendableMessageEventPtr event,
const mojom::ServiceWorkerEventDispatcher::
@@ -227,6 +231,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
void SimulateSend(IPC::Message* message);
EmbeddedWorkerRegistry* registry();
+ std::vector<Event> events_;
Peter Beverloo 2017/02/14 15:48:13 This has to be with the other members, probably af
shimazu 2017/02/15 01:29:02 +1 for moving; this should be private.
xiaofengzhang 2017/02/15 01:59:45 Acknowledged.
xiaofengzhang 2017/02/15 02:15:30 sorry, it should be not private, because it will b
shimazu 2017/02/15 02:30:11 Ah, I see. How about protected for |events_| inste
xiaofengzhang 2017/02/15 02:39:30 yeah, here is already protected, do you think ok?
falken 2017/02/15 03:13:24 Technically by the style guide this must be privat
shimazu 2017/02/15 03:14:54 Oops, sorry. Yes, it's good:) nit: could you add
xiaofengzhang 2017/02/15 06:14:44 Done.
private:
class MockServiceWorkerEventDispatcher;
@@ -239,7 +244,9 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
void OnMessageToWorkerStub(int thread_id,
int embedded_worker_id,
const IPC::Message& message);
- void OnActivateEventStub(int request_id);
+ void OnActivateEventStub(
+ const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+ callback);
void OnExtendableMessageEventStub(
mojom::ExtendableMessageEventPtr event,
const mojom::ServiceWorkerEventDispatcher::

Powered by Google App Engine
This is Rietveld 408576698