mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900137 - xpcshell tests r=yoric
This commit is contained in:
parent
2328da6a3d
commit
c531180a28
@ -0,0 +1,22 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>IconsTest</ShortName>
|
||||
<Description>IconsTest. Search by Test.</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">data:image/x-icon;base64,ico16</Image>
|
||||
<Image width="32" height="32">data:image/x-icon;base64,ico32</Image>
|
||||
<Image width="74" height="74">data:image/png;base64,ico74</Image>
|
||||
<Url type="application/x-suggestions+json" template="http://api.bing.com/osjson.aspx">
|
||||
<Param name="query" value="{searchTerms}"/>
|
||||
<Param name="form" value="MOZW"/>
|
||||
</Url>
|
||||
<Url type="text/html" method="GET" template="http://www.bing.com/search">
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
<MozParam name="pc" condition="pref" pref="ms-pc"/>
|
||||
<Param name="form" value="MOZW"/>
|
||||
</Url>
|
||||
<SearchForm>http://www.bing.com/search</SearchForm>
|
||||
</SearchPlugin>
|
@ -0,0 +1,78 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/*
|
||||
* Tests getIcons() and getIconURLBySize() on engine with multiple icons.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
|
||||
function test_multiIcon() {
|
||||
let engine = Services.search.getEngineByName("IconsTest");
|
||||
do_check_neq(engine, null);
|
||||
|
||||
do_print("Running tests on IconsTest engine");
|
||||
|
||||
do_print("The default should be the 16x16 icon");
|
||||
do_check_true(engine.iconURI.spec.contains("ico16"));
|
||||
|
||||
do_check_true(engine.getIconURLBySize(32,32).contains("ico32"));
|
||||
do_check_true(engine.getIconURLBySize(74,74).contains("ico74"));
|
||||
|
||||
do_print("Invalid dimensions should return null.");
|
||||
do_check_null(engine.getIconURLBySize(50,50));
|
||||
|
||||
let allIcons = engine.getIcons();
|
||||
|
||||
do_print("Check that allIcons contains expected icon sizes");
|
||||
do_check_eq(allIcons.length, 3);
|
||||
let expectedWidths = [16, 32, 74];
|
||||
do_check_true(allIcons.every((item) => {
|
||||
let width = item.width;
|
||||
do_check_neq(expectedWidths.indexOf(width), -1);
|
||||
do_check_eq(width, item.height);
|
||||
|
||||
let icon = item.url.split(",").pop();
|
||||
do_check_eq(icon, "ico" + width);
|
||||
|
||||
return true;
|
||||
}));
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
removeMetadata();
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
httpServer.stop(function() {});
|
||||
});
|
||||
|
||||
do_test_pending();
|
||||
|
||||
let observer = function(aSubject, aTopic, aData) {
|
||||
if (aData == "engine-loaded") {
|
||||
test_multiIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Services.obs.addObserver(observer, "browser-search-engine-modified", false);
|
||||
|
||||
do_print("Adding engine with multiple images");
|
||||
Services.search.addEngine("http://localhost:4444/data/engineImages.xml",
|
||||
Ci.nsISearchEngine.DATA_XML, null, false);
|
||||
|
||||
do_timeout(12000, function() {
|
||||
do_throw("Timeout");
|
||||
});
|
||||
}
|
@ -7,6 +7,7 @@ support-files =
|
||||
data/engine.src
|
||||
data/engine.xml
|
||||
data/engine2.xml
|
||||
data/engineImages.xml
|
||||
data/ico-size-16x16-png.ico
|
||||
data/search-metadata.json
|
||||
data/search.json
|
||||
@ -27,6 +28,7 @@ support-files =
|
||||
[test_prefSync.js]
|
||||
[test_notifications.js]
|
||||
[test_addEngine_callback.js]
|
||||
[test_multipleIcons.js]
|
||||
[test_async.js]
|
||||
[test_sync.js]
|
||||
[test_sync_fallback.js]
|
||||
|
Loading…
Reference in New Issue
Block a user