summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html b/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html
new file mode 100644
index 0000000000..20bee3cefd
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<script src="apz_test_utils.js"></script>
+<script src="apz_test_native_event_utils.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/NativeKeyCodes.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
+<style>
+html, body { margin: 0; }
+
+body {
+ height: 10000px;
+}
+</style>
+
+<script>
+async function test() {
+ // Send a native key event which doesn't cause any scroll, so that now
+ // subsequent native key events will be able to be handled by APZ. See bug
+ // 1774519 about what happens without this event.
+ const UpArrowKeyCode = nativeArrowUpKey();
+ await new Promise(resolve => {
+ synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US,
+ UpArrowKeyCode, {} /* no modifier */,
+ "", "", resolve); });
+
+ // On test verify runs there's still a race condition where the next key event
+ // isn't handled by APZ since the focus sequence number hasn't yet been
+ // reflected to APZ, so we explicitly flush APZ state here.
+ await promiseApzFlushedRepaints();
+
+ const transformEndPromise = promiseTransformEnd();
+ const DownArrowKeyCode = nativeArrowDownKey();
+ await new Promise(resolve => {
+ synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US,
+ DownArrowKeyCode, {} /* no modifier */,
+ "", "", resolve); });
+ await transformEndPromise;
+ ok(true, "Got an APZ:TransformEnd ");
+}
+
+function isOnChaosMode() {
+ return SpecialPowers.Services.env.get("MOZ_CHAOSMODE");
+}
+
+if ((getPlatform() == "mac" || getPlatform() == "windows") &&
+ !isOnChaosMode()) {
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+} else {
+ ok(true, "Skipping test because native key events are not supported on " +
+ getPlatform());
+ subtestDone();
+}
+</script>