| 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 <memory> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/macros.h" | 8 #include "base/macros.h" |
| 7 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 8 #include "content/public/test/content_test_suite_base.h" | 10 #include "content/public/test/content_test_suite_base.h" |
| 9 #include "content/public/test/test_launcher.h" | 11 #include "content/public/test/test_launcher.h" |
| 10 #include "headless/lib/browser/headless_browser_impl.h" | 12 #include "headless/lib/browser/headless_browser_impl.h" |
| 11 #include "headless/lib/headless_content_main_delegate.h" | 13 #include "headless/lib/headless_content_main_delegate.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace headless { | 16 namespace headless { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 40 bool AdjustChildProcessCommandLine( | 42 bool AdjustChildProcessCommandLine( |
| 41 base::CommandLine* command_line, | 43 base::CommandLine* command_line, |
| 42 const base::FilePath& temp_data_dir) override { | 44 const base::FilePath& temp_data_dir) override { |
| 43 return true; | 45 return true; |
| 44 } | 46 } |
| 45 | 47 |
| 46 protected: | 48 protected: |
| 47 content::ContentMainDelegate* CreateContentMainDelegate() override { | 49 content::ContentMainDelegate* CreateContentMainDelegate() override { |
| 48 // Use HeadlessBrowserTest::SetBrowserOptions to override these defaults. | 50 // Use HeadlessBrowserTest::SetBrowserOptions to override these defaults. |
| 49 HeadlessBrowser::Options::Builder options_builder; | 51 HeadlessBrowser::Options::Builder options_builder; |
| 50 scoped_ptr<HeadlessBrowserImpl> browser( | 52 std::unique_ptr<HeadlessBrowserImpl> browser( |
| 51 new HeadlessBrowserImplForTest(options_builder.Build())); | 53 new HeadlessBrowserImplForTest(options_builder.Build())); |
| 52 return new HeadlessContentMainDelegate(std::move(browser)); | 54 return new HeadlessContentMainDelegate(std::move(browser)); |
| 53 } | 55 } |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 DISALLOW_COPY_AND_ASSIGN(HeadlessTestLauncherDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(HeadlessTestLauncherDelegate); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace | 61 } // namespace |
| 60 } // namespace headless | 62 } // namespace headless |
| 61 | 63 |
| 62 int main(int argc, char** argv) { | 64 int main(int argc, char** argv) { |
| 63 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 65 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 64 headless::HeadlessTestLauncherDelegate launcher_delegate; | 66 headless::HeadlessTestLauncherDelegate launcher_delegate; |
| 65 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 67 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
| 66 } | 68 } |
| OLD | NEW |