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

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: Rebase Created 4 years, 11 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // IPC sink for EmbeddedWorker messages. 71 // IPC sink for EmbeddedWorker messages.
72 IPC::TestSink* ipc_sink() { return &sink_; } 72 IPC::TestSink* ipc_sink() { return &sink_; }
73 // Inner IPC sink for script context messages sent via EmbeddedWorker. 73 // Inner IPC sink for script context messages sent via EmbeddedWorker.
74 IPC::TestSink* inner_ipc_sink() { return &inner_sink_; } 74 IPC::TestSink* inner_ipc_sink() { return &inner_sink_; }
75 75
76 ServiceWorkerContextCore* context(); 76 ServiceWorkerContextCore* context();
77 ServiceWorkerContextWrapper* context_wrapper() { return wrapper_.get(); } 77 ServiceWorkerContextWrapper* context_wrapper() { return wrapper_.get(); }
78 void ShutdownContext(); 78 void ShutdownContext();
79 79
80 int GetNextThreadId() { return next_thread_id_++; }
81
80 int mock_render_process_id() const { return mock_render_process_id_;} 82 int mock_render_process_id() const { return mock_render_process_id_;}
81 MockRenderProcessHost* mock_render_process_host() { 83 MockRenderProcessHost* mock_render_process_host() {
82 return render_process_host_.get(); 84 return render_process_host_.get();
83 } 85 }
84 86
87 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map() {
88 return embedded_worker_id_service_worker_version_id_map_;
89 }
90
85 // Only used for tests that force creating a new render process. There is no 91 // Only used for tests that force creating a new render process. There is no
86 // corresponding MockRenderProcessHost. 92 // corresponding MockRenderProcessHost.
87 int new_render_process_id() const { return mock_render_process_id_ + 1; } 93 int new_render_process_id() const { return mock_render_process_id_ + 1; }
88 94
89 TestBrowserContext* browser_context() { return browser_context_.get(); } 95 TestBrowserContext* browser_context() { return browser_context_.get(); }
90 96
91 protected: 97 protected:
92 // Called when StartWorker, StopWorker and SendMessageToWorker message 98 // Called when StartWorker, StopWorker and SendMessageToWorker message
93 // is sent to the embedded worker. Override if necessary. By default 99 // is sent to the embedded worker. Override if necessary. By default
94 // they verify given parameters and: 100 // they verify given parameters and:
(...skipping 25 matching lines...) Expand all
120 virtual void OnPushEvent(int embedded_worker_id, 126 virtual void OnPushEvent(int embedded_worker_id,
121 int request_id, 127 int request_id,
122 const std::string& data); 128 const std::string& data);
123 129
124 // These functions simulate sending an EmbeddedHostMsg message to the 130 // These functions simulate sending an EmbeddedHostMsg message to the
125 // browser. 131 // browser.
126 void SimulateWorkerReadyForInspection(int embedded_worker_id); 132 void SimulateWorkerReadyForInspection(int embedded_worker_id);
127 void SimulateWorkerScriptCached(int embedded_worker_id); 133 void SimulateWorkerScriptCached(int embedded_worker_id);
128 void SimulateWorkerScriptLoaded(int embedded_worker_id); 134 void SimulateWorkerScriptLoaded(int embedded_worker_id);
129 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id); 135 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id);
130 void SimulateWorkerScriptEvaluated(int embedded_worker_id); 136 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success);
131 void SimulateWorkerStarted(int embedded_worker_id); 137 void SimulateWorkerStarted(int embedded_worker_id);
132 void SimulateWorkerStopped(int embedded_worker_id); 138 void SimulateWorkerStopped(int embedded_worker_id);
133 void SimulateSend(IPC::Message* message); 139 void SimulateSend(IPC::Message* message);
134 140
135 EmbeddedWorkerRegistry* registry(); 141 EmbeddedWorkerRegistry* registry();
136 142
137 private: 143 private:
138 class MockEmbeddedWorkerSetup; 144 class MockEmbeddedWorkerSetup;
139 145
140 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 146 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 message_port_message_filters_; 186 message_port_message_filters_;
181 187
182 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 188 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
183 189
184 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 190 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
185 }; 191 };
186 192
187 } // namespace content 193 } // namespace content
188 194
189 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 195 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698