mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 928870 - Add test for Android gUM doorhanger. r=gbrown
This commit is contained in:
parent
415c4b7638
commit
2ff01736a9
@ -46,6 +46,7 @@
|
||||
[testDeviceSearchEngine]
|
||||
[testPrivateBrowsing]
|
||||
[testReaderMode]
|
||||
[testGetUserMedia]
|
||||
|
||||
# Used for Talos, please don't use in mochitest
|
||||
#[testPan]
|
||||
|
63
mobile/android/base/tests/robocop_getusermedia.html
Normal file
63
mobile/android/base/tests/robocop_getusermedia.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>gUM Test Page</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
var video_status = false;
|
||||
var video = document.createElement("video");
|
||||
video.setAttribute("width", 640);
|
||||
video.setAttribute("height", 480);
|
||||
|
||||
var audio_status = false;
|
||||
var audio = document.createElement("audio");
|
||||
audio.setAttribute("controls", true);
|
||||
|
||||
startAudioVideo();
|
||||
|
||||
function startAudioVideo() {
|
||||
video_status = true;
|
||||
audio_status = true;
|
||||
startMedia({video:true, audio:true});
|
||||
}
|
||||
|
||||
function stopMedia() {
|
||||
if (video_status) {
|
||||
video.mozSrcObject.stop();
|
||||
video.mozSrcObject = null;
|
||||
content.removeChild(video);
|
||||
capturing = false;
|
||||
video_status = false;
|
||||
}
|
||||
if (audio_status) {
|
||||
audio.mozSrcObject.stop();
|
||||
audio.mozSrcObject = null;
|
||||
content.removeChild(audio);
|
||||
audio_status = false;
|
||||
}
|
||||
}
|
||||
|
||||
function startMedia(param) {
|
||||
try {
|
||||
window.navigator.mozGetUserMedia(param, function(stream) {
|
||||
message.innerHTML = "<p>Success!</p>";
|
||||
if (video_status) {
|
||||
content.appendChild(video);
|
||||
video.mozSrcObject = stream;
|
||||
video.play();
|
||||
}
|
||||
if (audio_status) {
|
||||
content.appendChild(audio);
|
||||
audio.mozSrcObject = stream;
|
||||
audio.play();
|
||||
}
|
||||
}, function(err) {
|
||||
stopMedia();
|
||||
});
|
||||
} catch(e) {
|
||||
stopMedia();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body></html>
|
40
mobile/android/base/tests/testGetUserMedia.java.in
Normal file
40
mobile/android/base/tests/testGetUserMedia.java.in
Normal file
@ -0,0 +1,40 @@
|
||||
#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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user