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

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

Issue 1381153004: Service Worker: Change the criteria for bumping the last update check time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename a member variable; update the comment. Created 5 years 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return render_process_host_.get(); 84 return render_process_host_.get();
85 } 85 }
86 86
87 TestBrowserContext* browser_context() { return browser_context_.get(); } 87 TestBrowserContext* browser_context() { return browser_context_.get(); }
88 88
89 protected: 89 protected:
90 // Called when StartWorker, StopWorker and SendMessageToWorker message 90 // Called when StartWorker, StopWorker and SendMessageToWorker message
91 // is sent to the embedded worker. Override if necessary. By default 91 // is sent to the embedded worker. Override if necessary. By default
92 // they verify given parameters and: 92 // they verify given parameters and:
93 // - OnStartWorker calls SimulateWorkerStarted 93 // - OnStartWorker calls SimulateWorkerStarted
94 // - OnStartWorkerFailed calls SimulateWorkerScriptEvaluated with |success|
95 // false
94 // - OnStopWorker calls SimulateWorkerStoped 96 // - OnStopWorker calls SimulateWorkerStoped
95 // - OnSendMessageToWorker calls the message's respective On*Event handler 97 // - OnSendMessageToWorker calls the message's respective On*Event handler
96 virtual void OnStartWorker(int embedded_worker_id, 98 virtual void OnStartWorker(int embedded_worker_id,
97 int64 service_worker_version_id, 99 int64 service_worker_version_id,
98 const GURL& scope, 100 const GURL& scope,
99 const GURL& script_url); 101 const GURL& script_url);
102 virtual void OnStartWorkerFailed(int embedded_worker_id,
falken 2015/12/17 13:23:43 Sorry to nitpick a bit late in the game... this fu
jungkees 2015/12/23 03:08:58 I'd tried subclassing EmbeddedWorkerTestHelper to
103 int64 service_worker_version_id,
104 const GURL& scope,
105 const GURL& script_url);
100 virtual void OnStopWorker(int embedded_worker_id); 106 virtual void OnStopWorker(int embedded_worker_id);
101 virtual bool OnMessageToWorker(int thread_id, 107 virtual bool OnMessageToWorker(int thread_id,
102 int embedded_worker_id, 108 int embedded_worker_id,
103 const IPC::Message& message); 109 const IPC::Message& message);
104 110
105 // On*Event handlers. Called by the default implementation of 111 // On*Event handlers. Called by the default implementation of
106 // OnMessageToWorker when events are sent to the embedded 112 // OnMessageToWorker when events are sent to the embedded
107 // worker. By default they just return success via 113 // worker. By default they just return success via
108 // SimulateSendReplyToBrowser. 114 // SimulateSendReplyToBrowser.
109 virtual void OnActivateEvent(int embedded_worker_id, int request_id); 115 virtual void OnActivateEvent(int embedded_worker_id, int request_id);
110 virtual void OnInstallEvent(int embedded_worker_id, int request_id); 116 virtual void OnInstallEvent(int embedded_worker_id, int request_id);
111 virtual void OnFetchEvent(int embedded_worker_id, 117 virtual void OnFetchEvent(int embedded_worker_id,
112 int request_id, 118 int request_id,
113 const ServiceWorkerFetchRequest& request); 119 const ServiceWorkerFetchRequest& request);
114 virtual void OnPushEvent(int embedded_worker_id, 120 virtual void OnPushEvent(int embedded_worker_id,
115 int request_id, 121 int request_id,
116 const std::string& data); 122 const std::string& data);
117 123
118 // These functions simulate sending an EmbeddedHostMsg message to the 124 // These functions simulate sending an EmbeddedHostMsg message to the
119 // browser. 125 // browser.
120 void SimulateWorkerReadyForInspection(int embedded_worker_id); 126 void SimulateWorkerReadyForInspection(int embedded_worker_id);
121 void SimulateWorkerScriptCached(int embedded_worker_id); 127 void SimulateWorkerScriptCached(int embedded_worker_id);
122 void SimulateWorkerScriptLoaded(int embedded_worker_id); 128 void SimulateWorkerScriptLoaded(int embedded_worker_id);
123 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id); 129 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id);
124 void SimulateWorkerScriptEvaluated(int embedded_worker_id); 130 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success);
125 void SimulateWorkerStarted(int embedded_worker_id); 131 void SimulateWorkerStarted(int embedded_worker_id);
126 void SimulateWorkerStopped(int embedded_worker_id); 132 void SimulateWorkerStopped(int embedded_worker_id);
127 void SimulateSend(IPC::Message* message); 133 void SimulateSend(IPC::Message* message);
128 134
129 EmbeddedWorkerRegistry* registry(); 135 EmbeddedWorkerRegistry* registry();
130 136
131 private: 137 private:
132 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 138 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
133 void OnStopWorkerStub(int embedded_worker_id); 139 void OnStopWorkerStub(int embedded_worker_id);
134 void OnMessageToWorkerStub(int thread_id, 140 void OnMessageToWorkerStub(int thread_id,
(...skipping 27 matching lines...) Expand all
162 message_port_message_filters_; 168 message_port_message_filters_;
163 169
164 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 170 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
165 171
166 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 172 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
167 }; 173 };
168 174
169 } // namespace content 175 } // namespace content
170 176
171 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 177 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698