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

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

Issue 1135743002: Check the size of ResourceRecords in ServiceWorkerDatabase::ReadRegistration() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added check logic in ServiceWorkerStorage and updated tests. Created 5 years, 7 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 <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 virtual void OnActivateEvent(int embedded_worker_id, int request_id); 96 virtual void OnActivateEvent(int embedded_worker_id, int request_id);
97 virtual void OnInstallEvent(int embedded_worker_id, int request_id); 97 virtual void OnInstallEvent(int embedded_worker_id, int request_id);
98 virtual void OnFetchEvent(int embedded_worker_id, 98 virtual void OnFetchEvent(int embedded_worker_id,
99 int request_id, 99 int request_id,
100 const ServiceWorkerFetchRequest& request); 100 const ServiceWorkerFetchRequest& request);
101 101
102 // These functions simulate sending an EmbeddedHostMsg message to the 102 // These functions simulate sending an EmbeddedHostMsg message to the
103 // browser. 103 // browser.
104 void SimulatePausedAfterDownload(int embedded_worker_id); 104 void SimulatePausedAfterDownload(int embedded_worker_id);
105 void SimulateWorkerReadyForInspection(int embedded_worker_id); 105 void SimulateWorkerReadyForInspection(int embedded_worker_id);
106 void SimulateLoadWorkerMainScript(int embedded_worker_id);
nhiroki 2015/05/11 05:46:04 nit: Can we make this function name consistent wit
horo 2015/05/11 07:41:30 Done.
106 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id); 107 void SimulateWorkerScriptLoaded(int thread_id, int embedded_worker_id);
107 void SimulateWorkerScriptEvaluated(int embedded_worker_id); 108 void SimulateWorkerScriptEvaluated(int embedded_worker_id);
108 void SimulateWorkerStarted(int embedded_worker_id); 109 void SimulateWorkerStarted(int embedded_worker_id);
109 void SimulateWorkerStopped(int embedded_worker_id); 110 void SimulateWorkerStopped(int embedded_worker_id);
110 void SimulateSend(IPC::Message* message); 111 void SimulateSend(IPC::Message* message);
111 112
112 EmbeddedWorkerRegistry* registry(); 113 EmbeddedWorkerRegistry* registry();
113 114
114 private: 115 private:
115 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 116 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
116 void OnResumeAfterDownloadStub(int embedded_worker_id); 117 void OnResumeAfterDownloadStub(int embedded_worker_id);
117 void OnStopWorkerStub(int embedded_worker_id); 118 void OnStopWorkerStub(int embedded_worker_id);
118 void OnMessageToWorkerStub(int thread_id, 119 void OnMessageToWorkerStub(int thread_id,
119 int embedded_worker_id, 120 int embedded_worker_id,
120 const IPC::Message& message); 121 const IPC::Message& message);
121 void OnActivateEventStub(int request_id); 122 void OnActivateEventStub(int request_id);
122 void OnInstallEventStub(int request_id); 123 void OnInstallEventStub(int request_id);
123 void OnFetchEventStub(int request_id, 124 void OnFetchEventStub(int request_id,
124 const ServiceWorkerFetchRequest& request); 125 const ServiceWorkerFetchRequest& request);
125 126
126 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; 127 scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
127 128
128 IPC::TestSink sink_; 129 IPC::TestSink sink_;
129 IPC::TestSink inner_sink_; 130 IPC::TestSink inner_sink_;
130 131
131 int next_thread_id_; 132 int next_thread_id_;
132 int mock_render_process_id_; 133 int mock_render_process_id_;
133 134
135 std::map<int, int64> embedded_worker_id_service_worker_version_id_map_;
136
134 // Updated each time MessageToWorker message is received. 137 // Updated each time MessageToWorker message is received.
135 int current_embedded_worker_id_; 138 int current_embedded_worker_id_;
136 139
137 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 140 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
138 141
139 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 142 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
140 }; 143 };
141 144
142 } // namespace content 145 } // namespace content
143 146
144 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 147 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698