Revision cdf5b3962f33d0a05af040097173d8cc827a7d73 authored by Trent Apted on 12 March 2018, 04:02:04 UTC, committed by Blink WPT Bot on 12 March 2018, 04:10:37 UTC
This reverts commit af1c15b16f99d290799c83d34c111bce52447026.

Reason for revert: suspected for persistent failures on Win7 Tests (dbg)(1)

Unexpected Failures:
* external/wpt/bluetooth/server/getPrimaryServices/blocklisted-services.https.html
* external/wpt/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.https.html
* external/wpt/bluetooth/service/getCharacteristics/blocklisted-characteristics.https.html
* external/wpt/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.https.html
* external/wpt/upgrade-insecure-requests/link-upgrade.sub.https.html

since

https://ci.chromium.org/buildbot/chromium.win/Win7%20Tests%20%28dbg%29%281%29/66761

errors like

15:59:42.310 5904 worker/4 external/wpt/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.https.html crashed, (stderr lines):
15:59:42.311 5904   CONSOLE MESSAGE: line 255: Web Bluetooth is experimental on this platform. See https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md
15:59:42.327 1300 [1691/5755] external/wpt/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.https.html failed unexpectedly (content_shell crashed [pid=5644])

Original change's description:
> bluetooth: Use DeviceUUID in FakeBluetooth
>
> This change refactors the Web Bluetooth test API to use the
> DeviceUUIDs helper class defined in BluetoothDevice. Additionally,
> this change finishes the implementation of SimulateGATTServicesChanged,
> and as a result, tests are updated to set the next discovery response
> before calling this interface.
>
> BUG=719826
>
> Change-Id: I0f986eb7afe6fbf7ebaa80ac4b633d46a027b80d
> Reviewed-on: https://chromium-review.googlesource.com/939984
> Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
> Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#541577}

