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

Side by Side Diff: chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/files/file_enumerator.h" 6 #include "base/files/file_enumerator.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/process/launch.h" 8 #include "base/process/launch.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // test suite since normal tester machines do not have webcams. Chrome will use 44 // test suite since normal tester machines do not have webcams. Chrome will use
45 // its fake camera for both tests, but Firefox will use the real webcam in the 45 // its fake camera for both tests, but Firefox will use the real webcam in the
46 // Firefox interop test. Thus, this test must on a machine with a real webcam. 46 // Firefox interop test. Thus, this test must on a machine with a real webcam.
47 // 47 //
48 // This test will bring up a AppRTC instance on localhost and verify that the 48 // This test will bring up a AppRTC instance on localhost and verify that the
49 // call gets up when connecting to the same room from two tabs in a browser. 49 // call gets up when connecting to the same room from two tabs in a browser.
50 class WebRtcApprtcBrowserTest : public WebRtcTestBase { 50 class WebRtcApprtcBrowserTest : public WebRtcTestBase {
51 public: 51 public:
52 WebRtcApprtcBrowserTest() {} 52 WebRtcApprtcBrowserTest() {}
53 53
54 void SetUpCommandLine(CommandLine* command_line) override { 54 void SetUpCommandLine(base::CommandLine* command_line) override {
55 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); 55 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream));
56 56
57 // The video playback will not work without a GPU, so force its use here. 57 // The video playback will not work without a GPU, so force its use here.
58 command_line->AppendSwitch(switches::kUseGpuInTests); 58 command_line->AppendSwitch(switches::kUseGpuInTests);
59 CommandLine::ForCurrentProcess()->AppendSwitch( 59 base::CommandLine::ForCurrentProcess()->AppendSwitch(
60 switches::kUseFakeDeviceForMediaStream); 60 switches::kUseFakeDeviceForMediaStream);
61 } 61 }
62 62
63 void TearDown() override { 63 void TearDown() override {
64 // Kill any processes we may have brought up. Note: this isn't perfect, 64 // Kill any processes we may have brought up. Note: this isn't perfect,
65 // especially if the test hangs or if we're on Windows. 65 // especially if the test hangs or if we're on Windows.
66 LOG(INFO) << "Entering TearDown"; 66 LOG(INFO) << "Entering TearDown";
67 if (dev_appserver_.IsValid()) 67 if (dev_appserver_.IsValid())
68 base::KillProcess(dev_appserver_.Handle(), 0, false); 68 base::KillProcess(dev_appserver_.Handle(), 0, false);
69 if (collider_server_.IsValid()) 69 if (collider_server_.IsValid())
(...skipping 15 matching lines...) Expand all
85 } 85 }
86 86
87 base::FilePath apprtc_dir = 87 base::FilePath apprtc_dir =
88 GetSourceDir().Append(FILE_PATH_LITERAL("out/apprtc")); 88 GetSourceDir().Append(FILE_PATH_LITERAL("out/apprtc"));
89 if (!base::PathExists(apprtc_dir)) { 89 if (!base::PathExists(apprtc_dir)) {
90 LOG(ERROR) << "Missing AppRTC code at " << 90 LOG(ERROR) << "Missing AppRTC code at " <<
91 apprtc_dir.value() << ". " << kAdviseOnGclientSolution; 91 apprtc_dir.value() << ". " << kAdviseOnGclientSolution;
92 return false; 92 return false;
93 } 93 }
94 94
95 CommandLine command_line(CommandLine::NO_PROGRAM); 95 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
96 EXPECT_TRUE(GetPythonCommand(&command_line)); 96 EXPECT_TRUE(GetPythonCommand(&command_line));
97 97
98 command_line.AppendArgPath(appengine_dev_appserver); 98 command_line.AppendArgPath(appengine_dev_appserver);
99 command_line.AppendArgPath(apprtc_dir); 99 command_line.AppendArgPath(apprtc_dir);
100 command_line.AppendArg("--port=" + port); 100 command_line.AppendArg("--port=" + port);
101 command_line.AppendArg("--admin_port=9998"); 101 command_line.AppendArg("--admin_port=9998");
102 command_line.AppendArg("--skip_sdk_update_check"); 102 command_line.AppendArg("--skip_sdk_update_check");
103 command_line.AppendArg("--clear_datastore=yes"); 103 command_line.AppendArg("--clear_datastore=yes");
104 104
105 DVLOG(1) << "Running " << command_line.GetCommandLineString(); 105 DVLOG(1) << "Running " << command_line.GetCommandLineString();
(...skipping 11 matching lines...) Expand all
117 #else 117 #else
118 base::FilePath collider_server = GetSourceDir().Append( 118 base::FilePath collider_server = GetSourceDir().Append(
119 FILE_PATH_LITERAL("out/go-workspace/bin/collidermain")); 119 FILE_PATH_LITERAL("out/go-workspace/bin/collidermain"));
120 #endif 120 #endif
121 if (!base::PathExists(collider_server)) { 121 if (!base::PathExists(collider_server)) {
122 LOG(ERROR) << "Missing Collider server binary at " << 122 LOG(ERROR) << "Missing Collider server binary at " <<
123 collider_server.value() << ". " << kAdviseOnGclientSolution; 123 collider_server.value() << ". " << kAdviseOnGclientSolution;
124 return false; 124 return false;
125 } 125 }
126 126
127 CommandLine command_line(collider_server); 127 base::CommandLine command_line(collider_server);
128 128
129 command_line.AppendArg("-tls=false"); 129 command_line.AppendArg("-tls=false");
130 command_line.AppendArg("-port=" + collider_port); 130 command_line.AppendArg("-port=" + collider_port);
131 command_line.AppendArg("-room-server=" + apprtc_url); 131 command_line.AppendArg("-room-server=" + apprtc_url);
132 132
133 DVLOG(1) << "Running " << command_line.GetCommandLineString(); 133 DVLOG(1) << "Running " << command_line.GetCommandLineString();
134 collider_server_ = base::LaunchProcess(command_line, base::LaunchOptions()); 134 collider_server_ = base::LaunchProcess(command_line, base::LaunchOptions());
135 return collider_server_.IsValid(); 135 return collider_server_.IsValid();
136 } 136 }
137 137
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 base::FilePath firefox_launcher = 213 base::FilePath firefox_launcher =
214 GetSourceDir().Append( 214 GetSourceDir().Append(
215 FILE_PATH_LITERAL("../webrtc.DEPS/run_firefox_webrtc.py")); 215 FILE_PATH_LITERAL("../webrtc.DEPS/run_firefox_webrtc.py"));
216 if (!base::PathExists(firefox_launcher)) { 216 if (!base::PathExists(firefox_launcher)) {
217 LOG(ERROR) << "Missing firefox launcher at " << 217 LOG(ERROR) << "Missing firefox launcher at " <<
218 firefox_launcher.value() << ". " << kAdviseOnGclientSolution; 218 firefox_launcher.value() << ". " << kAdviseOnGclientSolution;
219 return false; 219 return false;
220 } 220 }
221 221
222 CommandLine command_line(firefox_launcher); 222 base::CommandLine command_line(firefox_launcher);
223 command_line.AppendSwitchPath("--binary", firefox_binary); 223 command_line.AppendSwitchPath("--binary", firefox_binary);
224 command_line.AppendSwitchASCII("--webpage", url.spec()); 224 command_line.AppendSwitchASCII("--webpage", url.spec());
225 225
226 DVLOG(1) << "Running " << command_line.GetCommandLineString(); 226 DVLOG(1) << "Running " << command_line.GetCommandLineString();
227 firefox_ = base::LaunchProcess(command_line, base::LaunchOptions()); 227 firefox_ = base::LaunchProcess(command_line, base::LaunchOptions());
228 return firefox_.IsValid(); 228 return firefox_.IsValid();
229 } 229 }
230 230
231 private: 231 private:
232 base::Process dev_appserver_; 232 base::Process dev_appserver_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 "&firefox_fake_device=1"); 293 "&firefox_fake_device=1");
294 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); 294 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url);
295 295
296 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); 296 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url));
297 297
298 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); 298 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab));
299 299
300 // Ensure Firefox manages to send video our way. 300 // Ensure Firefox manages to send video our way.
301 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); 301 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab));
302 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698