| 95 | |
| 96 | = UIScriptController functions = |
| 97 | |
| 98 | UIScriptController is the mechanism for driving behavior in the UI process, and to accessing UI state. Many of the functions will trigger UI behaviors that take time (e.g. a zoom animation, or bringing up the keyboard). Rather than blocking, these functions take a callback that is triggered in the UI script context when that operation is complete: |
| 99 | |
| 100 | {{{ |
| 101 | (function() { |
| 102 | uiController.doubleTapAtPoint(50, 50, function() { |
| 103 | console.log("Taps were dispatched"); |
| 104 | }); |
| 105 | })(); |
| 106 | }}} |
| 107 | |
| 108 | Note that this console.log() won't show in layout test output, since it's being generated in the UI process (but it will be logged if you run webkittestrunner directly, which is useful for debugging). |
| 109 | |
| 110 | However, the web process needs to be told that the UI script is complete, so when your test has finished doing work in the UI process, it should call uiScriptComplete(), passing the result: |
| 111 | |
| 112 | {{{ |
| 113 | (function() { |
| 114 | uiController.doubleTapAtPoint(50, 50, function() { |
| 115 | uiController.uiScriptComplete("Taps were dispatched"); |
| 116 | }); |
| 117 | })(); |
| 118 | }}} |
| 119 | |
| 120 | |