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

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

Issue 139923005: Implement ServiceWorkerVersion::SendMessage() (for dispatching events etc) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 6 years, 10 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 | Annotate | Revision Log
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // they verify given parameters and: 63 // they verify given parameters and:
64 // - call SimulateWorkerStarted for OnStartWorker 64 // - call SimulateWorkerStarted for OnStartWorker
65 // - call SimulateWorkerStoped for OnStopWorker 65 // - call SimulateWorkerStoped for OnStopWorker
66 // - do nothing for OnSendMessageToWorker 66 // - do nothing for OnSendMessageToWorker
67 virtual void OnStartWorker(int embedded_worker_id, 67 virtual void OnStartWorker(int embedded_worker_id,
68 int64 service_worker_version_id, 68 int64 service_worker_version_id,
69 const GURL& script_url); 69 const GURL& script_url);
70 virtual void OnStopWorker(int embedded_worker_id); 70 virtual void OnStopWorker(int embedded_worker_id);
71 virtual void OnSendMessageToWorker(int thread_id, 71 virtual void OnSendMessageToWorker(int thread_id,
72 int embedded_worker_id, 72 int embedded_worker_id,
73 int request_id,
73 const IPC::Message& message); 74 const IPC::Message& message);
74 75
75 // Call this to simulate sending WorkerStarted, WorkerStopped and 76 // Call this to simulate sending WorkerStarted, WorkerStopped and
76 // SendMessageToBrowser to the browser. 77 // SendMessageToBrowser to the browser.
77 void SimulateWorkerStarted(int thread_id, int embedded_worker_id); 78 void SimulateWorkerStarted(int thread_id, int embedded_worker_id);
78 void SimulateWorkerStopped(int embedded_worker_id); 79 void SimulateWorkerStopped(int embedded_worker_id);
79 void SimulateSendMessageToBrowser(int embedded_worker_id, 80 void SimulateSendMessageToBrowser(int embedded_worker_id,
81 int request_id,
80 const IPC::Message& message); 82 const IPC::Message& message);
81 83
82 private: 84 private:
83 void OnStartWorkerStub(int embedded_worker_id, 85 void OnStartWorkerStub(int embedded_worker_id,
84 int64 service_worker_version_id, 86 int64 service_worker_version_id,
85 const GURL& script_url); 87 const GURL& script_url);
86 void OnStopWorkerStub(int embedded_worker_id); 88 void OnStopWorkerStub(int embedded_worker_id);
87 void OnSendMessageToWorkerStub(int thread_id, 89 void OnSendMessageToWorkerStub(int thread_id,
88 int embedded_worker_id, 90 int embedded_worker_id,
91 int request_id,
89 const IPC::Message& message); 92 const IPC::Message& message);
90 93
91 EmbeddedWorkerRegistry* registry(); 94 EmbeddedWorkerRegistry* registry();
92 95
93 base::WeakPtr<ServiceWorkerContextCore> context_; 96 base::WeakPtr<ServiceWorkerContextCore> context_;
94 IPC::TestSink sink_; 97 IPC::TestSink sink_;
95 int next_thread_id_; 98 int next_thread_id_;
96 std::vector<IPC::Message> messages_; 99 std::vector<IPC::Message> messages_;
97 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 100 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
98 101
99 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 102 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
100 }; 103 };
101 104
102 } // namespace content 105 } // namespace content
103 106
104 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 107 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698