Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: headless/test/headless_test_launcher.cc

Issue 1674263002: headless: Initial headless embedder API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add pak file generation. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/bind.h"
6 #include "base/macros.h"
7 #include "base/sys_info.h"
8 #include "content/public/test/content_test_suite_base.h"
9 #include "content/public/test/test_launcher.h"
10 #include "headless/lib/browser/headless_browser_impl.h"
11 #include "headless/lib/headless_content_main_delegate.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace headless {
15 namespace {
16
17 class HeadlessBrowserImplForTest : public HeadlessBrowserImpl {
18 public:
19 explicit HeadlessBrowserImplForTest(const HeadlessBrowser::Options& options)
20 : HeadlessBrowserImpl(StartCallback(), options) {}
21
22 private:
23 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImplForTest);
24 };
25
26 class HeadlessTestLauncherDelegate : public content::TestLauncherDelegate {
27 public:
28 HeadlessTestLauncherDelegate() {}
29 ~HeadlessTestLauncherDelegate() override {}
30
31 // content::TestLauncherDelegate implementation:
32 int RunTestSuite(int argc, char** argv) override {
33 return base::TestSuite(argc, argv).Run();
34 }
35
36 bool AdjustChildProcessCommandLine(
37 base::CommandLine* command_line,
38 const base::FilePath& temp_data_dir) override {
39 return true;
40 }
41
42 protected:
43 content::ContentMainDelegate* CreateContentMainDelegate() override {
44 // TODO(skyostil): Add a way to test custom options.
45 HeadlessBrowser::Options::Builder options_builder(0, nullptr);
46 scoped_ptr<HeadlessBrowserImpl> browser(
47 new HeadlessBrowserImplForTest(options_builder.Build()));
48 return new HeadlessContentMainDelegate(std::move(browser));
49 }
50
51 private:
52 DISALLOW_COPY_AND_ASSIGN(HeadlessTestLauncherDelegate);
53 };
54
55 } // namespace
56 } // namespace headless
57
58 int main(int argc, char** argv) {
59 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
60 headless::HeadlessTestLauncherDelegate launcher_delegate;
61 return LaunchTests(&launcher_delegate, default_jobs, argc, argv);
62 }
OLDNEW
« headless/public/headless_web_contents.h ('K') | « headless/test/headless_browser_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698