summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/tests/xpcshell/test_rel_searchform.js
blob: 79f217e0d42f4c35e5a1b9fdcd411568bbeab31d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* 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 = engineNames.map(e => ({ name: e, xmlFileName: e }));
  for (let engine of yield addTestEngines(items)) {
    do_check_eq(engine.searchForm, "http://" + engine.name + "/?search");
  }
});