blob: fbaa0a4ddbbf09feef026a7e93ec47cd4d4cc47c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that RTCPeerConnection event callbacks are async so that for example close can be called safely. The order of the messages is very important.");
var stream = null;
var pc = null;
function error() {
testFailed('Stream generation failed.');
finishJSTest();
}
function getUserMedia(dictionary, callback) {
try {
navigator.webkitGetUserMedia(dictionary, callback, error);
} catch (e) {
testFailed('webkitGetUserMedia threw exception :' + e);
finishJSTest();
}
}
function onStateChange(event) {
testPassed('onStateChange was called.');
shouldBe("pc.signalingState", "'closed'");
finishJSTest();
}
function onNegotiationNeeded(event) {
testPassed('onNegotiationNeeded was called.');
pc.onsignalingstatechange = onStateChange;
pc.close();
testPassed('onNegotiationNeeded done.')
}
function gotStream(s) {
testPassed('gotStream was called.');
stream = s;
pc = new webkitRTCPeerConnection(null, null);
pc.onnegotiationneeded = onNegotiationNeeded;
pc.addStream(stream);
testPassed('gotStream done.');
}
getUserMedia({audio:true, video:true}, gotStream);
window.jsTestIsAsync = true;
window.successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
|