Files
palemoon27/toolkit/components/search/tests/xpcshell/test_rel_searchform.js
T

34 lines
1021 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* Tests that <Url rel="searchform"/> is properly recognized as a searchForm.
*/
"use strict";
function run_test() {
removeMetadata();
updateAppInfo();
useHttpServer();
run_next_test();
}
add_task(function* test_rel_searchform() {
let engineNames = [
"engine-rel-searchform.xml",
"engine-rel-searchform-post.xml",
];
// The final searchForm of the engine should be a URL whose domain is the
// <ShortName> in the engine's XML and that has a ?search parameter. The
// point of the ?search parameter is to avoid accidentally matching the value
// returned as a last resort by Engine's searchForm getter, which is simply
// the prePath of the engine's first HTML <Url>.
let items = [for (e of engineNames) { name: e, xmlFileName: e }];
for (let engine of yield addTestEngines(items)) {
do_check_eq(engine.searchForm, "http://" + engine.name + "/?search");
}
});