TBR=cco3@chromium.org,ortuno@chromium.org,odejesush@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 719826
Change-Id: I02bb7066c6f1282191f7a24e91b3d2c5614b8104
Reviewed-on: https://chromium-review.googlesource.com/958741
Reviewed-by: Trent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542421}
1 parent 9c9d8f2
Raw File
RTCRtpSender-replaceTrack.html
<!doctype html>
<meta charset=utf-8>
<title>RTCRtpSender.prototype.replaceTrack</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
  'use strict';

  // Test is based on the following editor draft:
  // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html

  // The following helper functions are called from RTCPeerConnection-helper.js:
  // generateMediaStreamTrack

  /*
    5.2.  RTCRtpSender Interface
      interface RTCRtpSender {
        readonly attribute MediaStreamTrack? track;
        Promise<void>           replaceTrack(MediaStreamTrack? withTrack);
        ...
      };

      replaceTrack
        Attempts to replace the track being sent with another track provided
        (or with a null track), without renegotiation.
   */

  /*
    5.2.  replaceTrack
      4.  If connection's [[isClosed]] slot is true, return a promise rejected
          with a newly created InvalidStateError and abort these steps.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver('audio');
    const { sender } = transceiver;
    pc.close();

    return promise_rejects(t, 'InvalidStateError',
      sender.replaceTrack(track));

  }, 'Calling replaceTrack on closed connection should reject with InvalidStateError');

  /*
    5.2.  replaceTrack
      7.  If withTrack is non-null and withTrack.kind differs from the
          transceiver kind of transceiver, return a promise rejected with a
          newly created TypeError.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('video');

    const transceiver = pc.addTransceiver('audio');
    const { sender } = transceiver;

    return promise_rejects(t, new TypeError(),
      sender.replaceTrack(track));

  }, 'Calling replaceTrack with track of different kind should reject with TypeError');

  /*
    5.2.  replaceTrack
      5.  If transceiver.stopped is true, return a promise rejected with a newly
          created InvalidStateError.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver('audio');
    const { sender } = transceiver;
    transceiver.stop();

    return promise_rejects(t, 'InvalidStateError',
      sender.replaceTrack(track));

  }, 'Calling replaceTrack on stopped sender should reject with InvalidStateError');

  /*
    5.2.  replaceTrack
      8.  If transceiver is not yet associated with a media description [JSEP]
          (section 3.4.1.), then set sender's track attribute to withTrack, and
          return a promise resolved with undefined.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver('audio');
    const { sender } = transceiver;
    assert_equals(sender.track, null);

    return sender.replaceTrack(track)
    .then(() => {
      assert_equals(sender.track, track);
    });
  }, 'Calling replaceTrack on sender with null track and not set to session description should resolve with sender.track set to given track');

  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track1 = generateMediaStreamTrack('audio');
    const track2 = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver(track1);
    const { sender } = transceiver;

    assert_equals(sender.track, track1);

    return sender.replaceTrack(track2)
    .then(() => {
      assert_equals(sender.track, track2);
    });
  }, 'Calling replaceTrack on sender not set to session description should resolve with sender.track set to given track');

  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver(track);
    const { sender } = transceiver;

    assert_equals(sender.track, track);

    return sender.replaceTrack(null)
    .then(() => {
      assert_equals(sender.track, null);
    });
  }, 'Calling replaceTrack(null) on sender not set to session description should resolve with sender.track set to null');

  /*
    5.2.  replaceTrack
      10. Run the following steps in parallel:
          1.  Determine if negotiation is needed to transmit withTrack in place
              of the sender's existing track.

              Negotiation is not needed if withTrack is null.

          3.  Queue a task that runs the following steps:
              2.  Set sender's track attribute to withTrack.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver(track);
    const { sender } = transceiver;

    assert_equals(sender.track, track);

    return pc.createOffer()
    .then(offer => pc.setLocalDescription(offer))
    .then(() => sender.replaceTrack(null))
    .then(() => {
      assert_equals(sender.track, null);
    });
  }, 'Calling replaceTrack(null) on sender set to session description should resolve with sender.track set to null');

  /*
    5.2.  replaceTrack
      10. Run the following steps in parallel:
          1.  Determine if negotiation is needed to transmit withTrack in place
              of the sender's existing track.

              Negotiation is not needed if the sender's existing track is
              ended (which appears as though the track was muted).

          3.  Queue a task that runs the following steps:
              2.  Set sender's track attribute to withTrack.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track1 = generateMediaStreamTrack('audio');
    const track2 = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver(track1);
    const { sender } = transceiver;
    assert_equals(sender.track, track1);

    track1.stop();

    return pc.createOffer()
    .then(offer => pc.setLocalDescription(offer))
    .then(() => sender.replaceTrack(track2))
    .then(() => {
      assert_equals(sender.track, track2);
    });
  }, 'Calling replaceTrack on sender with stopped track and and set to session description should resolve with sender.track set to given track');

  /*
    5.2.  replaceTrack
      10. Run the following steps in parallel:
          1.  Determine if negotiation is needed to transmit withTrack in place
              of the sender's existing track.

              (tracks generated with default parameters *should* be similar
              enough to not require re-negotiation)

          3.  Queue a task that runs the following steps:
              2.  Set sender's track attribute to withTrack.
   */
  promise_test(t => {
    const pc = new RTCPeerConnection();
    const track1 = generateMediaStreamTrack('audio');
    const track2 = generateMediaStreamTrack('audio');

    const transceiver = pc.addTransceiver(track1);
    const { sender } = transceiver;
    assert_equals(sender.track, track1);

    return pc.createOffer()
    .then(offer => pc.setLocalDescription(offer))
    .then(() => sender.replaceTrack(track2))
    .then(() => {
      assert_equals(sender.track, track2);
    });
  }, 'Calling replaceTrack on sender with similar track and and set to session description should resolve with sender.track set to new track');

  /*
    TODO
      5.2.  replaceTrack
        To avoid track identifiers changing on the remote receiving end when
        a track is replaced, the sender must retain the original track
        identifier and stream associations and use these in subsequent
        negotiations.

    Non-Testable
      5.2.  replaceTrack
        10. Run the following steps in parallel:
            1.  Determine if negotiation is needed to transmit withTrack in place
                of the sender's existing track.

                Ignore which MediaStream the track resides in and the id attribute
                of the track in this determination.

                If negotiation is needed, then reject p with a newly created
                InvalidModificationError and abort these steps.

            2.  If withTrack is null, have the sender stop sending, without
                negotiating. Otherwise, have the sender switch seamlessly to
                transmitting withTrack instead of the sender's existing track,
                without negotiating.
            3.  Queue a task that runs the following steps:
              1.  If connection's [[isClosed]] slot is true, abort these steps.
   */
</script>
back to top