Changes between Version 6 and Version 7 of Writing Layout Tests to test iOS UI features


Ignore:
Timestamp:
Sep 30, 2015 3:44:36 PM (9 years ago)
Author:
Simon Fraser
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Writing Layout Tests to test iOS UI features

    v6 v7  
    106106}}}
    107107
    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).
     108Note 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).
    109109
    110110However, 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:
     
    118118}}}
    119119
     120There are some callbacks you can register on UIScriptController to get notified when certain things happen, like zooming. These are useful because event dispatch doesn't imply that zooming is done, since the zoom is animated. So in the above example, we don't have the final zoom scale when calling uiScriptComplete(). We really have to wait for the zoom to finish:
    120121
     122{{{
     123(function() {
     124    uiController.didEndZoomingCallback = function() {
     125        uiController.uiScriptComplete('Zoomed to scale ' + uiController.zoomScale);
     126    };
     127
     128    uiController.doubleTapAtPoint(50, 50, function() { /* Do nothing here */ });
     129})();
     130}}}
     131
     132You can chain as many asynchronous things as you like in the UI-side script, as long as you call uiScriptComplete() when the chain is complete. You can also call testRunner.runUIScript() as many times as you like from the test content, making it possible to test a long sequence of operations that bounce between the UI process and the web process.
     133
     134