Commit 6d63b58a authored by Henrik Boström's avatar Henrik Boström Committed by Commit Bot

Split iceGatheringState tests into separate files & update expectations

This allows us to run more tests than if we mark a single file as
timing out. Important to ensure we don't cause regressions when rolling
https://webrtc-review.googlesource.com/c/src/+/180481 into chromium.

# TBR since I am just moving things around and want to unblock a reland
TBR=hta@chromium.org

Bug: chromium:1110833, chromium:1071733
Change-Id: Ib9f9cefe3fd89d764495a41a66422f191761df62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324251Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792650}
parent 1e49eddb
......@@ -2857,9 +2857,6 @@ crbug.com/626703 [ Win ] external/wpt/cookie-store/serviceworker_oncookiechange_
crbug.com/626703 [ Linux ] external/wpt/workers/postMessage_block.https.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/workers/postMessage_block.https.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/workers/postMessage_block.https.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/webrtc/RTCPeerConnection-iceGatheringState.html [ Timeout ]
crbug.com/626703 [ Mac ] external/wpt/webrtc/RTCPeerConnection-iceGatheringState.html [ Timeout ]
crbug.com/626703 [ Win ] external/wpt/webrtc/RTCPeerConnection-iceGatheringState.html [ Timeout ]
crbug.com/626703 [ Linux ] external/wpt/mathml/relations/css-styling/color-005.html [ Failure ]
crbug.com/626703 [ Mac ] external/wpt/mathml/relations/css-styling/color-005.html [ Failure ]
crbug.com/626703 [ Win ] external/wpt/mathml/relations/css-styling/color-005.html [ Failure ]
......@@ -3238,10 +3235,11 @@ crbug.com/367760 external/wpt/svg/pservers/reftests/meshgradient-basic-004.svg [
crbug.com/367760 external/wpt/svg/pservers/reftests/meshgradient-basic-001.svg [ Failure ]
# Tests pass under virtual/webrtc-wpt-plan-b
virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCPeerConnection-iceGatheringState.html [ Pass ]
virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCPeerConnection-operations.https.html [ Pass ]
virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCPeerConnection-restartIce-onnegotiationneeded.https.html [ Pass ]
crbug.com/1110833 external/wpt/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html [ Timeout ]
# See also crbug.com/920100 (sheriff 2019-01-09).
crbug.com/626703 external/wpt/referrer-policy/css-integration/svg/external-stylesheet.html [ Timeout Failure ]
crbug.com/626703 external/wpt/referrer-policy/css-integration/svg/inline-style.html [ Timeout Failure ]
......
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection.prototype.iceGatheringState</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
'use strict';
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswerWithIceGatheringStateTransitions(
pc1, pc2, {offerToReceiveAudio: true});
await pc1.setLocalDescription(await pc1.createOffer({iceRestart: true}));
await iceGatheringStateTransitions(pc1, 'gathering', 'complete');
expectNoMoreGatheringStateChanges(t, pc1);
await pc1.setLocalDescription({type: 'rollback'});
await new Promise(r => t.step_timeout(r, 1000));
}, 'rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes');
promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering', 'complete');
await pc.setLocalDescription({type: 'rollback'});
await iceGatheringStateTransitions(pc, 'new');
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete"');
promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering');
await pc.setLocalDescription({type: 'rollback'});
// We might go directly to 'new', or we might go to 'complete' first,
// depending on timing. Allow either.
const results = await Promise.allSettled([
iceGatheringStateTransitions(pc, 'new'),
iceGatheringStateTransitions(pc, 'complete', 'new')]);
assert_true(results.some(result => result.status == 'fulfilled'),
'ICE gathering state should go back to "new", possibly through "complete"');
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering"');
</script>
......@@ -654,3 +654,40 @@ class UniqueSet extends Set {
super.add(value);
}
}
const iceGatheringStateTransitions = async (pc, ...states) => {
for (const state of states) {
await new Promise((resolve, reject) => {
pc.addEventListener('icegatheringstatechange', () => {
if (pc.iceGatheringState == state) {
resolve();
} else {
reject(`Unexpected gathering state: ${pc.iceGatheringState}, was expecting ${state}`);
}
}, {once: true});
});
}
};
const initialOfferAnswerWithIceGatheringStateTransitions =
async (pc1, pc2, offerOptions) => {
await pc1.setLocalDescription(
await pc1.createOffer(offerOptions));
const pc1Transitions =
iceGatheringStateTransitions(pc1, 'gathering', 'complete');
await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(await pc2.createAnswer());
const pc2Transitions =
iceGatheringStateTransitions(pc2, 'gathering', 'complete');
await pc1.setRemoteDescription(pc2.localDescription);
await pc1Transitions;
await pc2Transitions;
};
const expectNoMoreGatheringStateChanges = async (t, pc) => {
pc.onicegatheringstatechange =
t.step_func(() => {
assert_unreached(
'Should not get an icegatheringstatechange right now!');
});
};
This is a testharness.js-based test.
PASS Initial iceGatheringState should be new
PASS iceGatheringState should eventually become complete after setLocalDescription
PASS setLocalDescription(reoffer) with no new transports should not cause iceGatheringState to change
PASS setLocalDescription(reoffer) with a new transport should cause iceGatheringState to go to "checking" and then "complete"
PASS sRD does not cause ICE gathering state changes
FAIL renegotiation that closes all transports should result in ICE gathering state "new" promise_test: Unhandled rejection with value: object "TypeError: pc1.getTransceivers(...)[0].stop is not a function"
FAIL connection with one data channel should eventually have connected connection state assert_equals: Expect ICE transport to be in checking gatheringState when iceGatheringState is checking expected (string) "gathering" but got (undefined) undefined
Harness: the test ran to completion.
......@@ -84,43 +84,13 @@
assert_unreached(`Unhandled rejection ${err.name}: ${err.message}`)));
}, 'iceGatheringState should eventually become complete after setLocalDescription');
const iceGatheringStateTransitions = async (pc, ...states) => {
for (const state of states) {
await new Promise((resolve, reject) => {
pc.addEventListener('icegatheringstatechange', () => {
if (pc.iceGatheringState == state) {
resolve();
} else {
reject(`Unexpected gathering state: ${pc.iceGatheringState}, was expecting ${state}`);
}
}, {once: true});
});
}
};
const initialOfferAnswer = async (pc1, pc2, offerOptions) => {
await pc1.setLocalDescription(
await pc1.createOffer(offerOptions));
const pc1Transitions = iceGatheringStateTransitions(pc1, 'gathering', 'complete');
await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(await pc2.createAnswer());
const pc2Transitions = iceGatheringStateTransitions(pc2, 'gathering', 'complete');
await pc1.setRemoteDescription(pc2.localDescription);
await pc1Transitions;
await pc2Transitions;
};
const expectNoMoreGatheringStateChanges = async (t, pc) => {
pc.onicegatheringstatechange = t.step_func(() => assert_unreached('Should not get an icegatheringstatechange right now!'));
};
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswer(pc1, pc2, {offerToReceiveAudio: true});
await initialOfferAnswerWithIceGatheringStateTransitions(
pc1, pc2, {offerToReceiveAudio: true});
expectNoMoreGatheringStateChanges(t, pc1);
expectNoMoreGatheringStateChanges(t, pc2);
......@@ -136,20 +106,8 @@
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswer(pc1, pc2, {offerToReceiveAudio: true});
await pc1.setLocalDescription(await pc1.createOffer({iceRestart: true}));
await iceGatheringStateTransitions(pc1, 'gathering', 'complete');
expectNoMoreGatheringStateChanges(t, pc1);
await pc1.setLocalDescription({type: 'rollback'});
await new Promise(r => t.step_timeout(r, 1000));
}, 'rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes');
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswer(pc1, pc2, {offerToReceiveAudio:true});
await initialOfferAnswerWithIceGatheringStateTransitions(
pc1, pc2, {offerToReceiveAudio:true});
await pc1.setLocalDescription(await pc1.createOffer({iceRestart: true}));
await iceGatheringStateTransitions(pc1, 'gathering', 'complete');
}, 'setLocalDescription(reoffer) with a new transport should cause iceGatheringState to go to "checking" and then "complete"');
......@@ -165,40 +123,15 @@
await pc2.setRemoteDescription(offer);
await pc2.setRemoteDescription({type: 'rollback'});
await pc2.setRemoteDescription(offer);
}, 'sRD does not cause ICE gathering state changes')
promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering', 'complete');
await pc.setLocalDescription({type: 'rollback'});
await iceGatheringStateTransitions(pc, 'new');
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete"');
promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering');
await pc.setLocalDescription({type: 'rollback'});
// We might go directly to 'new', or we might go to 'complete' first,
// depending on timing. Allow either.
const results = await Promise.allSettled([
iceGatheringStateTransitions(pc, 'new'),
iceGatheringStateTransitions(pc, 'complete', 'new')]);
assert_true(results.some(result => result.status == 'fulfilled'),
'ICE gathering state should go back to "new", possibly through "complete"');
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering"');
}, 'sRD does not cause ICE gathering state changes');
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswer(pc1, pc2, {offerToReceiveAudio: true});
await initialOfferAnswerWithIceGatheringStateTransitions(
pc1, pc2, {offerToReceiveAudio: true});
pc1.getTransceivers()[0].stop();
await pc1.setLocalDescription(await pc1.createOffer());
......
This is a testharness.js-based test.
FAIL rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
FAIL setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete" promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
FAIL setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering" promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
Harness: the test ran to completion.
......@@ -2,11 +2,8 @@ This is a testharness.js-based test.
PASS Initial iceGatheringState should be new
PASS iceGatheringState should eventually become complete after setLocalDescription
PASS setLocalDescription(reoffer) with no new transports should not cause iceGatheringState to change
FAIL rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
PASS setLocalDescription(reoffer) with a new transport should cause iceGatheringState to go to "checking" and then "complete"
FAIL sRD does not cause ICE gathering state changes promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
FAIL setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete" promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
FAIL setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering" promise_test: Unhandled rejection with value: object "OperationError: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Rollback not supported in Plan B"
FAIL renegotiation that closes all transports should result in ICE gathering state "new" promise_test: Unhandled rejection with value: object "TypeError: Cannot read property 'stop' of undefined"
FAIL connection with one data channel should eventually have connected connection state Cannot read property 'transport' of null
Harness: the test ran to completion.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment