Index: content/test/data/media/getusermedia.html |
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html |
index f42ce720fd43c84433d85478fd675b7c56903838..280571e021657472f8f7e10bc98bd7f3aa8dcb62 100644 |
--- a/content/test/data/media/getusermedia.html |
+++ b/content/test/data/media/getusermedia.html |
@@ -163,37 +163,32 @@ |
// Creates two MediaStream and renders them locally. When the video of both |
// streams are detected to be rolling, we stop the local video tracks one at |
- // the time. |
+ // the time. In particular, we verify that stopping one track does not stop |
+ // the other. |
function twoGetUserMediaAndStop(constraints) { |
- // TODO(phoglund): make gUM requests in parallel; this test is too slow |
- // and flakes on slow bots (http://crbug.com/417756). The current cycle of |
- // detect - gum - detect - gum - stop - detect - stop - detect contains too |
- // many detection phases. On bots with GPU emulation this looks to be really |
- // slow, so I was thinking we could at least get video up for both streams |
- // simultaneously and thereby run the first two detects in parallel. |
var stream1 = null; |
phoglund_chromium
2014/10/09 12:20:07
Unless of course you see a problem with doing the
|
var stream2 = null; |
navigator.webkitGetUserMedia( |
constraints, |
function(stream) { |
stream1 = stream; |
- detectVideoInLocalView1(stream, requestSecondGetUserMedia); |
+ detectVideoInLocalView1(stream, maybeStopBothVideoTracksAndVerify); |
+ }, |
+ failedCallback); |
+ navigator.webkitGetUserMedia( |
+ constraints, |
+ function(stream) { |
+ stream2 = stream; |
+ attachMediaStream(stream, 'local-view-2'); |
+ detectVideoPlaying('local-view-2', maybeStopBothVideoTracksAndVerify); |
}, |
failedCallback); |
- var requestSecondGetUserMedia = function() { |
- navigator.webkitGetUserMedia( |
- constraints, |
- function(stream) { |
- stream2 = stream; |
- attachMediaStream(stream, 'local-view-2'); |
- detectVideoPlaying('local-view-2', stopBothVideoTracksAndVerify); |
- }, |
- failedCallback); |
- }; |
- var stopBothVideoTracksAndVerify = function() { |
- // Stop track 2, ensure that stops track 2 but not track 1, then stop |
- // track 1. |
+ var maybeStopBothVideoTracksAndVerify = function() { |
+ if (stream1 == null || stream2 == null) |
+ return; |
+ |
+ // Stop track 2, ensure track 2 stops but not track 1, then stop track 1. |
stream2.getVideoTracks()[0].stop(); |
waitForVideoToStop('local-view-1'); |
waitForVideoToStop('local-view-2'); |
@@ -203,35 +198,41 @@ |
}; |
} |
- function twoGetUserMedia(constraints1, |
- constraints2) { |
- // TODO(phoglund): see TODO on twoGetUserMediaAndStop. |
- var result=""; |
+ // Makes to getUserMedia calls in parallel and detects the aspect ratio for |
+ // both. The two aspect ratios are returned to the test separated by a dash, |
+ // like for instance w=640:h=480-w=640:h=480. |
+ function twoGetUserMedia(constraints1, constraints2) { |
+ var aspectRatio1 = null; |
+ var aspectRatio2 = null; |
navigator.webkitGetUserMedia( |
constraints1, |
function(stream) { |
displayDetectAndAnalyzeVideoInElement( |
stream, |
function(aspectRatio) { |
- result = aspectRatio; |
- requestSecondGetUserMedia(); |
+ aspectRatio1 = aspectRatio; |
+ maybeFinishTest(); |
}, |
'local-view-1'); |
}, |
failedCallback); |
- var requestSecondGetUserMedia = function() { |
- navigator.webkitGetUserMedia( |
- constraints2, |
- function(stream) { |
- displayDetectAndAnalyzeVideoInElement( |
- stream, |
- function(aspectRatio) { |
- result = result + '-' + aspectRatio; |
- sendValueToTest(result); |
- }, |
- 'local-view-2'); |
- }, |
- failedCallback); |
+ navigator.webkitGetUserMedia( |
+ constraints2, |
+ function(stream) { |
+ displayDetectAndAnalyzeVideoInElement( |
+ stream, |
+ function(aspectRatio) { |
+ aspectRatio2 = aspectRatio; |
+ maybeFinishTest(); |
+ }, |
+ 'local-view-2'); |
+ }, |
+ failedCallback); |
+ |
+ var maybeFinishTest = function() { |
+ if (aspectRatio1 == null || aspectRatio2 == null) |
+ return; |
+ sendValueToTest(aspectRatio1 + '-' + aspectRatio2); |
} |
} |
@@ -241,19 +242,17 @@ |
constraints2, |
expected_frame_rate1, |
expected_frame_rate2) { |
- // TODO(phoglund): see TODO on twoGetUserMediaAndStop. |
addExpectedEvent(); |
addExpectedEvent(); |
- var validateFrameRateCallback = function (success) { |
- if (!success) |
- failTest("Failed to validate frameRate."); |
+ var validateFrameRateCallback = function (result) { |
+ if (result != 'OK') |
+ failTest(result); |
phoglund_chromium
2014/10/09 12:20:07
I've been annoyed by this rather bare error messag
|
eventOccured(); |
}; |
navigator.webkitGetUserMedia( |
constraints1, |
function(stream) { |
- requestSecondGetUserMedia(); |
attachMediaStream(stream, 'local-view-1'); |
detectVideoPlaying('local-view-1', |
function() { |
@@ -262,19 +261,17 @@ |
}); |
}, |
failedCallback); |
- var requestSecondGetUserMedia = function() { |
- navigator.webkitGetUserMedia( |
- constraints2, |
- function(stream) { |
- attachMediaStream(stream, 'local-view-2'); |
- detectVideoPlaying('local-view-2', |
- function() { |
- validateFrameRate('local-view-2', expected_frame_rate2, |
- validateFrameRateCallback); |
- }); |
- }, |
- failedCallback); |
- } |
+ navigator.webkitGetUserMedia( |
+ constraints2, |
+ function(stream) { |
+ attachMediaStream(stream, 'local-view-2'); |
+ detectVideoPlaying('local-view-2', |
+ function() { |
+ validateFrameRate('local-view-2', expected_frame_rate2, |
+ validateFrameRateCallback); |
+ }); |
+ }, |
+ failedCallback); |
} |
function failedCallback(error) { |