Bug 1018928 - Expand Android gUM + gUM Doorhanger tests. r=mfinkle

This commit is contained in:
Gian-Carlo Pascutto 2014-07-01 15:38:03 +02:00
parent 9facd7f08b
commit c28ed9273b
3 changed files with 64 additions and 11 deletions

View File

@ -40,6 +40,8 @@ skip-if = android_version == "10"
skip-if = processor == "x86"
[testFormHistory]
[testGetUserMedia]
# disabled on 2.3; see bug 981881]
skip-if = android_version == "10"
# [testHistory] # see bug 915350
[testHomeBanner]
# disabled on x86 only; bug 957185

View File

@ -4,6 +4,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="utf-8">
</head>
<body>
<div id="content"></div>
<script type="application/javascript">
var video_status = false;
var video = document.createElement("video");
@ -14,6 +15,9 @@
var audio = document.createElement("audio");
audio.setAttribute("controls", true);
var content = document.getElementById("content");
document.title = "gUM Test Page";
startAudioVideo();
function startAudioVideo() {
@ -41,7 +45,6 @@
function startMedia(param) {
try {
window.navigator.mozGetUserMedia(param, function(stream) {
message.innerHTML = "<p>Success!</p>";
if (video_status) {
content.appendChild(video);
video.mozSrcObject = stream;
@ -52,7 +55,18 @@
audio.mozSrcObject = stream;
audio.play();
}
var audioTracks = stream.getAudioTracks();
var videoTracks = stream.getVideoTracks();
document.title = "";
if (audioTracks.length > 0) {
document.title += "audio";
}
if (videoTracks.length > 0) {
document.title += "video";
}
document.title += " gumtest";
}, function(err) {
document.title = "failed gumtest";
stopMedia();
});
} catch(e) {
@ -60,4 +74,4 @@
}
}
</script>
</body></html>
</body></html>

View File

@ -8,8 +8,13 @@ public class testGetUserMedia extends BaseTest {
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";
String GUM_ALLOW = "^Share$";
String GUM_DENY = "^Don't Share$";
String GUM_PAGE_FAILED = "failed gumtest";
String GUM_PAGE_AUDIO = "audio gumtest";
String GUM_PAGE_VIDEO = "video gumtest";
String GUM_PAGE_AUDIOVIDEO = "audiovideo gumtest";
blockForGeckoReady();
@ -18,13 +23,45 @@ public class testGetUserMedia extends BaseTest {
// 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");
}
if (Build.VERSION.SDK_INT < 9) {
return;
}
if (Camera.getNumberOfCameras() <= 0) {
return;
}
// Test GUM notification showing
inputAndLoadUrl(GUM_URL);
waitForText(GUM_MESSAGE);
mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed");
mSolo.clickOnButton(GUM_DENY);
verifyPageTitle(GUM_PAGE_FAILED);
inputAndLoadUrl(GUM_URL);
waitForText(GUM_MESSAGE);
// Cameras don't work on the testing hardware, so stream a tab
mSolo.clickOnText("Back facing camera");
mSolo.clickOnText("Choose a tab to stream");
mSolo.clickOnButton(GUM_ALLOW);
mSolo.clickOnText("gUM Test Page");
verifyPageTitle(GUM_PAGE_AUDIOVIDEO);
inputAndLoadUrl(GUM_URL);
waitForText(GUM_MESSAGE);
mSolo.clickOnText("Back facing camera");
mSolo.clickOnText("No Video");
mSolo.clickOnButton(GUM_ALLOW);
verifyPageTitle(GUM_PAGE_AUDIO);
inputAndLoadUrl(GUM_URL);
waitForText(GUM_MESSAGE);
// Cameras don't work on the testing hardware, so stream a tab
mSolo.clickOnText("Back facing camera");
mSolo.clickOnText("Choose a tab to stream");
mSolo.clickOnText("Microphone 1");
mSolo.clickOnText("No Audio");
mSolo.clickOnButton(GUM_ALLOW);
mSolo.clickOnText("gUM Test Page");
verifyPageTitle(GUM_PAGE_VIDEO);
}
}