Add fallback implementation to reorderSpinners for pre JB MR2.
[chromium-blink-merge.git] / chromecast / browser / test / chromecast_browser_test_runner.cc
blob1eb0c44c1528cfb3992f04167a7dc3a4ab4609ef
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/common/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 // Duplicate switch to avoid dependency on chromecast/internal.
21 const char kSwitchesAVSettingsUnixSocketPath[] = "av-settings-unix-socket-path";
23 const char kAvSettingsUnixSocketPath[] = "/tmp/avsettings";
24 const char kTestTypeBrowser[] = "browser";
26 class BrowserTestSuite : public content::ContentTestSuiteBase {
27 public:
28 BrowserTestSuite(int argc, char** argv)
29 : content::ContentTestSuiteBase(argc, argv) {
31 ~BrowserTestSuite() override {
34 private:
35 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite);
38 class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate {
39 public:
40 ChromecastTestLauncherDelegate() {}
41 ~ChromecastTestLauncherDelegate() override {}
43 int RunTestSuite(int argc, char** argv) override {
44 return BrowserTestSuite(argc, argv).Run();
47 bool AdjustChildProcessCommandLine(
48 base::CommandLine* command_line,
49 const base::FilePath& temp_data_dir) override {
50 // TODO(gunsch): handle temp_data_dir
51 command_line->AppendSwitch(switches::kNoWifi);
52 command_line->AppendSwitchASCII(switches::kTestType, kTestTypeBrowser);
53 command_line->AppendSwitchASCII(kSwitchesAVSettingsUnixSocketPath,
54 kAvSettingsUnixSocketPath);
55 return true;
58 protected:
59 content::ContentMainDelegate* CreateContentMainDelegate() override {
60 return new CastMainDelegate();
63 private:
64 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate);
67 } // namespace
69 } // namespace shell
70 } // namespace chromecast
72 int main(int argc, char** argv) {
73 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
74 chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate;
75 return LaunchTests(&launcher_delegate, default_jobs, argc, argv);