Skip media source tests since the feature is not enabled on Windows.
[WebKit-https.git] / LayoutTests / fast / forms / search-event-delay.html
1 <script>
2
3 var count = 0;
4 var keyEventTime;
5
6 function sendKeyEvent()
7 {
8     if (window.eventSender)
9         eventSender.keyDown("x");
10 }
11
12 function sendDeleteKeyEvent()
13 {
14     if (window.eventSender)
15         eventSender.keyDown("delete");
16 }
17
18 function keyEvent(event)
19 {
20     keyEventTime = event.timeStamp;
21 }
22
23 function searchEvent(event)
24 {
25     document.getElementById("times").innerHTML += " " + (Math.round((event.timeStamp - keyEventTime) / 100) / 10);
26     count += 1;
27     if (count != 6) {
28         if (count != 5)
29             sendKeyEvent();
30         else {
31             document.getElementById("search").select();
32             sendDeleteKeyEvent();
33         }
34     } else {
35         if (window.testRunner)
36             setTimeout("testRunner.notifyDone()", 0); // Do it on a timer to avoid Windows DRT hanging.
37     }
38 }
39
40 function startTest()
41 {
42     if (window.testRunner) {
43         testRunner.dumpAsText();
44         testRunner.waitUntilDone();
45     }
46     document.getElementById("search").focus();
47     sendKeyEvent();
48 }
49
50 </script>
51
52 <body onload="startTest()">
53
54 <p>This tests the delay between when you type and the search event fires.</p>
55
56 <p>As of this writing we can't use DOM events to type into a search field, so the test uses the event sender and only runs under DumpRenderTree.</p>
57
58 <p><input id="search" type="search" incremental onkeydown="keyEvent(event)" onsearch="searchEvent(event)"></p>
59
60 <div>The two rows below should match.</div>
61 <div>0.5 0.4 0.3 0.2 0.2 0</p>
62 <div id="times"></div>
63
64 </body>