OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_TEST_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace base { | 28 namespace base { |
29 class Value; | 29 class Value; |
30 class CommandLine; | 30 class CommandLine; |
31 } // namespace base | 31 } // namespace base |
32 | 32 |
33 // A collection of functions designed for use with unit and browser tests. | 33 // A collection of functions designed for use with unit and browser tests. |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 class RenderFrameHost; | 37 class RenderFrameHost; |
| 38 class TestMojoShellContext; |
38 | 39 |
39 // Turns on nestable tasks, runs the message loop, then resets nestable tasks | 40 // Turns on nestable tasks, runs the message loop, then resets nestable tasks |
40 // to what they were originally. Prefer this over MessageLoop::Run for in | 41 // to what they were originally. Prefer this over MessageLoop::Run for in |
41 // process browser tests that need to block until a condition is met. | 42 // process browser tests that need to block until a condition is met. |
42 void RunMessageLoop(); | 43 void RunMessageLoop(); |
43 | 44 |
44 // Variant of RunMessageLoop that takes RunLoop. | 45 // Variant of RunMessageLoop that takes RunLoop. |
45 void RunThisRunLoop(base::RunLoop* run_loop); | 46 void RunThisRunLoop(base::RunLoop* run_loop); |
46 | 47 |
47 // Turns on nestable tasks, runs all pending tasks in the message loop, | 48 // Turns on nestable tasks, runs all pending tasks in the message loop, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 InProcessUtilityThreadHelper(); | 234 InProcessUtilityThreadHelper(); |
234 ~InProcessUtilityThreadHelper() override; | 235 ~InProcessUtilityThreadHelper() override; |
235 | 236 |
236 private: | 237 private: |
237 void BrowserChildProcessHostConnected(const ChildProcessData& data) override; | 238 void BrowserChildProcessHostConnected(const ChildProcessData& data) override; |
238 void BrowserChildProcessHostDisconnected( | 239 void BrowserChildProcessHostDisconnected( |
239 const ChildProcessData& data) override; | 240 const ChildProcessData& data) override; |
240 | 241 |
241 int child_thread_count_; | 242 int child_thread_count_; |
242 scoped_refptr<MessageLoopRunner> runner_; | 243 scoped_refptr<MessageLoopRunner> runner_; |
| 244 std::unique_ptr<TestMojoShellContext> shell_context_; |
243 | 245 |
244 DISALLOW_COPY_AND_ASSIGN(InProcessUtilityThreadHelper); | 246 DISALLOW_COPY_AND_ASSIGN(InProcessUtilityThreadHelper); |
245 }; | 247 }; |
246 | 248 |
247 // This observer keeps track of the last deleted RenderFrame to avoid | 249 // This observer keeps track of the last deleted RenderFrame to avoid |
248 // accessing it and causing use-after-free condition. | 250 // accessing it and causing use-after-free condition. |
249 class RenderFrameDeletedObserver : public WebContentsObserver { | 251 class RenderFrameDeletedObserver : public WebContentsObserver { |
250 public: | 252 public: |
251 RenderFrameDeletedObserver(RenderFrameHost* rfh); | 253 RenderFrameDeletedObserver(RenderFrameHost* rfh); |
252 ~RenderFrameDeletedObserver() override; | 254 ~RenderFrameDeletedObserver() override; |
(...skipping 27 matching lines...) Expand all Loading... |
280 void WebContentsDestroyed() override; | 282 void WebContentsDestroyed() override; |
281 | 283 |
282 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 284 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
283 | 285 |
284 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); | 286 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); |
285 }; | 287 }; |
286 | 288 |
287 } // namespace content | 289 } // namespace content |
288 | 290 |
289 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 291 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
OLD | NEW |