OLD | NEW |
| (Empty) |
1 <script> | |
2 function LayoutTestController() { | |
3 this.dump_as_text_ = false; | |
4 this.wait_until_done_ = false; | |
5 | |
6 this.dumpAsText = function () { | |
7 this.dump_as_text_ = true; | |
8 }; | |
9 | |
10 this.waitUntilDone = function () { | |
11 this.wait_until_done_ = true; | |
12 }; | |
13 | |
14 this.notifyDone = function () { | |
15 // For storage events, it actually takes 2 rounds of yielding for everything | |
16 // to complete. | |
17 setTimeout(layoutTestController.DelayedNotifyDone1, 0); | |
18 }; | |
19 | |
20 this.overridePreference = function () { | |
21 // WebSocket tests call this function by preference name | |
22 // 'WebKitHixie76WebSocketProtocolEnabled' to switch its protocol version. | |
23 // In Chromium, the value must be 0 because it doesn't support old one. | |
24 }; | |
25 | |
26 this.DelayedNotifyDone1 = function () { | |
27 setTimeout(layoutTestController.DelayedNotifyDone2, 0); | |
28 }; | |
29 | |
30 this.DelayedNotifyDone2 = function () { | |
31 var token = encodeURIComponent(document.body.innerText); | |
32 var limit = 4090; | |
33 if (token.length > limit) | |
34 token = encodeURIComponent("Too Big! encoded innerText size was " + | |
35 token.length + " > " + limit); | |
36 document.cookie = "%COOKIE%=" + token; | |
37 }; | |
38 | |
39 this.OnEvent = function () { | |
40 // HACK: dumpAsText() is always called after waitUntilDone() and all tests | |
41 // that are run within the UI test framework either call | |
42 // waitUntilDone() or dumpAsText(). So we'll simply keep polling | |
43 // until we see one or the other. | |
44 if (layoutTestController.dump_as_text_) { | |
45 if (!layoutTestController.wait_until_done_) | |
46 layoutTestController.notifyDone(); | |
47 } else { | |
48 setTimeout(layoutTestController.OnEvent, 200); | |
49 } | |
50 }; | |
51 } | |
52 | |
53 window.layoutTestController = new LayoutTestController(); | |
54 window.addEventListener('load', layoutTestController.OnEvent, false); | |
55 </script> | |
OLD | NEW |