| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 function LayoutTestController() { | 2 function LayoutTestController() { |
| 3 this.dump_as_text_ = false; | 3 this.dump_as_text_ = false; |
| 4 this.wait_until_done_ = false; | 4 this.wait_until_done_ = false; |
| 5 | 5 |
| 6 this.dumpAsText = function () { | 6 this.dumpAsText = function () { |
| 7 this.dump_as_text_ = true; | 7 this.dump_as_text_ = true; |
| 8 }; | 8 }; |
| 9 | 9 |
| 10 this.waitUntilDone = function () { | 10 this.waitUntilDone = function () { |
| 11 this.wait_until_done_ = true; | 11 this.wait_until_done_ = true; |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 this.notifyDone = function () { | 14 this.notifyDone = function () { |
| 15 // For storage events, it actually takes 2 rounds of yielding for everything | 15 // For storage events, it actually takes 2 rounds of yielding for everything |
| 16 // to complete. | 16 // to complete. |
| 17 setTimeout(layoutTestController.DelayedNotifyDone1, 0); | 17 setTimeout(layoutTestController.DelayedNotifyDone1, 0); |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 this.DelayedNotifyDone1 = function () { | 20 this.DelayedNotifyDone1 = function () { |
| 21 setTimeout(layoutTestController.DelayedNotifyDone2, 0); | 21 setTimeout(layoutTestController.DelayedNotifyDone2, 0); |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 this.DelayedNotifyDone2 = function () { | 24 this.DelayedNotifyDone2 = function () { |
| 25 var token = encodeURIComponent(document.firstChild.innerText); | 25 var token = encodeURIComponent(document.body.innerText); |
| 26 document.cookie = "%COOKIE%=" + token; | 26 document.cookie = "%COOKIE%=" + token; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 this.OnEvent = function () { | 29 this.OnEvent = function () { |
| 30 // HACK: dumpAsText() is always called after waitUntilDone() and all tests | 30 // HACK: dumpAsText() is always called after waitUntilDone() and all tests |
| 31 // that are run within the UI test framework either call | 31 // that are run within the UI test framework either call |
| 32 // waitUntilDone() or dumpAsText(). So we'll simply keep polling | 32 // waitUntilDone() or dumpAsText(). So we'll simply keep polling |
| 33 // until we see one or the other. | 33 // until we see one or the other. |
| 34 if (layoutTestController.dump_as_text_) { | 34 if (layoutTestController.dump_as_text_) { |
| 35 if (!layoutTestController.wait_until_done_) | 35 if (!layoutTestController.wait_until_done_) |
| 36 layoutTestController.notifyDone(); | 36 layoutTestController.notifyDone(); |
| 37 } else { | 37 } else { |
| 38 setTimeout(layoutTestController.OnEvent, 200); | 38 setTimeout(layoutTestController.OnEvent, 200); |
| 39 } | 39 } |
| 40 }; | 40 }; |
| 41 } | 41 } |
| 42 | 42 |
| 43 window.layoutTestController = new LayoutTestController(); | 43 window.layoutTestController = new LayoutTestController(); |
| 44 window.addEventListener('load', layoutTestController.OnEvent, false); | 44 window.addEventListener('load', layoutTestController.OnEvent, false); |
| 45 </script> | 45 </script> |
| OLD | NEW |