| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
| 7 #include "base/test/test_suite.h" | 7 #include "base/test/test_suite.h" |
| 8 #include "chromecast/app/cast_main_delegate.h" | 8 #include "chromecast/app/cast_main_delegate.h" |
| 9 #include "chromecast/base/cast_paths.h" | 9 #include "chromecast/base/cast_paths.h" |
| 10 #include "content/public/test/test_launcher.h" | 10 #include "content/public/test/test_launcher.h" |
| 11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
| 12 #include "mojo/edk/embedder/embedder.h" | |
| 13 | 12 |
| 14 namespace chromecast { | 13 namespace chromecast { |
| 15 namespace shell { | 14 namespace shell { |
| 16 | 15 |
| 17 class CastTestLauncherDelegate : public content::TestLauncherDelegate { | 16 class CastTestLauncherDelegate : public content::TestLauncherDelegate { |
| 18 public: | 17 public: |
| 19 CastTestLauncherDelegate() {} | 18 CastTestLauncherDelegate() {} |
| 20 ~CastTestLauncherDelegate() override {} | 19 ~CastTestLauncherDelegate() override {} |
| 21 | 20 |
| 22 int RunTestSuite(int argc, char** argv) override { | 21 int RunTestSuite(int argc, char** argv) override { |
| 23 return base::TestSuite(argc, argv).Run(); | 22 return base::TestSuite(argc, argv).Run(); |
| 24 } | 23 } |
| 25 | 24 |
| 26 bool AdjustChildProcessCommandLine( | 25 bool AdjustChildProcessCommandLine( |
| 27 base::CommandLine* command_line, | 26 base::CommandLine* command_line, |
| 28 const base::FilePath& temp_data_dir) override { | 27 const base::FilePath& temp_data_dir) override { |
| 29 return true; | 28 return true; |
| 30 } | 29 } |
| 31 | 30 |
| 32 protected: | 31 protected: |
| 33 content::ContentMainDelegate* CreateContentMainDelegate() override { | 32 content::ContentMainDelegate* CreateContentMainDelegate() override { |
| 34 return new CastMainDelegate(); | 33 return new CastMainDelegate(); |
| 35 } | 34 } |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(CastTestLauncherDelegate); | 37 DISALLOW_COPY_AND_ASSIGN(CastTestLauncherDelegate); |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 } // namespace shell | 40 int LaunchTests(int argc, char* argv[]) { |
| 42 } // namespace chromecast | |
| 43 | |
| 44 int main(int argc, char** argv) { | |
| 45 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 41 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 46 chromecast::shell::CastTestLauncherDelegate launcher_delegate; | 42 chromecast::shell::CastTestLauncherDelegate launcher_delegate; |
| 47 chromecast::RegisterPathProvider(); | 43 chromecast::RegisterPathProvider(); |
| 48 mojo::edk::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize); | |
| 49 mojo::edk::Init(); | |
| 50 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 44 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
| 51 } | 45 } |
| 46 |
| 47 } // namespace shell |
| 48 } // namespace chromecast |
| OLD | NEW |