From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- devtools/shared/qrcode/tests/chrome/chrome.ini | 5 ++ .../shared/qrcode/tests/chrome/test_decode.html | 66 ++++++++++++++++++++++ devtools/shared/qrcode/tests/xpcshell/.eslintrc.js | 6 ++ .../shared/qrcode/tests/xpcshell/test_encode.js | 30 ++++++++++ devtools/shared/qrcode/tests/xpcshell/xpcshell.ini | 6 ++ 5 files changed, 113 insertions(+) create mode 100644 devtools/shared/qrcode/tests/chrome/chrome.ini create mode 100644 devtools/shared/qrcode/tests/chrome/test_decode.html create mode 100644 devtools/shared/qrcode/tests/xpcshell/.eslintrc.js create mode 100644 devtools/shared/qrcode/tests/xpcshell/test_encode.js create mode 100644 devtools/shared/qrcode/tests/xpcshell/xpcshell.ini (limited to 'devtools/shared/qrcode/tests') diff --git a/devtools/shared/qrcode/tests/chrome/chrome.ini b/devtools/shared/qrcode/tests/chrome/chrome.ini new file mode 100644 index 0000000000..f73f845e74 --- /dev/null +++ b/devtools/shared/qrcode/tests/chrome/chrome.ini @@ -0,0 +1,5 @@ +[DEFAULT] +skip-if = os == 'android' +tags = devtools + +[test_decode.html] diff --git a/devtools/shared/qrcode/tests/chrome/test_decode.html b/devtools/shared/qrcode/tests/chrome/test_decode.html new file mode 100644 index 0000000000..cc74de2967 --- /dev/null +++ b/devtools/shared/qrcode/tests/chrome/test_decode.html @@ -0,0 +1,66 @@ + + + + + + Test decoding a simple message + + + + + + +

+ +
+
+ + diff --git a/devtools/shared/qrcode/tests/xpcshell/.eslintrc.js b/devtools/shared/qrcode/tests/xpcshell/.eslintrc.js new file mode 100644 index 0000000000..7f6b62a9e5 --- /dev/null +++ b/devtools/shared/qrcode/tests/xpcshell/.eslintrc.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = { + // Extend from the shared list of defined globals for mochitests. + extends: "../../../../.eslintrc.xpcshell.js", +}; diff --git a/devtools/shared/qrcode/tests/xpcshell/test_encode.js b/devtools/shared/qrcode/tests/xpcshell/test_encode.js new file mode 100644 index 0000000000..7c82cf50c0 --- /dev/null +++ b/devtools/shared/qrcode/tests/xpcshell/test_encode.js @@ -0,0 +1,30 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +/** + * Test encoding a simple message. + */ + +const { require } = ChromeUtils.importESModule( + "resource://devtools/shared/loader/Loader.sys.mjs" +); + +const QR = require("resource://devtools/shared/qrcode/index.js"); + +function run_test() { + const imgData = QR.encodeToDataURI("HELLO", "L"); + Assert.equal( + imgData.src, + "data:image/gif;base64,R0lGODdhOgA6AIAAAAAAAP///ywAAAAAOgA6AAAC" + + "/4yPqcvtD6OctNqLs968+w+G4gKU5nkaKKquLuW+QVy2tAkDTj3rfQts8CRDko" + + "+HPPoYRUgy9YsyldDm44mLWhHYZM6W7WaDqyCRGkZDySxpRGw2sqvLt1q5w/fo" + + "XyE6vnUQOJUHBlinMGh046V1F5PDqNcoqcgBOWKBKbK2N+aY+Ih49VkmqMcl2l" + + "dkhZUK1umE6jZXJ2ZJaujZaRqH4bpb2uZrJxvIt4Ebe9qoYYrJOsw8apz2bCut" + + "m9kqDcw52uuImyr5Oh1KXH1jrn2anuunywtODU/o2c6teceW39ZcLFg/fNMo1b" + + "t3jVw2dwTPwJq1KYG3gAklCgu37yGxeScYKyiCc+7DR34hPVQiuQ7UhJMagyEb" + + "lymmzJk0a9q8iTOnzp0NCgAAOw==" + ); + Assert.equal(imgData.width, 58); + Assert.equal(imgData.height, 58); +} diff --git a/devtools/shared/qrcode/tests/xpcshell/xpcshell.ini b/devtools/shared/qrcode/tests/xpcshell/xpcshell.ini new file mode 100644 index 0000000000..68d274268d --- /dev/null +++ b/devtools/shared/qrcode/tests/xpcshell/xpcshell.ini @@ -0,0 +1,6 @@ +[DEFAULT] +tags = devtools +head = +firefox-appdir = browser + +[test_encode.js] -- cgit v1.2.3