OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 // | 37 // |
38 // Alternatively consumers can subclass this helper and override On*() | 38 // Alternatively consumers can subclass this helper and override On*() |
39 // methods to add their own logic/verification code. | 39 // methods to add their own logic/verification code. |
40 // | 40 // |
41 // See embedded_worker_instance_unittest.cc for example usages. | 41 // See embedded_worker_instance_unittest.cc for example usages. |
42 // | 42 // |
43 class EmbeddedWorkerTestHelper : public IPC::Sender, | 43 class EmbeddedWorkerTestHelper : public IPC::Sender, |
44 public IPC::Listener { | 44 public IPC::Listener { |
45 public: | 45 public: |
46 // Initialize this helper for |context|, and enable this as an IPC | 46 // Initialize this helper for |context|, and enable this as an IPC |
47 // sender for |mock_render_process_id|. | 47 // sender for |mock_render_process_id|. If |user_data_directory| is empty, |
48 explicit EmbeddedWorkerTestHelper(int mock_render_process_id); | 48 // the context makes storage stuff in memory. |
| 49 EmbeddedWorkerTestHelper(const base::FilePath& user_data_directory, |
| 50 int mock_render_process_id); |
49 ~EmbeddedWorkerTestHelper() override; | 51 ~EmbeddedWorkerTestHelper() override; |
50 | 52 |
51 // Call this to simulate add/associate a process to a pattern. | 53 // Call this to simulate add/associate a process to a pattern. |
52 // This also registers this sender for the process. | 54 // This also registers this sender for the process. |
53 void SimulateAddProcessToPattern(const GURL& pattern, int process_id); | 55 void SimulateAddProcessToPattern(const GURL& pattern, int process_id); |
54 | 56 |
55 // IPC::Sender implementation. | 57 // IPC::Sender implementation. |
56 bool Send(IPC::Message* message) override; | 58 bool Send(IPC::Message* message) override; |
57 | 59 |
58 // IPC::Listener implementation. | 60 // IPC::Listener implementation. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 int current_embedded_worker_id_; | 135 int current_embedded_worker_id_; |
134 | 136 |
135 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; | 137 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; |
136 | 138 |
137 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); | 139 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); |
138 }; | 140 }; |
139 | 141 |
140 } // namespace content | 142 } // namespace content |
141 | 143 |
142 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 144 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
OLD | NEW |