https://github.com/web-platform-tests/wpt
Revision b7b803ba171367071f288c5ab8a3fa09c62339bd authored by Hiroshige Hayashizaki on 25 December 2018, 02:04:03 UTC, committed by Chromium WPT Sync on 25 December 2018, 02:04:03 UTC
Manual changes: spec.src.json. All others are generated.

This caused two test files with the same contents with names
- same-origin-downgrade.http.html
- same-origin-upgrade.http.html
in directories under origin-when-cross-origin/.
This CL thus removes same-origin-downgrade.http.html without
affecting test coverage.

(same-origin-downgrade is currently supressed by
source-https-unsupported-by-web-platform-tests-runners and thus
this CL doesn't add new files)

Bug: 906850
Change-Id: I1fcc150c4b2b643b3186cbef9432d343f8b4a1dd
1 parent a357943
Raw File
Tip revision: b7b803ba171367071f288c5ab8a3fa09c62339bd authored by Hiroshige Hayashizaki on 25 December 2018, 02:04:03 UTC
[wpt/referrer-policy] Fix same-origin-downgrade in spec.src.json
Tip revision: b7b803b
MediaStream-idl.https.html
<!doctype html>
<html>
<head>
<title>MediaStream constructor algorithm</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStream">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStream-id">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediastream">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#event-mediastreamtrack-ended">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-stop-void">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-clone-MediaStreamTrack">
</head>
<body>
<p class="instructions">When prompted, accept to share your video and audio stream.</p>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that the MediaStream constructor
follows the algorithm set in the spec.</p>

<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
let t = async_test("Tests that a MediaStream constructor follows the algorithm set in the spec");
t.step(() => {
  navigator.mediaDevices.getUserMedia({video: true, audio:true})
    .then(t.step_func(stream => {
      let stream1 = new MediaStream();
      assert_not_equals(stream.id, stream1.id, "Two different MediaStreams have different ids");
      let stream2 = new MediaStream(stream);
      assert_not_equals(stream.id, stream2.id, "A MediaStream constructed from another has a different id");
      let audioTrack1 = stream.getAudioTracks()[0];
      let videoTrack = stream.getVideoTracks()[0];
      assert_equals(audioTrack1, stream2.getAudioTracks()[0], "A MediaStream constructed from another shares the same audio track");
      assert_equals(videoTrack, stream2.getVideoTracks()[0], "A MediaStream constructed from another shares the same video track");
      let stream4 = new MediaStream([audioTrack1]);
      assert_equals(stream4.getTrackById(audioTrack1.id), audioTrack1, "a non-ended track gets added via the MediaStream constructor");

      let audioTrack2 = audioTrack1.clone();
      audioTrack2.addEventListener("ended", t.unreached_func("ended event should not be fired by MediaStreamTrack.stop()."));
      audioTrack2.stop();
      assert_equals(audioTrack2.readyState, "ended", "a stopped track is marked ended synchronously");

      let stream3 = new MediaStream([audioTrack2, videoTrack]);
      assert_equals(stream3.getTrackById(audioTrack2.id), audioTrack2, "an ended track gets added via the MediaStream constructor");
      assert_equals(stream3.getTrackById(videoTrack.id), videoTrack, "a non-ended track gets added via the MediaStream constructor even if the previous track was ended");

      let stream5 = new MediaStream([audioTrack2]);
      assert_equals(stream5.getTrackById(audioTrack2.id), audioTrack2, "an ended track gets added via the MediaStream constructor");
      assert_false(stream5.active, "a MediaStream created using the MediaStream() constructor whose arguments are lists of MediaStreamTrack objects that are all ended, the MediaStream object MUST be created with its active attribute set to false");

      stream.oninactive = t.step_func(() => {
        assert_false(stream.active);
        stream.getTracks().forEach(track => {
          assert_equals(track.readyState, "ended");
        });
        // Use a timeout to detect a misfire of the ended event.
        t.step_timeout(t.step_func_done());
      });

      audioTrack1.stop();
      videoTrack.stop();
    })
  );
});
</script>
</body>
</html>
back to top