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

Unified Diff: chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc

Issue 269813003: Skipping WebRTC Firefox inteop test if there's no webcam on the system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
diff --git a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
index e9a38abaf0817f21ae8f49d0d5a4638c5229700b..e995a9888cc487b13adb526c48931988bc2d94c0 100644
--- a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/files/file_enumerator.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/rand_util.h"
@@ -37,7 +38,7 @@ const char kTitlePageOfAppEngineAdminPage[] = "Instances";
// on the running system. This test is not meant to run in the main browser
// test suite since normal tester machines do not have webcams. Chrome will use
// its fake camera for both tests, but Firefox will use the real webcam in the
-// Firefox interop test.
+// Firefox interop test. Thus, this test must on a machine with a real webcam.
//
// This test will bring up a AppRTC instance on localhost and verify that the
// call gets up when connecting to the same room from two tabs in a browser.
@@ -184,6 +185,22 @@ class WebRtcApprtcBrowserTest : public WebRtcTestBase {
&firefox_);
}
+ bool HasWebcamOnSystem() {
+#if defined(OS_LINUX)
+ // Implementation note: normally we would be able to figure this out with
+ // MediaStreamTrack.getSources, but we can't ask Chrome since it runs in
+ // fake device mode where it will not enumerate webcams on the system.
+ // Therefore, look for /dev/video* entries directly since this test only
+ // runs on Linux for now anyway.
+ base::FileEnumerator dev_video(base::FilePath(FILE_PATH_LITERAL("/dev")),
+ false, base::FileEnumerator::FILES,
+ FILE_PATH_LITERAL("video*"));
+ return !dev_video.Next().empty();
+#endif
+ NOTREACHED();
+ return false;
+ }
+
private:
base::ProcessHandle dev_appserver_;
base::ProcessHandle firefox_;
@@ -230,6 +247,12 @@ IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest,
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return;
#endif
+ if (!HasWebcamOnSystem()) {
+ LOG(INFO)
+ << "Didn't find a webcam on the system; skipping test since Firefox "
+ << "needs to be able to acquire a webcam.";
+ return;
+ }
DetectErrorsInJavaScript();
ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost());
« 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