From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../search/tests/xpcshell/test_svg_icon.js | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 toolkit/components/search/tests/xpcshell/test_svg_icon.js (limited to 'toolkit/components/search/tests/xpcshell/test_svg_icon.js') diff --git a/toolkit/components/search/tests/xpcshell/test_svg_icon.js b/toolkit/components/search/tests/xpcshell/test_svg_icon.js new file mode 100644 index 000000000..5fd4781a1 --- /dev/null +++ b/toolkit/components/search/tests/xpcshell/test_svg_icon.js @@ -0,0 +1,52 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var url; +var requestHandled; + +const icon = + '' + + '' + + '' + + ''; + +function run_test() { + updateAppInfo(); + useHttpServer(); // Unused, but required to call addTestEngines. + + requestHandled = new Promise(resolve => { + let srv = new HttpServer(); + srv.registerPathHandler("/icon.svg", (metadata, response) => { + response.setStatusLine("1.0", 200, "OK"); + response.setHeader("Content-Type", "image/svg+xml", false); + + response.write(icon); + resolve(); + }); + srv.start(-1); + do_register_cleanup(() => srv.stop(() => {})); + + url = "http://localhost:" + srv.identity.primaryPort + "/icon.svg"; + }); + + run_next_test(); +} + +add_task(function* test_svg_icon() { + yield asyncInit(); + + let [engine] = yield addTestEngines([ + { name: "SVGIcon", details: [url, "", "SVG icon", "GET", + "http://icon.svg/search?q={searchTerms}"] }, + ]); + + yield requestHandled; + yield promiseAfterCache(); + + ok(engine.iconURI, "the engine has an icon"); + ok(engine.iconURI.spec.startsWith("data:image/svg+xml"), + "the icon is saved as an SVG data url"); +}); -- cgit v1.2.3