1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 description("Tests the RTCPeerConnection stats selector argument.");
13 function getUserMedia(dictionary
, callback
) {
15 navigator
.webkitGetUserMedia(dictionary
, callback
, error
);
17 testFailed('webkitGetUserMedia threw exception :' + e
);
23 testFailed('Stream generation failed.');
27 function gotStream(s
) {
28 testPassed('Got a stream.');
32 shouldNotThrow('pc.getStats(statsHandler2, pc.getLocalStreams()[0].getVideoTracks()[0])');
35 function statsHandler2(status
)
37 testPassed("statsHandler2 was called");
38 result
= status
.result();
39 shouldBeGreaterThanOrEqual('result.length', '1');
40 // Windows XP sometimes gives time that appears to go backwards.
41 // This hack will make the tests non-flaky if it never goes backwards
42 // by more than 20 milliseconds.
43 // Up to 10 milliseconds has been observed on XP, 2 milliseconds on Win7.
46 timediff
= res
.timestamp
- startTime
+ fudgeForXP
;
47 shouldBeGreaterThanOrEqual('timediff', '0');
48 shouldBe('res.stat("type")', '"video"');
52 var startTime
= new Date().getTime();
53 shouldNotThrow('pc = new webkitRTCPeerConnection(null)');
54 shouldNotThrow('getUserMedia({audio:true, video:true}, gotStream)');
56 window
.jsTestIsAsync
= true;
57 window
.successfullyParsed
= true;