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

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

Issue 1171173002: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Chromium IPC for Sync from unit tests' 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // worker. By default they just return success via 97 // worker. By default they just return success via
98 // SimulateSendReplyToBrowser. 98 // SimulateSendReplyToBrowser.
99 virtual void OnActivateEvent(int embedded_worker_id, int request_id); 99 virtual void OnActivateEvent(int embedded_worker_id, int request_id);
100 virtual void OnInstallEvent(int embedded_worker_id, int request_id); 100 virtual void OnInstallEvent(int embedded_worker_id, int request_id);
101 virtual void OnFetchEvent(int embedded_worker_id, 101 virtual void OnFetchEvent(int embedded_worker_id,
102 int request_id, 102 int request_id,
103 const ServiceWorkerFetchRequest& request); 103 const ServiceWorkerFetchRequest& request);
104 virtual void OnPushEvent(int embedded_worker_id, 104 virtual void OnPushEvent(int embedded_worker_id,
105 int request_id, 105 int request_id,
106 const std::string& data); 106 const std::string& data);
107 virtual void OnSyncEvent(int embedded_worker_id, int request_id);
108 107
109 // These functions simulate sending an EmbeddedHostMsg message to the 108 // These functions simulate sending an EmbeddedHostMsg message to the
110 // browser. 109 // browser.
111 void SimulatePausedAfterDownload(int embedded_worker_id); 110 void SimulatePausedAfterDownload(int embedded_worker_id);
112 void SimulateWorkerReadyForInspection(int embedded_worker_id); 111 void SimulateWorkerReadyForInspection(int embedded_worker_id);
113 void SimulateWorkerScriptCached(int embedded_worker_id); 112 void SimulateWorkerScriptCached(int embedded_worker_id);
114 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id); 113 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id);
115 void SimulateWorkerScriptEvaluated(int embedded_worker_id); 114 void SimulateWorkerScriptEvaluated(int embedded_worker_id);
116 void SimulateWorkerStarted(int embedded_worker_id); 115 void SimulateWorkerStarted(int embedded_worker_id);
117 void SimulateWorkerStopped(int embedded_worker_id); 116 void SimulateWorkerStopped(int embedded_worker_id);
118 void SimulateSend(IPC::Message* message); 117 void SimulateSend(IPC::Message* message);
119 118
120 EmbeddedWorkerRegistry* registry(); 119 EmbeddedWorkerRegistry* registry();
121 120
122 private: 121 private:
123 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 122 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
124 void OnResumeAfterDownloadStub(int embedded_worker_id); 123 void OnResumeAfterDownloadStub(int embedded_worker_id);
125 void OnStopWorkerStub(int embedded_worker_id); 124 void OnStopWorkerStub(int embedded_worker_id);
126 void OnMessageToWorkerStub(int thread_id, 125 void OnMessageToWorkerStub(int thread_id,
127 int embedded_worker_id, 126 int embedded_worker_id,
128 const IPC::Message& message); 127 const IPC::Message& message);
129 void OnActivateEventStub(int request_id); 128 void OnActivateEventStub(int request_id);
130 void OnInstallEventStub(int request_id); 129 void OnInstallEventStub(int request_id);
131 void OnFetchEventStub(int request_id, 130 void OnFetchEventStub(int request_id,
132 const ServiceWorkerFetchRequest& request); 131 const ServiceWorkerFetchRequest& request);
133 void OnPushEventStub(int request_id, const std::string& data); 132 void OnPushEventStub(int request_id, const std::string& data);
134 void OnSyncEventStub(int request_id);
135 133
136 MessagePortMessageFilter* NewMessagePortMessageFilter(); 134 MessagePortMessageFilter* NewMessagePortMessageFilter();
137 135
138 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; 136 scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
139 137
140 IPC::TestSink sink_; 138 IPC::TestSink sink_;
141 IPC::TestSink inner_sink_; 139 IPC::TestSink inner_sink_;
142 140
143 int next_thread_id_; 141 int next_thread_id_;
144 int mock_render_process_id_; 142 int mock_render_process_id_;
145 143
146 std::map<int, int64> embedded_worker_id_service_worker_version_id_map_; 144 std::map<int, int64> embedded_worker_id_service_worker_version_id_map_;
147 145
148 // Updated each time MessageToWorker message is received. 146 // Updated each time MessageToWorker message is received.
149 int current_embedded_worker_id_; 147 int current_embedded_worker_id_;
150 148
151 std::vector<scoped_refptr<MessagePortMessageFilter>> 149 std::vector<scoped_refptr<MessagePortMessageFilter>>
152 message_port_message_filters_; 150 message_port_message_filters_;
153 151
154 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 152 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
155 153
156 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 154 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
157 }; 155 };
158 156
159 } // namespace content 157 } // namespace content
160 158
161 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 159 #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