1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/macros.h"
7 #include "base/sys_info.h"
8 #include "chromecast/app/cast_main_delegate.h"
9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/content_test_suite_base.h"
11 #include "content/public/test/test_launcher.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace chromecast
{
19 const char kTestTypeBrowser
[] = "browser";
21 class BrowserTestSuite
: public content::ContentTestSuiteBase
{
23 BrowserTestSuite(int argc
, char** argv
)
24 : content::ContentTestSuiteBase(argc
, argv
) {
26 virtual ~BrowserTestSuite() {
30 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite
);
33 class ChromecastTestLauncherDelegate
: public content::TestLauncherDelegate
{
35 ChromecastTestLauncherDelegate() {}
36 virtual ~ChromecastTestLauncherDelegate() {}
38 virtual int RunTestSuite(int argc
, char** argv
) override
{
39 return BrowserTestSuite(argc
, argv
).Run();
42 virtual bool AdjustChildProcessCommandLine(
43 base::CommandLine
* command_line
,
44 const base::FilePath
& temp_data_dir
) override
{
45 // TODO(gunsch): handle temp_data_dir
46 command_line
->AppendSwitchASCII(switches::kTestType
, kTestTypeBrowser
);
51 virtual content::ContentMainDelegate
* CreateContentMainDelegate() override
{
52 return new CastMainDelegate();
56 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate
);
62 } // namespace chromecast
64 int main(int argc
, char** argv
) {
65 int default_jobs
= std::max(1, base::SysInfo::NumberOfProcessors() / 2);
66 chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate
;
67 return LaunchTests(&launcher_delegate
, default_jobs
, argc
, argv
);