Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Unified Diff: content/test/browser_test_utils.cc

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/test_utils.h ('k') | content/test/content_browser_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/browser_test_utils.cc
===================================================================
--- content/test/browser_test_utils.cc (revision 147577)
+++ content/test/browser_test_utils.cc (working copy)
@@ -4,56 +4,6 @@
#include "content/public/test/browser_test_utils.h"
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "content/public/test/test_launcher.h"
-
-namespace {
-
-// Number of times to repost a Quit task so that the MessageLoop finishes up
-// pending tasks and tasks posted by those pending tasks without risking the
-// potential hang behavior of MessageLoop::QuitWhenIdle.
-// The criteria for choosing this number: it should be high enough to make the
-// quit act like QuitWhenIdle, while taking into account that any page which is
-// animating may be rendering another frame for each quit deferral. For an
-// animating page, the potential delay to quitting the RunLoop would be
-// kNumQuitDeferrals * frame_render_time. Some perf tests run slow, such as
-// 200ms/frame.
-static const int kNumQuitDeferrals = 10;
-
-static void DeferredQuitRunLoop(const base::Closure& quit_task,
- int num_quit_deferrals) {
- if (num_quit_deferrals <= 0) {
- quit_task.Run();
- } else {
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1));
- }
-}
-
-}
-
namespace content {
-void RunThisRunLoop(base::RunLoop* run_loop) {
- MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
-
- test_launcher::TestLauncherDelegate* delegate =
- test_launcher::GetCurrentTestLauncherDelegate();
- // TODO(jam): the null check shouldn't be needed, since this code should only
- // be called from browser_tests. Unfortunately some unittests are calling this
- // code.
- if (delegate)
- delegate->PreRunMessageLoop(run_loop);
- run_loop->Run();
- if (delegate)
- delegate->PostRunMessageLoop();
-}
-
-base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) {
- return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(),
- kNumQuitDeferrals);
-}
-
} // namespace content
« no previous file with comments | « content/public/test/test_utils.h ('k') | content/test/content_browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698