diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/editing/dnd/resources | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/resources')
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/100x100-navy.png | bin | 0 -> 278 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/1x1-transparent.gif | bin | 0 -> 43 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/32mb.py | 12 | ||||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/boxnavy.swf | bin | 0 -> 4254 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/circle.png | bin | 0 -> 1252 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/crossorigin.sub.js | 13 | ||||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/dragdrop_support.js | 9 | ||||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/fail.png | bin | 0 -> 759 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/filler.html | 109 | ||||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/pass.png | bin | 0 -> 1689 bytes | |||
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/resources/test-helper.js | 50 |
11 files changed, 193 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/resources/100x100-navy.png b/testing/web-platform/tests/html/editing/dnd/resources/100x100-navy.png Binary files differnew file mode 100644 index 0000000000..ee8f953c00 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/100x100-navy.png diff --git a/testing/web-platform/tests/html/editing/dnd/resources/1x1-transparent.gif b/testing/web-platform/tests/html/editing/dnd/resources/1x1-transparent.gif Binary files differnew file mode 100644 index 0000000000..e565824aaf --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/1x1-transparent.gif diff --git a/testing/web-platform/tests/html/editing/dnd/resources/32mb.py b/testing/web-platform/tests/html/editing/dnd/resources/32mb.py new file mode 100644 index 0000000000..8513f227e9 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/32mb.py @@ -0,0 +1,12 @@ +thirty_two_megabytes = 32 * 1024 * 1024 +chunk = b'ab' * 512 * 512 +chunk_length = len(chunk) + +def main(request, response): + def content(): + bytes_sent = 0 + while bytes_sent < thirty_two_megabytes: + yield chunk + bytes_sent += chunk_length + + return [(b"Content-Type", b"text/plain")], content() diff --git a/testing/web-platform/tests/html/editing/dnd/resources/boxnavy.swf b/testing/web-platform/tests/html/editing/dnd/resources/boxnavy.swf Binary files differnew file mode 100644 index 0000000000..c4ef5889a3 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/boxnavy.swf diff --git a/testing/web-platform/tests/html/editing/dnd/resources/circle.png b/testing/web-platform/tests/html/editing/dnd/resources/circle.png Binary files differnew file mode 100644 index 0000000000..8bb141cb8c --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/circle.png diff --git a/testing/web-platform/tests/html/editing/dnd/resources/crossorigin.sub.js b/testing/web-platform/tests/html/editing/dnd/resources/crossorigin.sub.js new file mode 100644 index 0000000000..d6aaa18ad7 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/crossorigin.sub.js @@ -0,0 +1,13 @@ +var httpHostMain = '{{domains[]}}'; //name of the server that this page must accessed over port 80 +var httpHostAlias = '{{domains[www]}}'; //another hostname (must be a subdomain so document.domain can be set to a higher domain) that accesses the same content, over HTTP +var httpsHostAlias = httpHostAlias; //another hostname (can be same as httpHostAlias) that accesses the same content, over HTTPS port +var httpPortAlias = {{ports[http][0]}}; //another port that accesses the same content on the current hostname, over HTTP +//XXX HTTPS +//var httpsPortAlias = ports[https][0]; //another port that accesses the same content on the httpsHostAlias, over HTTPS +var httpsPortAlias = 8443; + +function crossOriginUrl(subdomain, relative_url) { + var a = document.createElement("a"); + a.href = relative_url; + return a.href.replace(location.href.replace("://", "://" + subdomain + ".")); +} diff --git a/testing/web-platform/tests/html/editing/dnd/resources/dragdrop_support.js b/testing/web-platform/tests/html/editing/dnd/resources/dragdrop_support.js new file mode 100644 index 0000000000..f5a1d6417f --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/dragdrop_support.js @@ -0,0 +1,9 @@ +function AddEventListenersForElement(evt, callback, capture, element) +{ + element.addEventListener(evt, callback, capture); +} + +function LogTestResult(result) +{ + document.getElementById("test_result").firstChild.data = result; +} diff --git a/testing/web-platform/tests/html/editing/dnd/resources/fail.png b/testing/web-platform/tests/html/editing/dnd/resources/fail.png Binary files differnew file mode 100644 index 0000000000..b593380333 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/fail.png diff --git a/testing/web-platform/tests/html/editing/dnd/resources/filler.html b/testing/web-platform/tests/html/editing/dnd/resources/filler.html new file mode 100644 index 0000000000..6ca9868ac2 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/filler.html @@ -0,0 +1,109 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <title>Filler text</title> +</head> +<body> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text</p> + <p>Filler text (end)</p> +</body> +</html> diff --git a/testing/web-platform/tests/html/editing/dnd/resources/pass.png b/testing/web-platform/tests/html/editing/dnd/resources/pass.png Binary files differnew file mode 100644 index 0000000000..2fa1e0ac06 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/pass.png diff --git a/testing/web-platform/tests/html/editing/dnd/resources/test-helper.js b/testing/web-platform/tests/html/editing/dnd/resources/test-helper.js new file mode 100644 index 0000000000..fa9ec20c62 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/resources/test-helper.js @@ -0,0 +1,50 @@ +'use strict'; + +// Moves the pointer to the center of `element`. If `element` is contained within an `iframe`, use +// the `iframe` parameter to indicate which `iframe` contains `element`. This function +// returns a promise that will resolve once the pointer has been moved. + +const mouseMoveToCenter = (element, iframe = undefined) => { + let clientRect = element.getBoundingClientRect(); + let centerX = (clientRect.left + clientRect.right) / 2; + let centerY = (clientRect.top + clientRect.bottom) / 2; + if(iframe != undefined) { + clientRect = iframe.getBoundingClientRect(); + centerX += clientRect.left; + centerY += clientRect.top; + } + return new test_driver.Actions() + .pointerMove(Math.ceil(centerX), Math.ceil(centerY)) + .send(); +}; + +// The dragDropTest function can be used for tests which require the drag and drop movement. +// `dragElement` takes the element that needs to be dragged and `dropElement` is the element which +// you want to drop the `dragElement` on. `onDropCallback` is called on the onDrop handler and the +// test will only pass if this functions returns true. Also, if the `dropElement` is inside an +// iframe, use the optional `iframe` parameter to specify an iframe element that contains the +// `dropElement` to ensure that tests with an iframe pass. + +function dragDropTest(dragElement, dropElement, onDropCallBack, testDescription, iframe = undefined) { + promise_test((t) => new Promise(async (resolve, reject) => { + dropElement.addEventListener('drop', t.step_func((event) => { + if (onDropCallBack(event) == true) { + resolve(); + } else { + reject(); + } + })); + try { + await mouseMoveToCenter(dragElement); + await new test_driver.Actions() + .pointerDown() + .send(); + await mouseMoveToCenter(dropElement, iframe); + await new test_driver.Actions() + .pointerUp() + .send(); + } catch (e) { + reject(e); + } + }, testDescription)); +} |