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

Side by Side Diff: content/browser/service_worker/embedded_worker_test_helper.h

Issue 1220943003: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mek
Patch Set: Addressing post-lgtm review comments Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // worker. By default they just return success via 95 // worker. By default they just return success via
96 // SimulateSendReplyToBrowser. 96 // SimulateSendReplyToBrowser.
97 virtual void OnActivateEvent(int embedded_worker_id, int request_id); 97 virtual void OnActivateEvent(int embedded_worker_id, int request_id);
98 virtual void OnInstallEvent(int embedded_worker_id, int request_id); 98 virtual void OnInstallEvent(int embedded_worker_id, int request_id);
99 virtual void OnFetchEvent(int embedded_worker_id, 99 virtual void OnFetchEvent(int embedded_worker_id,
100 int request_id, 100 int request_id,
101 const ServiceWorkerFetchRequest& request); 101 const ServiceWorkerFetchRequest& request);
102 virtual void OnPushEvent(int embedded_worker_id, 102 virtual void OnPushEvent(int embedded_worker_id,
103 int request_id, 103 int request_id,
104 const std::string& data); 104 const std::string& data);
105 virtual void OnSyncEvent(int embedded_worker_id, int request_id);
106 105
107 // These functions simulate sending an EmbeddedHostMsg message to the 106 // These functions simulate sending an EmbeddedHostMsg message to the
108 // browser. 107 // browser.
109 void SimulateWorkerReadyForInspection(int embedded_worker_id); 108 void SimulateWorkerReadyForInspection(int embedded_worker_id);
110 void SimulateWorkerScriptCached(int embedded_worker_id); 109 void SimulateWorkerScriptCached(int embedded_worker_id);
111 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id); 110 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id);
112 void SimulateWorkerScriptEvaluated(int embedded_worker_id); 111 void SimulateWorkerScriptEvaluated(int embedded_worker_id);
113 void SimulateWorkerStarted(int embedded_worker_id); 112 void SimulateWorkerStarted(int embedded_worker_id);
114 void SimulateWorkerStopped(int embedded_worker_id); 113 void SimulateWorkerStopped(int embedded_worker_id);
115 void SimulateSend(IPC::Message* message); 114 void SimulateSend(IPC::Message* message);
116 115
117 EmbeddedWorkerRegistry* registry(); 116 EmbeddedWorkerRegistry* registry();
118 117
119 private: 118 private:
120 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 119 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
121 void OnStopWorkerStub(int embedded_worker_id); 120 void OnStopWorkerStub(int embedded_worker_id);
122 void OnMessageToWorkerStub(int thread_id, 121 void OnMessageToWorkerStub(int thread_id,
123 int embedded_worker_id, 122 int embedded_worker_id,
124 const IPC::Message& message); 123 const IPC::Message& message);
125 void OnActivateEventStub(int request_id); 124 void OnActivateEventStub(int request_id);
126 void OnInstallEventStub(int request_id); 125 void OnInstallEventStub(int request_id);
127 void OnFetchEventStub(int request_id, 126 void OnFetchEventStub(int request_id,
128 const ServiceWorkerFetchRequest& request); 127 const ServiceWorkerFetchRequest& request);
129 void OnPushEventStub(int request_id, const std::string& data); 128 void OnPushEventStub(int request_id, const std::string& data);
130 void OnSyncEventStub(int request_id);
131 129
132 MessagePortMessageFilter* NewMessagePortMessageFilter(); 130 MessagePortMessageFilter* NewMessagePortMessageFilter();
133 131
134 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; 132 scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
135 133
136 IPC::TestSink sink_; 134 IPC::TestSink sink_;
137 IPC::TestSink inner_sink_; 135 IPC::TestSink inner_sink_;
138 136
139 int next_thread_id_; 137 int next_thread_id_;
140 int mock_render_process_id_; 138 int mock_render_process_id_;
141 139
142 std::map<int, int64> embedded_worker_id_service_worker_version_id_map_; 140 std::map<int, int64> embedded_worker_id_service_worker_version_id_map_;
143 141
144 // Updated each time MessageToWorker message is received. 142 // Updated each time MessageToWorker message is received.
145 int current_embedded_worker_id_; 143 int current_embedded_worker_id_;
146 144
147 std::vector<scoped_refptr<MessagePortMessageFilter>> 145 std::vector<scoped_refptr<MessagePortMessageFilter>>
148 message_port_message_filters_; 146 message_port_message_filters_;
149 147
150 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 148 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
151 149
152 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 150 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
153 }; 151 };
154 152
155 } // namespace content 153 } // namespace content
156 154
157 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 155 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698