Update web-platform-tests to revision 4d96cccabc2feacd48e1dab9afc22b8af2225572

This commit is contained in:
Ms2ger 2015-06-23 16:47:26 +02:00
parent 0d236288cc
commit c66c6af0ba
1067 changed files with 63768 additions and 10900 deletions

View file

@ -0,0 +1,113 @@
<!doctype html>
<!--
This test creates a data channel between two local PeerConnection instances
and ensures that an empty string sent by one is received by the second.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RTCPeerConnection Data Channel Empty String Test</title>
</head>
<body>
<div id="log"></div>
<h2>Messages exchanged</h2>
<div id="msg"></div>
<!-- These files are in place when executing on W3C. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/vendor-prefix.js"
data-prefixed-objects=
'[{"ancestors":["window"], "name":"RTCPeerConnection"}]'
>
</script>
<script type="text/javascript">
var test = async_test('Can send empty strings across a WebRTC data channel.');
var gFirstConnection = null;
var gSecondConnection = null;
var sendChannel = null;
var receiveChannel = null;
var onReceiveChannel = function (event) {
receiveChannel = event.channel;
receiveChannel.onmessage = onReceiveMessage;
};
// When the data channel is open, send an empty string message
// followed by a message that contains the string "done".
var onSendChannelOpen = function (event) {
var msgEl = document.getElementById('msg');
sendChannel.send('');
msgEl.innerHTML += 'Sent: [empty string]<br>';
sendChannel.send('done');
msgEl.innerHTML += 'Sent: "done"<br>';
};
// Check the messages received on the other side.
// There should be an empty string message followed by a message that
// contains the string "done".
// Pass/Fail the test according to the messages received
var emptyMessageReceived = false;
var onReceiveMessage = test.step_func(function (event) {
var msgEl = document.getElementById('msg');
msgEl.innerHTML += 'Received: ' +
(event.data ? '"' + event.data + '"' : '[empty string]') + '<br>';
if (emptyMessageReceived) {
assert_equals(event.data, 'done', 'The "done" message was not received');
test.done();
}
else {
assert_equals(event.data, '', 'Empty message not received');
emptyMessageReceived = true;
}
});
function exchangeIce(pc) {
return function(e) {
if (e.candidate) {
pc.addIceCandidate(e.candidate);
}
};
}
function exchangeDescription(pc1, pc2) {
return function() {
return pc1.setRemoteDescription(pc2.localDescription);
};
}
test.step(function() {
gFirstConnection = new RTCPeerConnection(null);
gSecondConnection = new RTCPeerConnection(null);
gFirstConnection.onicecandidate = exchangeIce(gSecondConnection);
gSecondConnection.onicecandidate = exchangeIce(gFirstConnection);
gSecondConnection.ondatachannel = onReceiveChannel;
// Note the data channel will preserve the order of messages
// exchanged over it by default.
sendChannel = gFirstConnection.createDataChannel('sendDataChannel');
sendChannel.onopen = onSendChannelOpen;
gFirstConnection.createOffer()
.then(gFirstConnection.setLocalDescription.bind(gFirstConnection))
.then(exchangeDescription(gSecondConnection, gFirstConnection))
.then(function() {
return gSecondConnection.createAnswer();
})
.then(gSecondConnection.setLocalDescription.bind(gSecondConnection))
.then(exchangeDescription(gFirstConnection, gSecondConnection))
.catch(test.step_func(function(e) {
assert_unreached('Error ' + e.name + ': ' + e.message);
}));
});
</script>
</body>
</html>

View file

