OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/Resourc eTiming/Overview.html#extensions-performance-interface"> | |
4 <script src="../resources/js-test-pre.js"></script> | |
5 <script> | |
6 description("This test checks that Performance inherits EventTarget and that add EventListener() works for resourcetimingbufferfull events."); | |
7 window.jsTestIsAsync = true; | |
8 var bufferFullCount = 0; | |
9 var parameter; | |
10 | |
11 function onBufferFull(event) { | |
12 parameter = event; | |
13 shouldBe('parameter.__proto__', 'Event.prototype'); | |
14 bufferFullCount++; | |
15 } | |
16 | |
17 shouldBe('Performance.prototype.__proto__', 'EventTarget.prototype'); | |
18 | |
19 performance.webkitSetResourceTimingBufferSize(2); | |
20 shouldBeNull('performance.onwebkitresourcetimingbufferfull'); | |
21 performance.addEventListener('webkitresourcetimingbufferfull', onBufferFull); | |
22 shouldBeNull('performance.onwebkitresourcetimingbufferfull'); | |
23 </script> | |
24 </head> | |
25 <body onload="test()"> | |
arv (Not doing code reviews)
2013/08/08 14:31:01
Or:
window.onload = test;
| |
26 <script> | |
27 function test() { | |
28 // Make sure the onBufferFull callback was called exactly 1 time. | |
29 shouldBe('bufferFullCount', '1'); | |
30 performance.removeEventListener('webkitresourcetimingbufferfull', onBufferFu ll); | |
31 finishJSTest(); | |
haraken
2013/08/08 07:29:09
Nit: Why do you need to make the test asynchronous
do-not-use
2013/08/08 07:37:27
I need to complete the test after the onload handl
arv (Not doing code reviews)
2013/08/08 14:31:01
I don't think you need an async test here. js-test
| |
32 } | |
33 </script> | |
34 <script src="../resources/js-test-post.js"></script> | |
35 </body> | |
36 </html> | |
OLD | NEW |