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 class TestServiceManagerContext; |
39 | 39 |
40 // 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 |
41 // 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 |
42 // 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. |
43 void RunMessageLoop(); | 43 void RunMessageLoop(); |
44 | 44 |
45 // Variant of RunMessageLoop that takes RunLoop. | 45 // Variant of RunMessageLoop that takes RunLoop. |
46 void RunThisRunLoop(base::RunLoop* run_loop); | 46 void RunThisRunLoop(base::RunLoop* run_loop); |
47 | 47 |
48 // 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... |
234 InProcessUtilityThreadHelper(); | 234 InProcessUtilityThreadHelper(); |
235 ~InProcessUtilityThreadHelper() override; | 235 ~InProcessUtilityThreadHelper() override; |
236 | 236 |
237 private: | 237 private: |
238 void BrowserChildProcessHostConnected(const ChildProcessData& data) override; | 238 void BrowserChildProcessHostConnected(const ChildProcessData& data) override; |
239 void BrowserChildProcessHostDisconnected( | 239 void BrowserChildProcessHostDisconnected( |
240 const ChildProcessData& data) override; | 240 const ChildProcessData& data) override; |
241 | 241 |
242 int child_thread_count_; | 242 int child_thread_count_; |
243 scoped_refptr<MessageLoopRunner> runner_; | 243 scoped_refptr<MessageLoopRunner> runner_; |
244 std::unique_ptr<TestMojoShellContext> shell_context_; | 244 std::unique_ptr<TestServiceManagerContext> shell_context_; |
245 | 245 |
246 DISALLOW_COPY_AND_ASSIGN(InProcessUtilityThreadHelper); | 246 DISALLOW_COPY_AND_ASSIGN(InProcessUtilityThreadHelper); |
247 }; | 247 }; |
248 | 248 |
249 // This observer keeps track of the last deleted RenderFrame to avoid | 249 // This observer keeps track of the last deleted RenderFrame to avoid |
250 // accessing it and causing use-after-free condition. | 250 // accessing it and causing use-after-free condition. |
251 class RenderFrameDeletedObserver : public WebContentsObserver { | 251 class RenderFrameDeletedObserver : public WebContentsObserver { |
252 public: | 252 public: |
253 RenderFrameDeletedObserver(RenderFrameHost* rfh); | 253 RenderFrameDeletedObserver(RenderFrameHost* rfh); |
254 ~RenderFrameDeletedObserver() override; | 254 ~RenderFrameDeletedObserver() override; |
(...skipping 27 matching lines...) Expand all Loading... |
282 void WebContentsDestroyed() override; | 282 void WebContentsDestroyed() override; |
283 | 283 |
284 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 284 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
285 | 285 |
286 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); | 286 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); |
287 }; | 287 }; |
288 | 288 |
289 } // namespace content | 289 } // namespace content |
290 | 290 |
291 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 291 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
OLD | NEW |