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 "chromecast/base/chromecast_switches.h"
10 #include "content/public/common/content_switches.h"
11 #include "content/public/test/content_test_suite_base.h"
12 #include "content/public/test/test_launcher.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace chromecast
{
20 const char kTestTypeBrowser
[] = "browser";
22 class BrowserTestSuite
: public content::ContentTestSuiteBase
{
24 BrowserTestSuite(int argc
, char** argv
)
25 : content::ContentTestSuiteBase(argc
, argv
) {
27 ~BrowserTestSuite() override
{
31 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite
);
34 class ChromecastTestLauncherDelegate
: public content::TestLauncherDelegate
{
36 ChromecastTestLauncherDelegate() {}
37 ~ChromecastTestLauncherDelegate() override
{}
39 int RunTestSuite(int argc
, char** argv
) override
{
40 return BrowserTestSuite(argc
, argv
).Run();
43 bool AdjustChildProcessCommandLine(
44 base::CommandLine
* command_line
,
45 const base::FilePath
& temp_data_dir
) override
{
46 // TODO(gunsch): handle temp_data_dir
47 command_line
->AppendSwitch(switches::kNoWifi
);
48 command_line
->AppendSwitchASCII(switches::kTestType
, kTestTypeBrowser
);
53 content::ContentMainDelegate
* CreateContentMainDelegate() override
{
54 return new CastMainDelegate();
58 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate
);
64 } // namespace chromecast
66 int main(int argc
, char** argv
) {
67 int default_jobs
= std::max(1, base::SysInfo::NumberOfProcessors() / 2);
68 chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate
;
69 return LaunchTests(&launcher_delegate
, default_jobs
, argc
, argv
);