summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/chrome
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/canvas/test/chrome
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/test/chrome')
-rw-r--r--dom/canvas/test/chrome/chrome.ini11
-rw-r--r--dom/canvas/test/chrome/test_drawWindow_widget_layers.html58
-rw-r--r--dom/canvas/test/chrome/test_webgl_debug_renderer_info.html50
3 files changed, 119 insertions, 0 deletions
diff --git a/dom/canvas/test/chrome/chrome.ini b/dom/canvas/test/chrome/chrome.ini
new file mode 100644
index 0000000000..79070ca3cf
--- /dev/null
+++ b/dom/canvas/test/chrome/chrome.ini
@@ -0,0 +1,11 @@
+[DEFAULT]
+
+[test_webgl_debug_renderer_info.html]
+subsuite = gpu
+[test_drawWindow_widget_layers.html]
+skip-if =
+ os == 'android'
+ os == 'linux' # Bug 1693807, Bug 1705410
+ os == 'win' && ccov # Bug 1705410
+ os == 'win' # Bug 1717900
+support-files = ../file_drawWindow_source.html ../file_drawWindow_common.js
diff --git a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html
new file mode 100644
index 0000000000..9a1f7503bb
--- /dev/null
+++ b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for canvas drawWindow</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
+ <script type="application/javascript" src="file_drawWindow_common.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ SimpleTest.waitForExplicitFinish();
+ window.addEventListener("load", openSourceWindow);
+
+ var sourceWindow;
+
+ function openSourceWindow(event) {
+ if (event.target != document) {
+ return;
+ }
+
+ // Add a little bottom padding to the window so that we don't capture the
+ // rounded corners at the bottom, which our GL drawing code on OS X draws
+ // for regular windows.
+ // (The reftest framework doesn't have this problem because it doesn't use
+ // a regular window with a titlebar, so there are no rounded corners.)
+ const WINDOW_INNER_WIDTH = CANVAS_WIDTH;
+ const WINDOW_INNER_HEIGHT = CANVAS_HEIGHT + 10;
+
+ // Need to open as a toplevel chrome window so that
+ // DRAWWINDOW_USE_WIDGET_LAYERS is honored.
+ sourceWindow = window.browsingContext.topChromeWindow.open("file_drawWindow_source.html", "",
+ `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`);
+ SimpleTest.waitForFocus(runTests, sourceWindow);
+ }
+
+ async function runTests() {
+ var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D);
+
+ let snapshot = function(context, x, y, width, height, bg) {
+ var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS |
+ cxInterfaceWrap.DRAWWINDOW_DRAW_CARET |
+ cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW;
+ context.drawWindow(sourceWindow, x, y, width, height, bg, flags);
+ }
+ await runDrawWindowTests(snapshot, true);
+
+ sourceWindow.close();
+
+ SimpleTest.finish();
+ }
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
+</body>
+</html>
diff --git a/dom/canvas/test/chrome/test_webgl_debug_renderer_info.html b/dom/canvas/test/chrome/test_webgl_debug_renderer_info.html
new file mode 100644
index 0000000000..5b11a12165
--- /dev/null
+++ b/dom/canvas/test/chrome/test_webgl_debug_renderer_info.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=666446
+-->
+<head>
+ <title>Test that WEBGL_debug_renderer_info works in chrome code</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<script>
+
+const UNMASKED_VENDOR_WEBGL = 0x9245;
+const UNMASKED_RENDERER_WEBGL = 0x9246;
+
+function isNonEmptyString(s) {
+ return s && (typeof s) == "string";
+}
+
+var canvas = document.createElement("canvas");
+var gl = canvas.getContext("experimental-webgl");
+ok(!gl.getError(), "getError on newly created WebGL context should return NO_ERROR");
+
+ok(!gl.getParameter(UNMASKED_VENDOR_WEBGL) && gl.getError() == gl.INVALID_ENUM,
+ "Should not be able to query UNMASKED_VENDOR_WEBGL without having enabled the WEBGL_debug_renderer_info extension");
+ok(!gl.getParameter(UNMASKED_RENDERER_WEBGL) && gl.getError() == gl.INVALID_ENUM,
+ "Should not be able to query UNMASKED_RENDERER_WEBGL without having enabled the WEBGL_debug_renderer_info extension");
+
+var exts = gl.getSupportedExtensions();
+ok(exts.includes("WEBGL_debug_renderer_info"),
+ "WEBGL_debug_renderer_info should be listed by getSupportedExtensions in chrome contexts");
+var ext = gl.getExtension("WEBGL_debug_renderer_info");
+ok(ext,
+ "WEBGL_debug_renderer_info should be available through getExtension in chrome contexts");
+
+ok(ext.UNMASKED_VENDOR_WEBGL == UNMASKED_VENDOR_WEBGL,
+ "UNMASKED_VENDOR_WEBGL has the correct value");
+ok(ext.UNMASKED_RENDERER_WEBGL == UNMASKED_RENDERER_WEBGL,
+ "UNMASKED_RENDERER_WEBGL has the correct value");
+
+ok(isNonEmptyString(gl.getParameter(UNMASKED_VENDOR_WEBGL)) && gl.getError() == gl.NO_ERROR,
+ "Should be able to query UNMASKED_VENDOR_WEBGL in chrome context with WEBGL_debug_renderer_info enabled");
+ok(isNonEmptyString(gl.getParameter(UNMASKED_RENDERER_WEBGL)) && gl.getError() == gl.NO_ERROR,
+ "Should be able to query UNMASKED_RENDERER_WEBGL in chrome context with WEBGL_debug_renderer_info enabled");
+
+</script>
+</body>
+</html>