@ -1,6 +1,6 @@
<!doctype html>
<!--
This test uses no media, and thus does not require fake media devices.
This test uses the legacy callback API with no media, and thus does not require fake media devices.
-->
<html>
@ -20,8 +20,7 @@ This test uses no media, and thus does not require fake media devices.
<script src="/common/vendor-prefix.js"
data-prefixed-objects=
'[{"ancestors":["window"], "name":"RTCPeerConnection"},
{"ancestors":["window"], "name":"RTCSessionDescription"},
{"ancestors":["window"], "name":"RTCIceCandidate"}]'
{"ancestors":["window"], "name":"RTCSessionDescription"}]'
>
</script>
<script type="text/javascript">
@ -31,7 +30,6 @@ This test uses no media, and thus does not require fake media devices.
var gSecondConnection = null;
var onOfferCreated = test.step_func(function(offer) {
// TODO: Switch to promise-based interface.
gFirstConnection.setLocalDescription(offer, ignoreSuccess,
failed('setLocalDescription first'));
@ -45,7 +43,6 @@ This test uses no media, and thus does not require fake media devices.
var parsedOffer = new RTCSessionDescription({ type: 'offer',
sdp: offerSdp });
// These functions use the legacy interface extensions to RTCPeerConnection.
// TODO: Switch to promise-based interfaces.
gSecondConnection.setRemoteDescription(parsedOffer,
function() {
gSecondConnection.createAnswer(onAnswerCreated,
@ -72,15 +69,13 @@ This test uses no media, and thus does not require fake media devices.
var onIceCandidateToFirst = test.step_func(function(event) {
// If event.candidate is null = no more candidates.
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gSecondConnection.addIceCandidate(candidate);
gSecondConnection.addIceCandidate(event.candidate);
}
});
var onIceCandidateToSecond = test.step_func(function(event) {
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gFirstConnection.addIceCandidate(candidate);
gFirstConnection.addIceCandidate(event.candidate);
}
});
@ -90,6 +85,8 @@ This test uses no media, and thus does not require fake media devices.
var onIceConnectionStateChange = test.step_func(function(event) {
assert_equals(event.type, 'iceconnectionstatechange');
assert_not_equals(gFirstConnection.iceConnectionState, "failed", "iceConnectionState of first connection");
assert_not_equals(gSecondConnection.iceConnectionState, "failed", "iceConnectionState of second connection");
var stateinfo = document.getElementById('stateinfo');
stateinfo.innerHTML = 'First: ' + gFirstConnection.iceConnectionState
+ '<br>Second: ' + gSecondConnection.iceConnectionState;
@ -139,7 +136,6 @@ This test uses no media, and thus does not require fake media devices.
// The offerToReceiveVideo is necessary and sufficient to make
// an actual connection.
// TODO: Use a promise-based API. This is legacy.
gFirstConnection.createOffer(onOfferCreated, failed('createOffer'),
{offerToReceiveVideo: true});
});

View file

@ -19,9 +19,7 @@ This test uses data only, and thus does not require fake media devices.
<script src="/resources/testharnessreport.js"></script>
<script src="/common/vendor-prefix.js"
data-prefixed-objects=
'[{"ancestors":["window"], "name":"RTCPeerConnection"},
{"ancestors":["window"], "name":"RTCSessionDescription"},
{"ancestors":["window"], "name":"RTCIceCandidate"}]'
'[{"ancestors":["window"], "name":"RTCPeerConnection"}]'
>
</script>
<script type="text/javascript">
@ -33,15 +31,13 @@ This test uses data only, and thus does not require fake media devices.
var onIceCandidateToFirst = test.step_func(function(event) {
// If event.candidate is null = no more candidates.
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gSecondConnection.addIceCandidate(candidate);
gSecondConnection.addIceCandidate(event.candidate);
}
});
var onIceCandidateToSecond = test.step_func(function(event) {
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gFirstConnection.addIceCandidate(candidate);
gFirstConnection.addIceCandidate(event.candidate);
}
});
@ -105,7 +101,7 @@ This test uses data only, and thus does not require fake media devices.
})
.then(function() {
atStep = 'Create answer';
return gSecondConnection.createAnswer()
return gSecondConnection.createAnswer();
})
.then(function(answer) {
atStep = 'Set local description at second';

View file

@ -0,0 +1,105 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>IDL check of RTCPeerConnection</title>
<link rel="author" title="Harald Alvestrand" href="mailto:hta@google.com"/>
<link rel="help" href="http://w3c.github.io/webrtc-pc/#rtcpeerconnection-interface">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">This test verifies the availability of the RTCPeerConnection interface.</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/vendor-prefix.js"
data-prefixed-objects=
'[{"ancestors":["window"], "name":"RTCPeerConnection"},
{"ancestors":["window"], "name":"RTCSessionDescription"},
{"ancestors":["window"], "name":"RTCIceCandidate"}]'>
</script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<!-- The IDL is copied from the 06 March 2015 editors' draft. -->
<script type="text/plain">
[ Constructor (RTCConfiguration configuration)]
interface RTCPeerConnection : EventTarget {
Promise<RTCSessionDescription> createOffer (optional RTCOfferOptions options);
Promise<RTCSessionDescription> createAnswer ();
Promise<void> setLocalDescription (RTCSessionDescription description);
readonly attribute RTCSessionDescription? localDescription;
Promise<void> setRemoteDescription (RTCSessionDescription description);
readonly attribute RTCSessionDescription? remoteDescription;
readonly attribute RTCSignalingState signalingState;
void updateIce (RTCConfiguration configuration);
Promise<void> addIceCandidate (RTCIceCandidate candidate);
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;
readonly attribute boolean? canTrickleIceCandidates;
RTCConfiguration getConfiguration ();
void close ();
attribute EventHandler onnegotiationneeded;
attribute EventHandler onicecandidate;
attribute EventHandler onsignalingstatechange;
attribute EventHandler oniceconnectionstatechange;
attribute EventHandler onicegatheringstatechange;
};
partial interface RTCPeerConnection {
void createOffer (RTCSessionDescriptionCallback successCallback, RTCPeerConnectionErrorCallback failureCallback, optional RTCOfferOptions options);
void setLocalDescription (RTCSessionDescription description, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback);
void createAnswer (RTCSessionDescriptionCallback successCallback, RTCPeerConnectionErrorCallback failureCallback);
void setRemoteDescription (RTCSessionDescription description, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback);
void addIceCandidate (RTCIceCandidate candidate, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback);
};
partial interface RTCPeerConnection {
sequence<RTCRtpSender> getSenders ();
sequence<RTCRtpReceiver> getReceivers ();
RTCRtpSender addTrack (MediaStreamTrack track, MediaStream... streams);
void removeTrack (RTCRtpSender sender);
attribute EventHandler ontrack;
};
partial interface RTCPeerConnection {
RTCDataChannel createDataChannel ([TreatNullAs=EmptyString] DOMString label, optional RTCDataChannelInit dataChannelDict);
attribute EventHandler ondatachannel;
};
partial interface RTCPeerConnection {
RTCDTMFSender createDTMFSender (MediaStreamTrack track);
};
partial interface RTCPeerConnection {
void getStats (MediaStreamTrack? selector, RTCStatsCallback successCallback, RTCPeerConnectionErrorCallback failureCallback);
};
partial interface RTCPeerConnection {
void setIdentityProvider (DOMString provider, optional DOMString protocol, optional DOMString username);
void getIdentityAssertion ();
readonly attribute RTCIdentityAssertion? peerIdentity;
attribute EventHandler onidentityresult;
attribute EventHandler onpeeridentity;
attribute EventHandler onidpassertionerror;
attribute EventHandler onidpvalidationerror;
};
</script>
<script>
(function() {
var idl_array = new IdlArray();
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"),
function(node) {
idl_array.add_idls(node.textContent);
});
window.pc = new RTCPeerConnection(null);
idl_array.add_objects({"RTCPeerConnection": ["pc"]});
idl_array.test();
done();
})();
</script>
</body>
</html>

