Index: content/browser/service_worker/embedded_worker_test_helper.h |
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h |
index af95f675fb02ca4943e834c06894c4b4a75b8ee8..27a04165450a2a2a9b65ac2e39a70b16423f5479 100644 |
--- a/content/browser/service_worker/embedded_worker_test_helper.h |
+++ b/content/browser/service_worker/embedded_worker_test_helper.h |
@@ -21,12 +21,14 @@ namespace content { |
class EmbeddedWorkerRegistry; |
class EmbeddedWorkerTestHelper; |
class ServiceWorkerContextCore; |
+class ServiceWorkerContextWrapper; |
struct ServiceWorkerFetchRequest; |
// In-Process EmbeddedWorker test helper. |
// |
-// Usage: create an instance of this class for a ServiceWorkerContextCore |
-// to test browser-side embedded worker code without creating a child process. |
+// Usage: create an instance of this class to test browser-side embedded worker |
+// code without creating a child process. This class will create a |
+// ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. |
// |
// By default this class just notifies back WorkerStarted and WorkerStopped |
// for StartWorker and StopWorker requests. The default implementation |
@@ -42,8 +44,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
public: |
// Initialize this helper for |context|, and enable this as an IPC |
// sender for |mock_render_process_id|. |
- EmbeddedWorkerTestHelper(ServiceWorkerContextCore* context, |
- int mock_render_process_id); |
+ EmbeddedWorkerTestHelper(int mock_render_process_id); |
virtual ~EmbeddedWorkerTestHelper(); |
// Call this to simulate add/associate a process to a worker. |
@@ -61,6 +62,10 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
// Inner IPC sink for script context messages sent via EmbeddedWorker. |
IPC::TestSink* inner_ipc_sink() { return &inner_sink_; } |
+ ServiceWorkerContextCore* context(); |
+ ServiceWorkerContextWrapper* context_wrapper() { return wrapper_.get(); } |
+ void ShutdownContext(); |
+ |
protected: |
// Called when StartWorker, StopWorker and SendMessageToWorker message |
// is sent to the embedded worker. Override if necessary. By default |
@@ -112,7 +117,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
void OnFetchEventStub(int request_id, |
const ServiceWorkerFetchRequest& request); |
- base::WeakPtr<ServiceWorkerContextCore> context_; |
+ scoped_refptr<ServiceWorkerContextWrapper> wrapper_; |
IPC::TestSink sink_; |
IPC::TestSink inner_sink_; |