Commit acc53135 authored by gab@chromium.org's avatar gab@chromium.org

Introduce content::TestLauncherDelegate.AdjustDefaultParallelJobs() to allow...

Introduce content::TestLauncherDelegate.AdjustDefaultParallelJobs() to allow us to auto-disable parallelization for Ash browsertests.

BUG=286205

Review URL: https://codereview.chromium.org/132313006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245261 0039d316-1c4b-4281-b951-d872f2087c98
parent 030d4c50
......@@ -20,6 +20,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/chrome_test_suite.h"
#include "chrome/test/base/test_switches.h"
#include "content/public/app/content_main.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_utils.h"
......@@ -119,6 +120,18 @@ class ChromeTestLauncherDelegate : public content::TestLauncherDelegate {
#endif
}
virtual void AdjustDefaultParallelJobs(int* default_jobs) OVERRIDE {
#if defined(OS_WIN) && defined(USE_AURA)
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshBrowserTests)) {
*default_jobs = 1;
fprintf(stdout,
"Disabling test parallelization for --ash-browsertests.\n");
fflush(stdout);
}
#endif // defined(OS_WIN) && defined(USE_AURA)
}
private:
#if !defined(USE_AURA) && defined(TOOLKIT_VIEWS)
std::stack<linked_ptr<views::AcceleratorHandler> > handlers_;
......
......@@ -504,6 +504,9 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
base::MessageLoopForIO message_loop;
// Allow the |launcher_delegate| to modify |default_jobs|.
launcher_delegate->AdjustDefaultParallelJobs(&default_jobs);
WrapperTestLauncherDelegate delegate(launcher_delegate);
base::TestLauncher launcher(&delegate, default_jobs);
bool success = launcher.Run(argc, argv);
......
......@@ -39,6 +39,10 @@ class TestLauncherDelegate {
virtual void PostRunMessageLoop() {}
virtual ContentMainDelegate* CreateContentMainDelegate() = 0;
// Allows a TestLauncherDelegate to adjust the number of |default_jobs| used
// when --test-launcher-jobs isn't specified on the command-line.
virtual void AdjustDefaultParallelJobs(int* default_jobs) {}
protected:
virtual ~TestLauncherDelegate();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment