Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromecast / browser / test / chromecast_browser_test_runner.cc
blobb68b1f395158348c631ec17f0fac453675566a85
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 {
16 namespace shell {
18 namespace {
20 const char kTestTypeBrowser[] = "browser";
22 class BrowserTestSuite : public content::ContentTestSuiteBase {
23 public:
24 BrowserTestSuite(int argc, char** argv)
25 : content::ContentTestSuiteBase(argc, argv) {
27 ~BrowserTestSuite() override {
30 private:
31 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite);
34 class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate {
35 public:
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);
49 return true;
52 protected:
53 content::ContentMainDelegate* CreateContentMainDelegate() override {
54 return new CastMainDelegate();
57 private:
58 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate);
61 } // namespace
63 } // namespace shell
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);