mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
79 lines
3.9 KiB
JavaScript
79 lines
3.9 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/*
|
|
* Test Amazon search plugin URLs
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const BROWSER_SEARCH_PREF = "browser.search.";
|
|
|
|
function test() {
|
|
let engine = Services.search.getEngineByName("Amazon.com");
|
|
ok(engine, "Amazon.com");
|
|
|
|
let base = "http://www.amazon.com/exec/obidos/external-search/?field-keywords=foo&mode=blended&tag=mozilla-20&sourceid=Mozilla-search";
|
|
let url;
|
|
|
|
// Test search URLs (including purposes).
|
|
url = engine.getSubmission("foo").uri.spec;
|
|
is(url, base, "Check search URL for 'foo'");
|
|
|
|
// Check search suggestion URL.
|
|
url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
|
|
is(url, "https://completion.amazon.com/search/complete?q=foo&search-alias=aps&mkt=1", "Check search suggestion URL for 'foo'");
|
|
|
|
// Check all other engine properties.
|
|
const EXPECTED_ENGINE = {
|
|
name: "Amazon.com",
|
|
alias: null,
|
|
description: "Amazon.com Search",
|
|
searchForm: "http://www.amazon.com/exec/obidos/external-search/?field-keywords=&mode=blended&tag=mozilla-20&sourceid=Mozilla-search",
|
|
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
|
|
hidden: false,
|
|
wrappedJSObject: {
|
|
queryCharset: "UTF-8",
|
|
"_iconURL": "data:image/x-icon;base64,AAABAAIAEBAAAAAAAAC0AQAAJgAAACAgAAAAAAAA6QIAANoBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAF7SURBVDjLlZPLasJAFIaFRF+iVV+h6hO0GF+gVB9AaHwDt64qCG03tQgtdCFIuyhUelmGli66MXThSt24kNiFBUlAYi6ezjnNxSuawB/ITP7v/HNmJgQAEaZzpgHs/gwcTyTE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ubA728RlTjMiwiH6zEEfvIrwdZFtQmMJ7W/ofIDBZD5m3mVZGwJcOP2kmILIlCkE45HoPWurwCSg0+UQRD4ZyXxId+T7gQb9+4q9sioY5ltrOG3L5vqXiiJffDx/aUi83ZJ7jr2ohcEu8Hh6/m+I7OWGiVxbWKHsz+O3vSOakqFQdsFgQeJUiKD7Wv9YKXBgCeSUC3v2kM5EJhlHDh3NcgcPlG1BXZu98sDmTuBa4fsMnz9fniJUaGzs+eMC540XuR0aDO2L8Y3qPyMcdOM+R/8XcqRA3qp9gAAAABJRU5ErkJggg==",
|
|
_urls : [
|
|
{
|
|
type: "application/x-suggestions+json",
|
|
method: "GET",
|
|
template: "https://completion.amazon.com/search/complete?q={searchTerms}&search-alias=aps&mkt=1",
|
|
params: "",
|
|
},
|
|
{
|
|
type: "text/html",
|
|
method: "GET",
|
|
template: "http://www.amazon.com/exec/obidos/external-search/",
|
|
params: [
|
|
{
|
|
name: "field-keywords",
|
|
value: "{searchTerms}",
|
|
purpose: undefined,
|
|
},
|
|
{
|
|
name: "mode",
|
|
value: "blended",
|
|
purpose: undefined,
|
|
},
|
|
{
|
|
name: "tag",
|
|
value: "mozilla-20",
|
|
purpose: undefined,
|
|
},
|
|
{
|
|
name: "sourceid",
|
|
value: "Mozilla-search",
|
|
purpose: undefined,
|
|
},
|
|
],
|
|
mozparams: {},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
isSubObjectOf(EXPECTED_ENGINE, engine, "Amazon");
|
|
}
|