test_wpt_touch_action.html (4384B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>W3C pointerevents/*touch-action*.html tests in Mochitest form</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script type="application/javascript" src="apz_test_utils.js"></script> 8 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 <script type="application/javascript"> 11 var apz_touch_action_prefs = [ 12 // Dropping the touch slop to 0 makes the tests easier to write because 13 // we can just do a one-pixel drag to get over the pan threshold rather 14 // than having to hard-code some larger value. 15 ["apz.touch_start_tolerance", "0.0"], 16 // The touchstart from the drag can turn into a long-tap if the touch-move 17 // events get held up. Try to prevent that by making long-taps require 18 // a 10 second hold. Note that we also cannot enable chaos mode on this 19 // test for this reason, since chaos mode can cause the long-press timer 20 // to fire sooner than the pref dictates. 21 ["ui.click_hold_context_menus.delay", 10000], 22 // The subtests in this test do touch-drags to pan the page, but we don't 23 // want those pans to turn into fling animations, so we increase the 24 // fling-stop threshold velocity to absurdly high. 25 ["apz.fling_stopped_threshold", Number.MAX_VALUE], 26 // The helper_div_pan's div gets a displayport on scroll, but if the 27 // test takes too long the displayport can expire before the new scroll 28 // position is synced back to the main thread. So we disable displayport 29 // expiry for these tests. 30 ["apz.displayport_expiry_ms", 0], 31 ]; 32 33 function apzScriptInjector(name) { 34 return async function(childWin) { 35 childWin._ACTIVE_TEST_NAME = name; 36 await injectScript('/tests/SimpleTest/paint_listener.js', childWin); 37 await injectScript('../apz_test_utils.js', childWin); 38 await injectScript('../apz_test_native_event_utils.js', childWin); 39 await injectScript('../touch_action_helpers.js', childWin); 40 }; 41 } 42 43 // Each of these test names is turned into an entry in the |subtests| array 44 // below. 45 var testnames = [ 46 'pointerevent_touch-action-auto-css_touch-manual', 47 'pointerevent_touch-action-button-test_touch-manual', 48 // this one runs as a web-platform-test since it's not a manual test 49 // 'pointerevent_touch-action-illegal', 50 'pointerevent_touch-action-inherit_child-auto-child-none_touch-manual', 51 'pointerevent_touch-action-inherit_child-none_touch-manual', 52 'pointerevent_touch-action-inherit_child-pan-x-child-pan-x_touch-manual', 53 'pointerevent_touch-action-inherit_child-pan-x-child-pan-y_touch-manual', 54 'pointerevent_touch-action-inherit_highest-parent-none_touch-manual', 55 'pointerevent_touch-action-inherit_parent-none_touch-manual', 56 // the keyboard-manual and mouse-manual tests require simulating keyboard/ 57 // mouse input, rather than touch, so we're not going to do that here. 58 //'pointerevent_touch-action-keyboard-manual', 59 //'pointerevent_touch-action-mouse-manual', 60 'pointerevent_touch-action-none-css_touch-manual', 61 'pointerevent_touch-action-pan-x-css_touch-manual', 62 'pointerevent_touch-action-pan-x-pan-y-pan-y_touch-manual', 63 'pointerevent_touch-action-pan-x-pan-y_touch-manual', 64 'pointerevent_touch-action-pan-y-css_touch-manual', 65 // disable this one because of intermittent failures. see bug 1292134. 66 // 'pointerevent_touch-action-span-test_touch-manual', 67 'pointerevent_touch-action-svg-test_touch-manual', 68 'pointerevent_touch-action-table-test_touch-manual', 69 // this one runs as a web-platform-test since it's not a manual test 70 //'pointerevent_touch-action-verification', 71 ]; 72 73 // Each entry in |subtests| is loaded in a new window. When loaded, it runs 74 // the function returned by apzScriptInjector, which injects some helper JS 75 // files into the vanilla unmodified W3C testcase, and simulates the necessary 76 // user input to run the test. 77 var subtests = []; 78 for (var name of testnames) { 79 subtests.push({ 80 'file': 'wpt/' + name + '.html', 81 'prefs': apz_touch_action_prefs, 82 'onload': apzScriptInjector(name), 83 }); 84 } 85 86 if (isApzEnabled()) { 87 SimpleTest.waitForExplicitFinish(); 88 window.onload = function() { 89 runSubtestsSeriallyInFreshWindows(subtests) 90 .then(SimpleTest.finish, SimpleTest.finish); 91 }; 92 } 93 94 </script> 95 </head> 96 <body> 97 </body> 98 </html>