Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: LayoutTests/fast/mediastream/MediaStream-stop.html

Issue 827673002: Add MediaStream.active attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Allow addTrack/removeTrack when mediastream.ended is true Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/mediastream/MediaStream-stop.html
diff --git a/LayoutTests/fast/mediastream/MediaStream-stop.html b/LayoutTests/fast/mediastream/MediaStream-stop.html
index d8afe6ffa17e008a6f55f191f0d468c4838b295f..1e516ec348b21b81fd01cd7ae9ea5e54822b2f86 100644
--- a/LayoutTests/fast/mediastream/MediaStream-stop.html
+++ b/LayoutTests/fast/mediastream/MediaStream-stop.html
@@ -5,28 +5,41 @@
</head>
<body>
<script>
-description("Test cloning mediastreams onended.");
+description("Test cloning mediastreams oninactive.");
var cloned_stream;
-function onStreamEnded() {
- testPassed('Stream ended.');
+function error() {
+ testFailed('Stream generation failed.');
finishJSTest();
}
-function onTrackAdded() {
- testPassed('Mock test track added.');
- shouldBe('cloned_stream.getVideoTracks().length', '1');
- cloned_stream.getVideoTracks()[0].stop();
+function getUserMedia(dictionary, callback) {
+ try {
+ navigator.webkitGetUserMedia(dictionary, callback, error);
+ } catch (e) {
+ testFailed('webkitGetUserMedia threw exception :' + e);
+ finishJSTest();
+ }
+}
+
+function onStreamInactive() {
+ testPassed('Stream inactive.');
+ finishJSTest();
}
-function run(s) {
- cloned_stream = new webkitMediaStream();
- cloned_stream.onaddtrack = onTrackAdded;
- cloned_stream.onended = onStreamEnded;
+function gotStream(s) {
+ stream = s;
+
+ cloned_stream = stream.clone();
+ cloned_stream.oninactive = onStreamInactive;
+ shouldBe('cloned_stream.getVideoTracks().length', '1');
+ shouldBe('cloned_stream.getAudioTracks().length', '1');
+ cloned_stream.getVideoTracks()[0].stop();
+ cloned_stream.getAudioTracks()[0].stop();
}
-run();
+getUserMedia({audio:true, video:true}, gotStream);
window.jsTestIsAsync = true;
window.successfullyParsed = true;

Powered by Google App Engine
This is Rietveld 408576698