diff -r 000000000000 -r 6474c204b198 mobile/android/base/tests/testGetUserMedia.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mobile/android/base/tests/testGetUserMedia.java Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,30 @@ +package org.mozilla.gecko.tests; + +import android.hardware.Camera; +import android.os.Build; + +public class testGetUserMedia extends BaseTest { + public void testGetUserMedia() { + String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); + + String GUM_MESSAGE = "Would you like to share your camera and microphone with"; + String GUM_ALLOW = "Share"; + String GUM_DENY = "Don't share"; + + blockForGeckoReady(); + + // Only try GUM test if the device has a camera. If there's a working Camera, + // we'll assume there is a working audio device as well. + // getNumberOfCameras is Gingerbread/9+ + // We could avoid that requirement by trying to open a Camera but we + // already know our 2.2/Tegra test devices don't have them. + if (Build.VERSION.SDK_INT >= 9) { + if (Camera.getNumberOfCameras() > 0) { + // Test GUM notification + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); + } + } + } +}