Commit 7bbc7e63 authored by phoglund@chromium.org's avatar phoglund@chromium.org

Fixed video muting test on Android, added logging.

The video muting test didn't force iSAC correctly. Also added some
lightweight log statements to make it easier to see how far we get when
the test fails.

BUG=332765
TBR=wjia@chromium.org

Review URL: https://codereview.chromium.org/131613005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243904 0039d316-1c4b-4281-b951-d872f2087c98
parent d0d08e95
...@@ -716,13 +716,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, ...@@ -716,13 +716,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
} }
IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, CallAndVerifyVideoMutingWorks) { IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, CallAndVerifyVideoMutingWorks) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); MakeTypicalPeerConnectionCall("callAndEnsureVideoMutingWorks();");
GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(ExecuteJavascript("callAndEnsureVideoMutingWorks();"));
ExpectTitle("OK");
} }
#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)) #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY))
......
...@@ -627,6 +627,7 @@ ...@@ -627,6 +627,7 @@
} }
function negotiateBetween(caller, callee) { function negotiateBetween(caller, callee) {
console.log("Negotiating call...");
// Not stable = negotiation is ongoing. The behavior of re-negotiating while // Not stable = negotiation is ongoing. The behavior of re-negotiating while
// a negotiation is ongoing is more or less undefined, so avoid this. // a negotiation is ongoing is more or less undefined, so avoid this.
if (caller.signalingState != 'stable') if (caller.signalingState != 'stable')
...@@ -649,6 +650,7 @@ ...@@ -649,6 +650,7 @@
} }
function receiveOffer(offerSdp, caller, callee) { function receiveOffer(offerSdp, caller, callee) {
console.log("Receiving offer...");
offerSdp = transformRemoteSdp(offerSdp); offerSdp = transformRemoteSdp(offerSdp);
var parsedOffer = new RTCSessionDescription({ type: 'offer', var parsedOffer = new RTCSessionDescription({ type: 'offer',
...@@ -714,6 +716,7 @@ ...@@ -714,6 +716,7 @@
} }
function receiveAnswer(answerSdp, caller) { function receiveAnswer(answerSdp, caller) {
console.log("Receiving answer...");
answerSdp = transformRemoteSdp(answerSdp); answerSdp = transformRemoteSdp(answerSdp);
var parsedAnswer = new RTCSessionDescription({ type: 'answer', var parsedAnswer = new RTCSessionDescription({ type: 'answer',
sdp: answerSdp }); sdp: answerSdp });
...@@ -740,6 +743,7 @@ ...@@ -740,6 +743,7 @@
} }
function onRemoteStream(e, target) { function onRemoteStream(e, target) {
console.log("Receiving remote stream...");
if (gTestWithoutMsid && e.stream.id != "default") { if (gTestWithoutMsid && e.stream.id != "default") {
document.title = 'a default remote stream was expected but instead ' + document.title = 'a default remote stream was expected but instead ' +
e.stream.id + ' was received.'; e.stream.id + ' was received.';
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
// calls back |callback| with an array with numbers in the [0, 32768] range. // calls back |callback| with an array with numbers in the [0, 32768] range.
function gatherAudioLevelSamples(peerConnection, numSamples, frequency, function gatherAudioLevelSamples(peerConnection, numSamples, frequency,
callback) { callback) {
console.log('Gathering ' + numSamples + ' audio samples...');
var audioLevelSamples = [] var audioLevelSamples = []
var gatherSamples = setInterval(function() { var gatherSamples = setInterval(function() {
peerConnection.getStats(function(response) { peerConnection.getStats(function(response) {
audioLevelSamples.push(getAudioLevelFromStats_(response)); audioLevelSamples.push(getAudioLevelFromStats_(response));
if (audioLevelSamples.length == numSamples) { if (audioLevelSamples.length == numSamples) {
console.log('Gathered all samples.');
clearInterval(gatherSamples); clearInterval(gatherSamples);
callback(audioLevelSamples); callback(audioLevelSamples);
} }
...@@ -42,7 +44,7 @@ function verifyAudioIsPlaying(samples) { ...@@ -42,7 +44,7 @@ function verifyAudioIsPlaying(samples) {
'to be 4000 < avg < 8000.' 'to be 4000 < avg < 8000.'
if (largest < 25000) if (largest < 25000)
throw 'Too low max audio level: got ' + largest + ', expected > 30000.'; throw 'Too low max audio level: got ' + largest + ', expected > 30000.';
}; }
// If silent (like when muted), we should get very near zero audio level. // If silent (like when muted), we should get very near zero audio level.
function verifyIsSilent(samples) { function verifyIsSilent(samples) {
...@@ -71,4 +73,4 @@ function getAudioLevelFromStats_(response) { ...@@ -71,4 +73,4 @@ function getAudioLevelFromStats_(response) {
expectEquals(1, audioOutputLevels.length); expectEquals(1, audioOutputLevels.length);
return audioOutputLevels[0]; return audioOutputLevels[0];
} }
\ No newline at end of file
...@@ -37,11 +37,13 @@ function detectVideoStopped(videoElementName, callback) { ...@@ -37,11 +37,13 @@ function detectVideoStopped(videoElementName, callback) {
} }
function detectVideo(videoElementName, predicate, callback) { function detectVideo(videoElementName, predicate, callback) {
console.log('Looking at video in element ' + videoElementName);
var width = VIDEO_TAG_WIDTH; var width = VIDEO_TAG_WIDTH;
var height = VIDEO_TAG_HEIGHT; var height = VIDEO_TAG_HEIGHT;
var videoElement = $(videoElementName); var videoElement = $(videoElementName);
var canvas = $(videoElementName + '-canvas'); var canvas = $(videoElementName + '-canvas');
var old_pixels = []; var oldPixels = [];
var waitVideo = setInterval(function() { var waitVideo = setInterval(function() {
var context = canvas.getContext('2d'); var context = canvas.getContext('2d');
context.drawImage(videoElement, 0, 0, width, height); context.drawImage(videoElement, 0, 0, width, height);
...@@ -49,12 +51,13 @@ function detectVideo(videoElementName, predicate, callback) { ...@@ -49,12 +51,13 @@ function detectVideo(videoElementName, predicate, callback) {
// Check that there is an old and a new picture with the same size to // Check that there is an old and a new picture with the same size to
// compare and use the function |predicate| to detect the video state in // compare and use the function |predicate| to detect the video state in
// that case. // that case.
if (old_pixels.length == pixels.length && if (oldPixels.length == pixels.length &&
predicate(pixels, old_pixels)) { predicate(pixels, oldPixels)) {
console.log('Done looking at video in element ' + videoElementName);
clearInterval(waitVideo); clearInterval(waitVideo);
callback(); callback();
} }
old_pixels = pixels; oldPixels = pixels;
}, 200); }, 200);
} }
...@@ -92,9 +95,9 @@ function eventOccured() { ...@@ -92,9 +95,9 @@ function eventOccured() {
// This very basic video verification algorithm will be satisfied if any // This very basic video verification algorithm will be satisfied if any
// pixels are changed. // pixels are changed.
function isVideoPlaying(pixels, previous_pixels) { function isVideoPlaying(pixels, previousPixels) {
for (var i = 0; i < pixels.length; i++) { for (var i = 0; i < pixels.length; i++) {
if (pixels[i] != previous_pixels[i]) { if (pixels[i] != previousPixels[i]) {
return true; return true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment