| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 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" |
| 14 |
| 15 namespace chromecast { |
| 16 namespace shell { |
| 17 |
| 18 namespace { |
| 19 |
| 20 const char kTestTypeBrowser[] = "browser"; |
| 21 |
| 22 class BrowserTestSuite : public content::ContentTestSuiteBase { |
| 23 public: |
| 24 BrowserTestSuite(int argc, char** argv) |
| 25 : content::ContentTestSuiteBase(argc, argv) { |
| 26 } |
| 27 ~BrowserTestSuite() override { |
| 28 } |
| 29 |
| 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite); |
| 32 }; |
| 33 |
| 34 class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate { |
| 35 public: |
| 36 ChromecastTestLauncherDelegate() {} |
| 37 ~ChromecastTestLauncherDelegate() override {} |
| 38 |
| 39 int RunTestSuite(int argc, char** argv) override { |
| 40 return BrowserTestSuite(argc, argv).Run(); |
| 41 } |
| 42 |
| 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; |
| 50 } |
| 51 |
| 52 protected: |
| 53 content::ContentMainDelegate* CreateContentMainDelegate() override { |
| 54 return new CastMainDelegate(); |
| 55 } |
| 56 |
| 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate); |
| 59 }; |
| 60 |
| 61 } // namespace |
| 62 |
| 63 } // namespace shell |
| 64 } // namespace chromecast |
| 65 |
| 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); |
| 70 } |
| OLD | NEW |