View file

@ -38,7 +38,7 @@ instance --use-fake-device-for-media-stream for Chrome.
var gSecondConnection = null;
function getUserMediaOkCallback(localStream) {
gFirstConnection = new RTCPeerConnection(null, null);
gFirstConnection = new RTCPeerConnection(null);
gFirstConnection.onicecandidate = onIceCandidateToFirst;
gFirstConnection.addStream(localStream);
gFirstConnection.createOffer(onOfferCreated, failed('createOffer'));
@ -56,7 +56,7 @@ instance --use-fake-device-for-media-stream for Chrome.
});
function receiveCall(offerSdp) {
gSecondConnection = new RTCPeerConnection(null, null);
gSecondConnection = new RTCPeerConnection(null);
gSecondConnection.onicecandidate = onIceCandidateToSecond;
gSecondConnection.onaddstream = onRemoteStream;
@ -84,23 +84,18 @@ instance --use-fake-device-for-media-stream for Chrome.
test.done();
};
// Note: the ice candidate handlers are special. We can not wrap them in test
// steps since that seems to cause some kind of starvation that prevents the
// call of being set up. Unfortunately we cannot report errors in here.
var onIceCandidateToFirst = function(event) {
var onIceCandidateToFirst = test.step_func(function(event) {
// If event.candidate is null = no more candidates.
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gSecondConnection.addIceCandidate(candidate);
gSecondConnection.addIceCandidate(event.candidate);
}
};
});
var onIceCandidateToSecond = function(event) {
var onIceCandidateToSecond = test.step_func(function(event) {
if (event.candidate) {
var candidate = new RTCIceCandidate(event.candidate);
gFirstConnection.addIceCandidate(candidate);
gFirstConnection.addIceCandidate(event.candidate);
}
};
});
var onRemoteStream = test.step_func(function(event) {
var videoTag = document.getElementById('remote-view');