gecko/mobile/android/base/tests/testGetUserMedia.java.in
2013-10-22 11:10:17 +02:00

41 lines
1.3 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
import android.hardware.Camera;
import android.os.Build;
import java.lang.reflect.Method;
public class testGetUserMedia extends BaseTest {
@Override
protected int getTestType() {
return TEST_MOCHITEST;
}
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");
}
}
}
}