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

Unified Diff: LayoutTests/fast/mediastream/MediaStream-onactive-oninactive.html

Issue 827673002: Add MediaStream.active attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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-onactive-oninactive.html
diff --git a/LayoutTests/fast/mediastream/MediaStream-onended.html b/LayoutTests/fast/mediastream/MediaStream-onactive-oninactive.html
similarity index 53%
copy from LayoutTests/fast/mediastream/MediaStream-onended.html
copy to LayoutTests/fast/mediastream/MediaStream-onactive-oninactive.html
index 3cd40cb337b1c4798f8e9a8e9186e14426b66f23..0abcbb4a1d463999a23022b23ec737667931816e 100644
--- a/LayoutTests/fast/mediastream/MediaStream-onended.html
+++ b/LayoutTests/fast/mediastream/MediaStream-onactive-oninactive.html
@@ -7,7 +7,7 @@
<p id="description"></p>
<div id="console"></div>
<script>
-description("Tests MediaStream::onended callback.");
+description("Test onactive/oninactive callback.");
function error() {
testFailed('Stream generation failed.');
@@ -25,41 +25,34 @@ function getUserMedia(dictionary, callback) {
var stream;
-function streamEnded2() {
- testPassed('streamEnded was called.');
- shouldBeTrue('stream.ended');
+function streamActive() {
+ testPassed('streamActive was called.');
+ shouldBeTrue('stream.active');
finishJSTest();
}
function gotStream2(s) {
- stream = new webkitMediaStream(s);
- shouldBeFalse('stream.ended');
- try {
- stream.onended = streamEnded2;
- s.stop();
- } catch (e) {
- testFailed('MediaStream threw exception :' + e);
- finishJSTest();
- }
+ stream = new webkitMediaStream();
+ shouldBeFalse('stream.active');
+ stream.onactive = streamActive;
+ stream.addTrack(s.getAudioTracks()[0]);
}
-function streamEnded() {
- testPassed('streamEnded was called.');
- shouldBeTrue('stream.ended');
+function streamInactive() {
+ testPassed('streamInactive was called.');
+ shouldBeFalse('stream.active');
getUserMedia({audio:true, video:true}, gotStream2);
}
function gotStream(s) {
stream = s;
- shouldBeFalse('stream.ended');
- try {
- stream.onended = streamEnded;
- stream.stop();
- } catch (e) {
- testFailed('MediaStream threw exception :' + e);
- finishJSTest();
- }
+ shouldBeTrue('stream.active');
+ stream.oninactive = streamInactive;
+ shouldBe('stream.getAudioTracks().length', '1');
+ shouldBe('stream.getVideoTracks().length', '1');
+ stream.removeTrack(stream.getAudioTracks()[0]);
+ stream.removeTrack(stream.getVideoTracks()[0]);
}
getUserMedia({audio:true, video:true}, gotStream);

Powered by Google App Engine
This is Rietveld 408576698