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

Side by Side Diff: chromecast/browser/test/chromecast_browser_test_runner.cc

Issue 942943003: Chromecast: adds internal flags necessary for browser test runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 #include "chromecast/app/cast_main_delegate.h" 8 #include "chromecast/app/cast_main_delegate.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/public/test/content_test_suite_base.h" 10 #include "content/public/test/content_test_suite_base.h"
11 #include "content/public/test/test_launcher.h" 11 #include "content/public/test/test_launcher.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace chromecast { 14 namespace chromecast {
15 namespace shell { 15 namespace shell {
16 16
17 namespace { 17 namespace {
18 18
19 // Duplicate settings to avoid link dependency on chromecast/internal.
20 const char kSwitchesAVSettingsUnixSocketPath[] = "av-settings-unix-socket-path";
21 const char kSwitchesNoWifi[] = "no-wifi";
22
23 const char kAvSettingsUnixSocketPath[] = "/tmp/avsettings";
19 const char kTestTypeBrowser[] = "browser"; 24 const char kTestTypeBrowser[] = "browser";
20 25
21 class BrowserTestSuite : public content::ContentTestSuiteBase { 26 class BrowserTestSuite : public content::ContentTestSuiteBase {
22 public: 27 public:
23 BrowserTestSuite(int argc, char** argv) 28 BrowserTestSuite(int argc, char** argv)
24 : content::ContentTestSuiteBase(argc, argv) { 29 : content::ContentTestSuiteBase(argc, argv) {
25 } 30 }
26 ~BrowserTestSuite() override { 31 ~BrowserTestSuite() override {
27 } 32 }
28 33
29 private: 34 private:
30 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite); 35 DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite);
31 }; 36 };
32 37
33 class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate { 38 class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate {
34 public: 39 public:
35 ChromecastTestLauncherDelegate() {} 40 ChromecastTestLauncherDelegate() {}
36 ~ChromecastTestLauncherDelegate() override {} 41 ~ChromecastTestLauncherDelegate() override {}
37 42
38 int RunTestSuite(int argc, char** argv) override { 43 int RunTestSuite(int argc, char** argv) override {
39 return BrowserTestSuite(argc, argv).Run(); 44 return BrowserTestSuite(argc, argv).Run();
40 } 45 }
41 46
42 bool AdjustChildProcessCommandLine( 47 bool AdjustChildProcessCommandLine(
43 base::CommandLine* command_line, 48 base::CommandLine* command_line,
44 const base::FilePath& temp_data_dir) override { 49 const base::FilePath& temp_data_dir) override {
45 // TODO(gunsch): handle temp_data_dir 50 // TODO(gunsch): handle temp_data_dir
51 command_line->AppendSwitch(kSwitchesNoWifi);
46 command_line->AppendSwitchASCII(switches::kTestType, kTestTypeBrowser); 52 command_line->AppendSwitchASCII(switches::kTestType, kTestTypeBrowser);
53 command_line->AppendSwitchASCII(kSwitchesAVSettingsUnixSocketPath,
54 kAvSettingsUnixSocketPath);
47 return true; 55 return true;
48 } 56 }
49 57
50 protected: 58 protected:
51 content::ContentMainDelegate* CreateContentMainDelegate() override { 59 content::ContentMainDelegate* CreateContentMainDelegate() override {
52 return new CastMainDelegate(); 60 return new CastMainDelegate();
53 } 61 }
54 62
55 private: 63 private:
56 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate); 64 DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate);
57 }; 65 };
58 66
59 } // namespace 67 } // namespace
60 68
61 } // namespace shell 69 } // namespace shell
62 } // namespace chromecast 70 } // namespace chromecast
63 71
64 int main(int argc, char** argv) { 72 int main(int argc, char** argv) {
65 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); 73 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
66 chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate; 74 chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate;
67 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); 75 return LaunchTests(&launcher_delegate, default_jobs, argc, argv);
68 } 76 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698