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