OLD | NEW |
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/path_service.h" | 7 #include "base/path_service.h" |
7 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
8 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
10 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/media/webrtc_browsertest_base.h" | 13 #include "chrome/browser/media/webrtc_browsertest_base.h" |
13 #include "chrome/browser/media/webrtc_browsertest_common.h" | 14 #include "chrome/browser/media/webrtc_browsertest_common.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 14 matching lines...) Expand all Loading... |
30 " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" | 31 " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" |
31 "third_party/webrtc/webrtc.DEPS\",\n" | 32 "third_party/webrtc/webrtc.DEPS\",\n" |
32 "}"; | 33 "}"; |
33 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; | 34 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; |
34 | 35 |
35 | 36 |
36 // WebRTC-AppRTC integration test. Requires a real webcam and microphone | 37 // WebRTC-AppRTC integration test. Requires a real webcam and microphone |
37 // on the running system. This test is not meant to run in the main browser | 38 // on the running system. This test is not meant to run in the main browser |
38 // test suite since normal tester machines do not have webcams. Chrome will use | 39 // test suite since normal tester machines do not have webcams. Chrome will use |
39 // its fake camera for both tests, but Firefox will use the real webcam in the | 40 // its fake camera for both tests, but Firefox will use the real webcam in the |
40 // Firefox interop test. | 41 // Firefox interop test. Thus, this test must on a machine with a real webcam. |
41 // | 42 // |
42 // This test will bring up a AppRTC instance on localhost and verify that the | 43 // This test will bring up a AppRTC instance on localhost and verify that the |
43 // call gets up when connecting to the same room from two tabs in a browser. | 44 // call gets up when connecting to the same room from two tabs in a browser. |
44 class WebRtcApprtcBrowserTest : public WebRtcTestBase { | 45 class WebRtcApprtcBrowserTest : public WebRtcTestBase { |
45 public: | 46 public: |
46 WebRtcApprtcBrowserTest() | 47 WebRtcApprtcBrowserTest() |
47 : dev_appserver_(base::kNullProcessHandle), | 48 : dev_appserver_(base::kNullProcessHandle), |
48 firefox_(base::kNullProcessHandle) { | 49 firefox_(base::kNullProcessHandle) { |
49 } | 50 } |
50 | 51 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 178 |
178 CommandLine command_line(firefox_launcher); | 179 CommandLine command_line(firefox_launcher); |
179 command_line.AppendSwitchPath("--binary", firefox_binary); | 180 command_line.AppendSwitchPath("--binary", firefox_binary); |
180 command_line.AppendSwitchASCII("--webpage", url.spec()); | 181 command_line.AppendSwitchASCII("--webpage", url.spec()); |
181 | 182 |
182 VLOG(1) << "Running " << command_line.GetCommandLineString(); | 183 VLOG(1) << "Running " << command_line.GetCommandLineString(); |
183 return base::LaunchProcess(command_line, base::LaunchOptions(), | 184 return base::LaunchProcess(command_line, base::LaunchOptions(), |
184 &firefox_); | 185 &firefox_); |
185 } | 186 } |
186 | 187 |
| 188 bool HasWebcamOnSystem() { |
| 189 #if defined(OS_LINUX) |
| 190 // Implementation note: normally we would be able to figure this out with |
| 191 // MediaStreamTrack.getSources, but we can't ask Chrome since it runs in |
| 192 // fake device mode where it will not enumerate webcams on the system. |
| 193 // Therefore, look for /dev/video* entries directly since this test only |
| 194 // runs on Linux for now anyway. |
| 195 base::FileEnumerator dev_video(base::FilePath(FILE_PATH_LITERAL("/dev")), |
| 196 false, base::FileEnumerator::FILES, |
| 197 FILE_PATH_LITERAL("video*")); |
| 198 return !dev_video.Next().empty(); |
| 199 #endif |
| 200 NOTREACHED(); |
| 201 return false; |
| 202 } |
| 203 |
187 private: | 204 private: |
188 base::ProcessHandle dev_appserver_; | 205 base::ProcessHandle dev_appserver_; |
189 base::ProcessHandle firefox_; | 206 base::ProcessHandle firefox_; |
190 }; | 207 }; |
191 | 208 |
192 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { | 209 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { |
193 // TODO(mcasas): Remove Win version filtering when this bug gets fixed: | 210 // TODO(mcasas): Remove Win version filtering when this bug gets fixed: |
194 // http://code.google.com/p/webrtc/issues/detail?id=2703 | 211 // http://code.google.com/p/webrtc/issues/detail?id=2703 |
195 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
196 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 213 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
(...skipping 26 matching lines...) Expand all Loading... |
223 #define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInter
opTest | 240 #define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInter
opTest |
224 #endif | 241 #endif |
225 | 242 |
226 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, | 243 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, |
227 MAYBE_MANUAL_FirefoxApprtcInteropTest) { | 244 MAYBE_MANUAL_FirefoxApprtcInteropTest) { |
228 // Disabled on Win XP: http://code.google.com/p/webrtc/issues/detail?id=2703. | 245 // Disabled on Win XP: http://code.google.com/p/webrtc/issues/detail?id=2703. |
229 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
230 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 247 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
231 return; | 248 return; |
232 #endif | 249 #endif |
| 250 if (!HasWebcamOnSystem()) { |
| 251 LOG(INFO) |
| 252 << "Didn't find a webcam on the system; skipping test since Firefox " |
| 253 << "needs to be able to acquire a webcam."; |
| 254 return; |
| 255 } |
233 | 256 |
234 DetectErrorsInJavaScript(); | 257 DetectErrorsInJavaScript(); |
235 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost()); | 258 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost()); |
236 while (!LocalApprtcInstanceIsUp()) | 259 while (!LocalApprtcInstanceIsUp()) |
237 VLOG(1) << "Waiting for AppRTC to come up..."; | 260 VLOG(1) << "Waiting for AppRTC to come up..."; |
238 | 261 |
239 GURL room_url = GURL(base::StringPrintf("http://localhost:9999?r=room_%d", | 262 GURL room_url = GURL(base::StringPrintf("http://localhost:9999?r=room_%d", |
240 base::RandInt(0, 65536))); | 263 base::RandInt(0, 65536))); |
241 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); | 264 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); |
242 | 265 |
243 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); | 266 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); |
244 | 267 |
245 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); | 268 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); |
246 | 269 |
247 // Ensure Firefox manages to send video our way. | 270 // Ensure Firefox manages to send video our way. |
248 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); | 271 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); |
249 } | 272 } |
OLD | NEW |