mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 06:20:41 +00:00
Bug 551274: Update nsAddonRepository for API version 1.5. r=drownsend, a=blocking-beta5
This commit is contained in:
parent
228b61509b
commit
ea571d2926
@ -58,6 +58,7 @@ pref("extensions.logging.enabled", false);
|
||||
|
||||
// Preferences for the Get Add-ons pane
|
||||
pref("extensions.getAddons.maxResults", 15);
|
||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%");
|
||||
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%");
|
||||
|
||||
// Preferences for AMO integration
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>test_AddonRepository_1@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Addon Repository Name</em:name>
|
||||
<em:description>Addon Repository Description</em:description>
|
||||
</Description>
|
||||
</RDF>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>test_AddonRepository_2@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Addon Repository Name</em:name>
|
||||
<em:description>Addon Repository Description</em:description>
|
||||
</Description>
|
||||
</RDF>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>test_AddonRepository_3@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Addon Repository Name</em:name>
|
||||
<em:description>Addon Repository Description</em:description>
|
||||
</Description>
|
||||
</RDF>
|
@ -5,6 +5,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>addon1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Addon already installed - SEARCH</summary>
|
||||
<description>Test description</description>
|
||||
@ -24,6 +30,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>install1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Install already exists - SEARCH</summary>
|
||||
<description>Test description</description>
|
||||
@ -43,6 +55,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>remote1@tests.mozilla.org</guid>
|
||||
<version>3.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test summary - SEARCH SEARCH</summary>
|
||||
<description>Test description</description>
|
||||
@ -62,6 +80,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>remote2@tests.mozilla.org</guid>
|
||||
<version>4.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test summary - SEARCHing SEARCH</summary>
|
||||
<description>Test description</description>
|
||||
@ -81,6 +105,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>remote3@tests.mozilla.org</guid>
|
||||
<version>5.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test summary - Does not match query</summary>
|
||||
<description>Test description</description>
|
||||
@ -100,6 +130,12 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>remote4@tests.mozilla.org</guid>
|
||||
<version>6.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test summary - SEARCHing SEARCH SEARCH</summary>
|
||||
<description>Test description</description>
|
||||
|
@ -0,0 +1,727 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1111">
|
||||
<!-- Passes all requirements -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator 1</name>
|
||||
<link>http://localhost:4444/creator1.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that a negative rating is ignored -->
|
||||
<rating>-2</rating>
|
||||
<!-- Test that a <reviews> with a blank review URL is ignored -->
|
||||
<reviews num=" 1111 "> </reviews>
|
||||
<!-- Test that a negative total_downloads is ignored -->
|
||||
<total_downloads>-2</total_downloads>
|
||||
<install>http://localhost:4444/test1.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes requirements. Tests optional attributes. Also tests that
|
||||
integer properties that are NaN in the XML are ignored -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<!-- Test that extensions pass -->
|
||||
<type id="1">Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.2</version>
|
||||
<authors>
|
||||
<!-- Test that the first author becomes the creator,
|
||||
and the second one is a developer -->
|
||||
<author>
|
||||
<name>Test Creator 2</name>
|
||||
<link>http://localhost:4444/creator2.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Test Developer 2</name>
|
||||
<link>http://localhost:4444/developer2.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary>Test Summary 2</summary>
|
||||
<description>Test Description 2</description>
|
||||
<developer_comments>Test Developer Comments 2</developer_comments>
|
||||
<eula>Test EULA 2</eula>
|
||||
<icon>http://localhost:4444/icon2.png</icon>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that multiple preview images are correctly parsed -->
|
||||
<previews>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:4444/full1-2.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/thumbnail1-2.png</thumbnail>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:4444/full2-2.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/thumbnail2-2.png</thumbnail>
|
||||
<caption>Caption 2</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
<rating>NaN</rating>
|
||||
<!-- Test that learnmore is used as the add-on's homepageURL
|
||||
if there is no homepage defined -->
|
||||
<learnmore>http://localhost:4444/learnmore2.html</learnmore>
|
||||
<support>http://localhost:4444/support2.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:4444/contribution2.html</link>
|
||||
<suggested_amount currency="USD">$11.11</suggested_amount>
|
||||
<meet_developers>http://localhost:4444/meetDevelopers2.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="NaN">http://localhost:4444/review2.html</reviews>
|
||||
<total_downloads>NaN</total_downloads>
|
||||
<weekly_downloads>NaN</weekly_downloads>
|
||||
<daily_users>NaN</daily_users>
|
||||
<last_updated epoch="NaN">Not an acual date</last_updated>
|
||||
<install size="NaN" os="ALL">http://localhost:4444/test2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes requirements. Tests optional attributes with extra whitespace. -->
|
||||
<addon>
|
||||
<name> PASS </name>
|
||||
<!-- Test that themes pass -->
|
||||
<type id=" 2 ">Theme</type>
|
||||
<guid> test3@tests.mozilla.org </guid>
|
||||
<version> 1.3 </version>
|
||||
<authors>
|
||||
<!-- Test that authors with blank names are ignored -->
|
||||
<author>
|
||||
<name> </name>
|
||||
<link> http://localhost:4444/ignore3.html </link>
|
||||
</author>
|
||||
<!-- Test that authors with blank links are ignored -->
|
||||
<author>
|
||||
<name> Test Creator Ignore </name>
|
||||
<link> </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> Test Creator 3 </name>
|
||||
<link> http://localhost:4444/creator3.html </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> First Test Developer 3 </name>
|
||||
<link> http://localhost:4444/developer1-3.html </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> </name>
|
||||
<link> </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> Second Test Developer 3 </name>
|
||||
<link> http://localhost:4444/developer2-3.html </link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary> Test Summary 3 </summary>
|
||||
<description> Test Description 3 </description>
|
||||
<developer_comments> Test Developer Comments 3 </developer_comments>
|
||||
<eula> Test EULA 3 </eula>
|
||||
<icon> http://localhost:4444/icon3.png </icon>
|
||||
<status id=" 4 ">Public</status>
|
||||
<!-- Test that an incompatible + compatible application list passes -->
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID> unknown@tests.mozilla.org </appID>
|
||||
<min_version> 1 </min_version>
|
||||
<max_version> 1 </max_version>
|
||||
</application>
|
||||
<application>
|
||||
<appID> xpcshell@tests.mozilla.org </appID>
|
||||
<min_version> 1 </min_version>
|
||||
<max_version> 1 </max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that primary images appear first in the add-on's screenshots array -->
|
||||
<previews>
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> http://localhost:4444/full2-3.png </full>
|
||||
<caption> Caption 2 - 3 </caption>
|
||||
</preview>
|
||||
<!-- Test that a preview without a <full> element is ignored -->
|
||||
<preview primary=" 0 ">
|
||||
<caption> Caption ignore - 3 </caption>
|
||||
</preview>
|
||||
<!-- Test that a preview with an empty <full> element is ignored -->
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> </full>
|
||||
<caption> Caption ignore - 3 </caption>
|
||||
<preview primary=" 1 ">
|
||||
<full type=" image/png "> http://localhost:4444/full1-3.png </full>
|
||||
<thumbnail type=" image/png "> http://localhost:4444/thumbnail1-3.png </thumbnail>
|
||||
<caption> Caption 1 - 3 </caption>
|
||||
</preview>
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> http://localhost:4444/full3-3.png </full>
|
||||
<thumbnail type=" image/png "> http://localhost:4444/thumbnail3-3.png </thumbnail>
|
||||
<caption> Caption 3 - 3 </caption>
|
||||
</preview>
|
||||
</preview>
|
||||
</previews>
|
||||
<!-- Test that a rating between 1 and 5 is correctly parsed -->
|
||||
<rating> 2 </rating>
|
||||
<!-- Test that hompage is used as the add-on's homepageURL
|
||||
even if learnmore is defined -->
|
||||
<learnmore> http://localhost:4444/learnmore3.html </learnmore>
|
||||
<homepage> http://localhost:4444/homepage3.html </homepage>
|
||||
<support> http://localhost:4444/support3.html </support>
|
||||
<contribution_data>
|
||||
<link> http://localhost:4444/contribution3.html </link>
|
||||
<suggested_amount currency="USD"> $11.11 </suggested_amount>
|
||||
<meet_developers> http://localhost:4444/meetDevelopers3.html </meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num=" 1111 "> http://localhost:4444/review3.html </reviews>
|
||||
<total_downloads> 2222 </total_downloads>
|
||||
<weekly_downloads> 3333 </weekly_downloads>
|
||||
<daily_users> 4444 </daily_users>
|
||||
<last_updated epoch=" 1265108645 "> 2010-01-02T03:04:05Z </last_updated>
|
||||
<!-- Test that an incompatible install is ignored -->
|
||||
<install size=" 9999 " os=" UNKNOWN "> http://localhost:4444/fail3.xpi </install>
|
||||
<!-- Test that OS matching is case-insensitive -->
|
||||
<install size=" 5555 " os=" xpCShell " hash=" sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3 "> http://localhost:4444/test3.xpi </install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because name is undefined -->
|
||||
<addon>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.4</version>
|
||||
<authors><author><name>Test Creator 4</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined name should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test4.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because name is empty-->
|
||||
<addon>
|
||||
<name> </name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.5</version>
|
||||
<authors><author><name>Test Creator 5</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty name should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test5.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.6</version>
|
||||
<authors><author><name>Test Creator 6</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test6.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="">Empty id attribute</type>
|
||||
<guid>test7@tests.mozilla.org</guid>
|
||||
<version>1.7</version>
|
||||
<authors><author><name>Test Creator 7</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test7.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is unknown -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="9999">Unknown</type>
|
||||
<guid>test8@tests.mozilla.org</guid>
|
||||
<version>1.8</version>
|
||||
<authors><author><name>Test Creator 8</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with unknown type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test8.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<version>1.9</version>
|
||||
<authors><author><name>Test Creator 9</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined guid should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test9.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid> </guid>
|
||||
<version>1.10</version>
|
||||
<authors><author><name>Test Creator 10</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty guid should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test10.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid matches previously successful result -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.11</version>
|
||||
<authors><author><name>Test Creator 11</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches a previously successful result should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test11.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid matches already installed add-on -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<version>1.12</version>
|
||||
<authors><author><name>Test Creator 12</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches an installed Addon should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test12.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test13@tests.mozilla.org</guid>
|
||||
<authors><author><name>Test Creator 13</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test13.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because version is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test14@tests.mozilla.org</guid>
|
||||
<version> </version>
|
||||
<authors><author><name>Test Creator 14</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test14.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because authors undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test15@tests.mozilla.org</guid>
|
||||
<version>1.15</version>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined authors should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test15.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because it has no defined author elements -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test16@tests.mozilla.org</guid>
|
||||
<version>1.16</version>
|
||||
<authors></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no defined author elements should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test16.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because no non-empty author elements -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test17@tests.mozilla.org</guid>
|
||||
<version>1.17</version>
|
||||
<authors>
|
||||
<author><name></name></author>
|
||||
<author><name></name> </author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no non-empty author elements should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test17.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because status is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test18@tests.mozilla.org</guid>
|
||||
<version>1.18</version>
|
||||
<authors><author><name>Test Creator 18</name></author></authors>
|
||||
<summary>Add-on with undefined status should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test18.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because status is not Public -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test19@tests.mozilla.org</guid>
|
||||
<version>1.19</version>
|
||||
<authors><author><name>Test Creator 19</name></author></authors>
|
||||
<status id="9999">Unknown</status>
|
||||
<summary>Add-on with non-Public status should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test19.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible_applications is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test20@tests.mozilla.org</guid>
|
||||
<version>1.20</version>
|
||||
<authors><author><name>Test Creator 20</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined compatible_applications should be ignored.</summary>
|
||||
<install>http://localhost:4444/test20.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because no compatible applications matched -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test21@tests.mozilla.org</guid>
|
||||
<version>1.21</version>
|
||||
<authors><author><name>Test Creator 21</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no compatible applications should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test21.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's min version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test22@tests.mozilla.org</guid>
|
||||
<version>1.22</version>
|
||||
<authors><author><name>Test Creator 22</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too high of a compatible application min version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<max_version>2.0</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test22.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's min version too high -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test23@tests.mozilla.org</guid>
|
||||
<version>1.23</version>
|
||||
<authors><author><name>Test Creator 23</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too high of a compatible application min version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1.1</min_version>
|
||||
<max_version>2.0</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test23.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's max version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test24@tests.mozilla.org</guid>
|
||||
<version>1.24</version>
|
||||
<authors><author><name>Test Creator 24</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too low of a compatible application max version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.9</min_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test24.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's max version is too low -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test25@tests.mozilla.org</guid>
|
||||
<version>1.25</version>
|
||||
<authors><author><name>Test Creator 25</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too low of a compatible application max version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>0.9.9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test25.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test26@tests.mozilla.org</guid>
|
||||
<version>1.26</version>
|
||||
<authors><author><name>Test Creator 26</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined XPI URL should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test27@tests.mozilla.org</guid>
|
||||
<version>1.27</version>
|
||||
<authors><author><name>Test Creator 27</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with an empty XPI URL should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install> </install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because install not compatible with OS -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test28@tests.mozilla.org</guid>
|
||||
<version>1.28</version>
|
||||
<authors><author><name>Test Creator 28</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no installs with compatible OS should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="UNKNOWN1">http://localhost:4444/test28.xpi</install>
|
||||
<install os="UNKNOWN2">http://localhost:4444/test28.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL matches an installing AddonInstall -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test29@tests.mozilla.org</guid>
|
||||
<version>1.29</version>
|
||||
<authors><author><name>Test Creator 29</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with an XPI URL that matches an installing AddonInstall should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/addons/test_AddonRepository_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes because the Addon that has a matching XPI URL
|
||||
has a state = STATE_AVAILABLE (non-active install). This is the
|
||||
last passing add-on. -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test-lastPassing@tests.mozilla.org</guid>
|
||||
<version>2.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator - Last Passing</name>
|
||||
<link>http://localhost:4444/creatorLastPassing.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that a rating > 5 becomes a rating = 5 -->
|
||||
<rating>10</rating>
|
||||
<install>http://localhost:4444/addons/test_AddonRepository_3.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because of MAX_RESULTS limit. The previous <addon> should
|
||||
be the last passing add-on in order to correctly test the limit. -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test-surpassesLimit@tests.mozilla.org</guid>
|
||||
<version>9.9</version>
|
||||
<authors><author><name>Test Creator - Surpasses Limit</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on should not be added because doing so would surpass MAX_RESULTS limit</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test-surpassesLimit.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="9999">
|
||||
<!-- Cause XML parse error so that the search fails -->
|
||||
<!-- <addon> -->
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors><author><name>Test Creator 1</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test1.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1111">
|
||||
<!-- Passes even though XPI URL matches an installing AddonInstall.
|
||||
Tests optional attributes. -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator 1</name>
|
||||
<link>http://localhost:4444/creator1.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Test Developer 1</name>
|
||||
<link>http://localhost:4444/developer1.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary>Test Summary 1</summary>
|
||||
<description>Test Description 1</description>
|
||||
<eula>Test EULA 1</eula>
|
||||
<developer_comments>Test Developer Comments 1</developer_comments>
|
||||
<icon>http://localhost:4444/icon1.png</icon>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<previews>
|
||||
<preview primary="1">
|
||||
<full type="image/png">http://localhost:4444/full1-1.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/thumbnail1-1.png</thumbnail>
|
||||
<caption>Caption 1 - 1</caption>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:4444/full2-1.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/thumbnail2-1.png</thumbnail>
|
||||
<caption>Caption 2 - 1</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
<rating>4</rating>
|
||||
<learnmore>http://localhost:4444/learnmore1.html</learnmore>
|
||||
<support>http://localhost:4444/support1.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:4444/contribution1.html</link>
|
||||
<suggested_amount currency="USD">$11.11</suggested_amount>
|
||||
<meet_developers>http://localhost:4444/meetDevelopers1.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="1111">http://localhost:4444/review1.html</reviews>
|
||||
<total_downloads>2222</total_downloads>
|
||||
<weekly_downloads>3333</weekly_downloads>
|
||||
<daily_users>4444</daily_users>
|
||||
<last_updated epoch="1265108645">2010-01-02T03:04:05Z</last_updated>
|
||||
<install size="5555">http://localhost:4444/addons/test_AddonRepository_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid matches previously successful result -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.2</version>
|
||||
<authors><author><name>Test Creator 2</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches a previously successful result should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid was not requested -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>notRequested@tests.mozilla.org</guid>
|
||||
<version>1.3</version>
|
||||
<authors><author><name>Test Creator 3</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that wasn't requested should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:4444/test3.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes even though guid matches already installed add-on,
|
||||
type is unknown, no defined author elements, status is not Public,
|
||||
no compatible applications matched, no installs compatible with OS
|
||||
-->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="9999">Unknown</type>
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<version>1.4</version>
|
||||
<status id="9999">Unknown</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="UNKNOWN1">http://localhost:4444/test4.xpi</install>
|
||||
<install os="UNKNOWN2">http://localhost:4444/test4.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='2'>Sandbox</status>
|
||||
<summary>Should not return sandboxed add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an incompatible add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>2</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test3@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an incompatible add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Firefox</name>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>2</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an add-on for a different OS</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>Windows</compatible_os>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>This should work fine</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install size="234" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>bug397778@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return items that are already installed</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not include the same result twice</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='2'>Theme</type>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<rating>4</rating>
|
||||
<summary>Specific OS should work fine</summary>
|
||||
<eula>EULA should be confirmed</eula>
|
||||
<thumbnail>http://localhost:4444/test_bug404024/thumbnail.png</thumbnail>
|
||||
<icon>http://localhost:4444/test_bug404024/icon.png</icon>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>XPCShell</compatible_os>
|
||||
<install size="1204">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -1,178 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="100">
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='2'>Sandbox</status>
|
||||
<summary>Should not return sandboxed add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an incompatible add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>2</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test3@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an incompatible add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Firefox</name>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>2</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an add-on for a different OS</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="Windows" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>
|
||||
This should work fine
|
||||
</summary>
|
||||
<description>
|
||||
Test description
|
||||
</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>
|
||||
https://addons.mozilla.org/addon/5992
|
||||
</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>bug397778@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return items that are already installed</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not include the same result twice</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='2'>Theme</type>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<status id='4'>Public</status>
|
||||
<rating>4</rating>
|
||||
<summary>Specific OS should work fine</summary>
|
||||
<eula>EULA should be confirmed</eula>
|
||||
<thumbnail>
|
||||
http://localhost:4444/test_bug404024/thumbnail.png
|
||||
</thumbnail>
|
||||
<icon>
|
||||
http://localhost:4444/test_bug404024/icon.png
|
||||
</icon>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="Windows" size="123">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
<install os="XPCShell" size="456">
|
||||
http://localhost:4444/XPCShell.xpi
|
||||
</install>
|
||||
<install os="Darwin" size="789">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -5,166 +5,181 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>-5</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>0</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test3@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>2</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>4</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>5</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>10</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test7@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>TEST</name>
|
||||
<rating>100</rating>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test8@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test addon</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
@ -5,277 +5,287 @@
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an incompatible add-on</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>2</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test3@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not return an add-on for a different OS</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="Windows" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install os="UNKNOWN">http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>
|
||||
This should work fine
|
||||
</summary>
|
||||
<description>
|
||||
Test description
|
||||
</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>
|
||||
https://addons.mozilla.org/addon/5992
|
||||
</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Should not include the same result twice</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<learnmore>https://addons.mozilla.org/addon/5992</learnmore>
|
||||
<install os="ALL" hash="sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3">http://localhost:4444/test.xpi</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='2'>Theme</type>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<rating>4</rating>
|
||||
<summary>Specific OS should work fine</summary>
|
||||
<eula>EULA should be confirmed</eula>
|
||||
<thumbnail>
|
||||
http://localhost:4444/test_bug404024/thumbnail.png
|
||||
</thumbnail>
|
||||
<icon>
|
||||
http://localhost:4444/test_bug404024/icon.png
|
||||
</icon>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="Windows">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
<install os="XPCShell">
|
||||
http://localhost:4444/XPCShell.xpi
|
||||
</install>
|
||||
<install os="Darwin">
|
||||
http://localhost:4444/test.xpi
|
||||
</install>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test7@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test8@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test9@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test10@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test11@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>test12@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://localhost:4444/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Test sumary</summary>
|
||||
<description>Test description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<application_id>1</application_id>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install>http://localhost:4444/test.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
604
toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
Normal file
604
toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
Normal file
@ -0,0 +1,604 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests AddonRepository.jsm
|
||||
|
||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
|
||||
|
||||
do_load_httpd_js();
|
||||
var gServer;
|
||||
|
||||
const PREF_GETADDONS_BROWSEADDONS = "extensions.getAddons.browseAddons";
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_GETADDONS_BROWSERECOMMENDED = "extensions.getAddons.recommended.browseURL";
|
||||
const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url";
|
||||
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
|
||||
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
|
||||
|
||||
const PORT = 4444;
|
||||
const BASE_URL = "http://localhost:" + PORT;
|
||||
const DEFAULT_URL = "about:blank";
|
||||
|
||||
// Path to source URI of installed add-on
|
||||
const INSTALL_URL1 = "/addons/test_AddonRepository_1.xpi";
|
||||
// Path to source URI of installing add-on
|
||||
const INSTALL_URL2 = "/addons/test_AddonRepository_2.xpi";
|
||||
// Path to source URI of non-active add-on (state = STATE_AVAILABLE)
|
||||
const INSTALL_URL3 = "/addons/test_AddonRepository_3.xpi";
|
||||
|
||||
// Properties of an individual add-on that should be checked
|
||||
// Note: name is checked separately
|
||||
var ADDON_PROPERTIES = ["id", "type", "version", "creator", "developers",
|
||||
"description", "fullDescription", "developerComments",
|
||||
"eula", "iconURL", "screenshots", "homepageURL",
|
||||
"supportURL", "contributionURL", "contributionAmount",
|
||||
"averageRating", "reviewCount", "reviewURL",
|
||||
"totalDownloads", "weeklyDownloads", "dailyUsers",
|
||||
"sourceURI", "repositoryStatus", "size", "updateDate"];
|
||||
|
||||
// Properties of an individual screenshot that should be checked
|
||||
var SCREENSHOT_PROPERTIES = ["url", "thumbnailURL", "caption"]
|
||||
|
||||
// Properties of an individual creator or developer that should be checked
|
||||
var AUTHOR_PROPERTIES = ["name", "url"];
|
||||
|
||||
// Results of getAddonsByIDs
|
||||
var GET_RESULTS = [{
|
||||
id: "test1@tests.mozilla.org",
|
||||
type: "extension",
|
||||
version: "1.1",
|
||||
creator: {
|
||||
name: "Test Creator 1",
|
||||
url: BASE_URL + "/creator1.html"
|
||||
},
|
||||
developers: [{
|
||||
name: "Test Developer 1",
|
||||
url: BASE_URL + "/developer1.html"
|
||||
}],
|
||||
description: "Test Summary 1",
|
||||
fullDescription: "Test Description 1",
|
||||
developerComments: "Test Developer Comments 1",
|
||||
eula: "Test EULA 1",
|
||||
iconURL: BASE_URL + "/icon1.png",
|
||||
screenshots: [{
|
||||
url: BASE_URL + "/full1-1.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail1-1.png",
|
||||
caption: "Caption 1 - 1"
|
||||
}, {
|
||||
url: BASE_URL + "/full2-1.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail2-1.png",
|
||||
caption: "Caption 2 - 1"
|
||||
}],
|
||||
homepageURL: BASE_URL + "/learnmore1.html",
|
||||
supportURL: BASE_URL + "/support1.html",
|
||||
contributionURL: BASE_URL + "/meetDevelopers1.html",
|
||||
contributionAmount: "$11.11",
|
||||
averageRating: 4,
|
||||
reviewCount: 1111,
|
||||
reviewURL: BASE_URL + "/review1.html",
|
||||
totalDownloads: 2222,
|
||||
weeklyDownloads: 3333,
|
||||
dailyUsers: 4444,
|
||||
sourceURI: BASE_URL + INSTALL_URL2,
|
||||
repositoryStatus: 4,
|
||||
size: 5555,
|
||||
updateDate: new Date(1265033045000)
|
||||
}, {
|
||||
id: "test_AddonRepository_1@tests.mozilla.org",
|
||||
version: "1.4",
|
||||
developers: [],
|
||||
screenshots: [],
|
||||
repositoryStatus: 9999
|
||||
}];
|
||||
|
||||
// Results of retrieveRecommendedAddons and searchAddons
|
||||
var SEARCH_RESULTS = [{
|
||||
id: "test1@tests.mozilla.org",
|
||||
type: "extension",
|
||||
version: "1.1",
|
||||
creator: {
|
||||
name: "Test Creator 1",
|
||||
url: BASE_URL + "/creator1.html"
|
||||
},
|
||||
developers: [],
|
||||
screenshots: [],
|
||||
repositoryStatus: 4,
|
||||
sourceURI: BASE_URL + "/test1.xpi"
|
||||
}, {
|
||||
id: "test2@tests.mozilla.org",
|
||||
type: "extension",
|
||||
version: "1.2",
|
||||
creator: {
|
||||
name: "Test Creator 2",
|
||||
url: BASE_URL + "/creator2.html"
|
||||
},
|
||||
developers: [{
|
||||
name: "Test Developer 2",
|
||||
url: BASE_URL + "/developer2.html"
|
||||
}],
|
||||
description: "Test Summary 2",
|
||||
fullDescription: "Test Description 2",
|
||||
developerComments: "Test Developer Comments 2",
|
||||
eula: "Test EULA 2",
|
||||
iconURL: BASE_URL + "/icon2.png",
|
||||
screenshots: [{
|
||||
url: BASE_URL + "/full1-2.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail1-2.png"
|
||||
}, {
|
||||
url: BASE_URL + "/full2-2.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail2-2.png",
|
||||
caption: "Caption 2"
|
||||
}],
|
||||
homepageURL: BASE_URL + "/learnmore2.html",
|
||||
supportURL: BASE_URL + "/support2.html",
|
||||
contributionURL: BASE_URL + "/meetDevelopers2.html",
|
||||
contributionAmount: "$11.11",
|
||||
repositoryStatus: 4,
|
||||
sourceURI: BASE_URL + "/test2.xpi"
|
||||
}, {
|
||||
id: "test3@tests.mozilla.org",
|
||||
type: "theme",
|
||||
version: "1.3",
|
||||
creator: {
|
||||
name: "Test Creator 3",
|
||||
url: BASE_URL + "/creator3.html"
|
||||
},
|
||||
developers: [{
|
||||
name: "First Test Developer 3",
|
||||
url: BASE_URL + "/developer1-3.html"
|
||||
}, {
|
||||
name: "Second Test Developer 3",
|
||||
url: BASE_URL + "/developer2-3.html"
|
||||
}],
|
||||
description: "Test Summary 3",
|
||||
fullDescription: "Test Description 3",
|
||||
developerComments: "Test Developer Comments 3",
|
||||
eula: "Test EULA 3",
|
||||
iconURL: BASE_URL + "/icon3.png",
|
||||
screenshots: [{
|
||||
url: BASE_URL + "/full1-3.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail1-3.png",
|
||||
caption: "Caption 1 - 3"
|
||||
}, {
|
||||
url: BASE_URL + "/full2-3.png",
|
||||
caption: "Caption 2 - 3"
|
||||
}, {
|
||||
url: BASE_URL + "/full3-3.png",
|
||||
thumbnailURL: BASE_URL + "/thumbnail3-3.png",
|
||||
caption: "Caption 3 - 3"
|
||||
}],
|
||||
homepageURL: BASE_URL + "/homepage3.html",
|
||||
supportURL: BASE_URL + "/support3.html",
|
||||
contributionURL: BASE_URL + "/meetDevelopers3.html",
|
||||
contributionAmount: "$11.11",
|
||||
averageRating: 2,
|
||||
reviewCount: 1111,
|
||||
reviewURL: BASE_URL + "/review3.html",
|
||||
totalDownloads: 2222,
|
||||
weeklyDownloads: 3333,
|
||||
dailyUsers: 4444,
|
||||
sourceURI: BASE_URL + "/test3.xpi",
|
||||
repositoryStatus: 4,
|
||||
size: 5555,
|
||||
updateDate: new Date(1265033045000)
|
||||
}, {
|
||||
id: "test-lastPassing@tests.mozilla.org",
|
||||
type: "extension",
|
||||
version: "2.0",
|
||||
creator: {
|
||||
name: "Test Creator - Last Passing",
|
||||
url: BASE_URL + "/creatorLastPassing.html"
|
||||
},
|
||||
developers: [],
|
||||
screenshots: [],
|
||||
averageRating: 5,
|
||||
repositoryStatus: 4,
|
||||
sourceURI: BASE_URL + "/addons/test_AddonRepository_3.xpi"
|
||||
}];
|
||||
|
||||
const TOTAL_RESULTS = 1111;
|
||||
const MAX_RESULTS = SEARCH_RESULTS.length;
|
||||
|
||||
// Used to differentiate between testing that a search success
|
||||
// or a search failure for retrieveRecommendedAddons and searchAddons
|
||||
const FAILED_MAX_RESULTS = 9999;
|
||||
|
||||
// Values for testing AddonRepository.getAddonsByIDs()
|
||||
var GET_TEST = {
|
||||
preference: PREF_GETADDONS_BYIDS,
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%/%API_VERSION%/" +
|
||||
"%API_VERSION%/%IDS%",
|
||||
failedIDs: ["test1@tests.mozilla.org"],
|
||||
failedURL: "/XPCShell/1/1.5/1.5/test1%40tests.mozilla.org",
|
||||
successfulIDs: ["test1@tests.mozilla.org",
|
||||
"{00000000-1111-2222-3333-444444444444}",
|
||||
"test_AddonRepository_1@tests.mozilla.org"],
|
||||
successfulURL: "/XPCShell/1/1.5/1.5/test1%40tests.mozilla.org," +
|
||||
"%7B00000000-1111-2222-3333-444444444444%7D," +
|
||||
"test_AddonRepository_1%40tests.mozilla.org"
|
||||
};
|
||||
|
||||
// Values for testing AddonRepository.retrieveRecommendedAddons()
|
||||
var RECOMMENDED_TEST = {
|
||||
preference: PREF_GETADDONS_GETRECOMMENDED,
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%/%API_VERSION%/" +
|
||||
"%API_VERSION%/%MAX_RESULTS%",
|
||||
failedURL: "/XPCShell/1/1.5/1.5/" + (2 * FAILED_MAX_RESULTS),
|
||||
successfulURL: "/XPCShell/1/1.5/1.5/" + (2 * MAX_RESULTS)
|
||||
};
|
||||
|
||||
// Values for testing AddonRepository.searchAddons()
|
||||
var SEARCH_TEST = {
|
||||
searchTerms: "odd=search:with&weird\"characters",
|
||||
preference: PREF_GETADDONS_GETSEARCHRESULTS,
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%/%API_VERSION%/" +
|
||||
"%API_VERSION%/%MAX_RESULTS%/%TERMS%",
|
||||
failedURL: "/XPCShell/1/1.5/1.5/" + (2 * FAILED_MAX_RESULTS) +
|
||||
"/odd%3Dsearch%3Awith%26weird%22characters",
|
||||
successfulURL: "/XPCShell/1/1.5/1.5/" + (2 * MAX_RESULTS) +
|
||||
"/odd%3Dsearch%3Awith%26weird%22characters"
|
||||
};
|
||||
|
||||
// Check that objects are equal for specified properties
|
||||
function check_object(aActual, aExpected, aProperties) {
|
||||
aProperties.forEach(function(aProperty) {
|
||||
// Check that all undefined expected properties are null on actual add-on
|
||||
if (!aExpected.hasOwnProperty(aProperty)) {
|
||||
do_check_eq(aActual[aProperty], null);
|
||||
return;
|
||||
}
|
||||
|
||||
var actualValue = aActual[aProperty];
|
||||
var expectedValue = aExpected[aProperty];
|
||||
|
||||
switch (aProperty) {
|
||||
case "creator":
|
||||
do_check_eq(actualValue.toString(), expectedValue.name);
|
||||
check_object(actualValue, expectedValue, AUTHOR_PROPERTIES);
|
||||
break;
|
||||
|
||||
case "developers":
|
||||
do_check_eq(actualValue.length, expectedValue.length);
|
||||
for (var i = 0; i < actualValue.length; i++) {
|
||||
do_check_eq(actualValue[i].toString(), expectedValue[i].name);
|
||||
check_object(actualValue[i], expectedValue[i], AUTHOR_PROPERTIES);
|
||||
}
|
||||
break;
|
||||
|
||||
case "screenshots":
|
||||
do_check_eq(actualValue.length, expectedValue.length);
|
||||
for (var i = 0; i < actualValue.length; i++) {
|
||||
do_check_eq(actualValue[i].toString(), expectedValue[i].url);
|
||||
check_object(actualValue[i], expectedValue[i], SCREENSHOT_PROPERTIES);
|
||||
}
|
||||
break;
|
||||
|
||||
case "sourceURI":
|
||||
do_check_eq(actualValue.spec, expectedValue);
|
||||
break;
|
||||
|
||||
case "updateDate":
|
||||
do_check_eq(actualValue.getTime(), expectedValue.getTime());
|
||||
break;
|
||||
|
||||
default:
|
||||
if (actualValue !== expectedValue)
|
||||
do_throw("Failed for " + aProperty +
|
||||
" (" + actualValue + " === " + expectedValue + ")");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Test that actual results and expected results are equal
|
||||
function check_results(aActualAddons, aExpectedAddons, aAddonCount, aInstallNull) {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
|
||||
do_check_eq(aActualAddons.length, aAddonCount);
|
||||
do_check_eq(aActualAddons.length, aExpectedAddons.length);
|
||||
|
||||
for (var i = 0; i < aAddonCount; i++) {
|
||||
var actualAddon = aActualAddons[i];
|
||||
var expectedAddon = aExpectedAddons[i];
|
||||
|
||||
// Separately check name so better messages are outputted when failure
|
||||
if (actualAddon.name == "FAIL")
|
||||
do_throw(actualAddon.id + " - " + actualAddon.description);
|
||||
if (actualAddon.name != "PASS")
|
||||
do_throw(actualAddon.id + " - " + "invalid add-on name " + actualAddon.name);
|
||||
|
||||
do_check_eq(actualAddon.install == null, !!aInstallNull);
|
||||
|
||||
// Check that sourceURI property consistent within actual addon
|
||||
if (!aInstallNull)
|
||||
do_check_eq(actualAddon.install.sourceURI.spec, actualAddon.sourceURI.spec);
|
||||
|
||||
check_object(actualAddon, expectedAddon, ADDON_PROPERTIES);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete a search, also testing cancelSearch() and isSearching
|
||||
function complete_search(aSearch, aSearchCallback) {
|
||||
var failCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
do_throw("failCallback.searchSucceeded should not be called");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_throw("failCallback.searchFailed should not be called");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
var callbackCalled = false;
|
||||
var testCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
do_throw("testCallback.searchSucceeded should not be called");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
callbackCalled = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Should fail because cancelled it immediately
|
||||
aSearch(failCallback);
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
AddonRepository.cancelSearch();
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
|
||||
aSearch(aSearchCallback);
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
|
||||
// searchFailed should be called immediately because already searching
|
||||
aSearch(testCallback);
|
||||
do_check_true(callbackCalled);
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
}
|
||||
|
||||
|
||||
function run_test() {
|
||||
// Setup for test
|
||||
do_test_pending();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
startupManager();
|
||||
|
||||
// Install an add-on so can check that it isn't returned in the results
|
||||
installAllFiles([do_get_addon("test_AddonRepository_1")], function() {
|
||||
restartManager();
|
||||
|
||||
gServer = new nsHttpServer();
|
||||
|
||||
// Register other add-on XPI files
|
||||
gServer.registerFile(INSTALL_URL2,
|
||||
do_get_addon("test_AddonRepository_2"));
|
||||
gServer.registerFile(INSTALL_URL3,
|
||||
do_get_addon("test_AddonRepository_3"));
|
||||
|
||||
// Register files used to test search failure
|
||||
gServer.registerFile(GET_TEST.failedURL,
|
||||
do_get_file("data/test_AddonRepository_failed.xml"));
|
||||
gServer.registerFile(RECOMMENDED_TEST.failedURL,
|
||||
do_get_file("data/test_AddonRepository_failed.xml"));
|
||||
gServer.registerFile(SEARCH_TEST.failedURL,
|
||||
do_get_file("data/test_AddonRepository_failed.xml"));
|
||||
|
||||
// Register files used to test search success
|
||||
gServer.registerFile(GET_TEST.successfulURL,
|
||||
do_get_file("data/test_AddonRepository_getAddonsByIDs.xml"));
|
||||
gServer.registerFile(RECOMMENDED_TEST.successfulURL,
|
||||
do_get_file("data/test_AddonRepository.xml"));
|
||||
gServer.registerFile(SEARCH_TEST.successfulURL,
|
||||
do_get_file("data/test_AddonRepository.xml"));
|
||||
|
||||
gServer.start(PORT);
|
||||
|
||||
// Create an active AddonInstall so can check that it isn't returned in the results
|
||||
AddonManager.getInstallForURL(BASE_URL + INSTALL_URL2, function(aInstall) {
|
||||
aInstall.install();
|
||||
|
||||
// Create a non-active AddonInstall so can check that it is returned in the results
|
||||
AddonManager.getInstallForURL(BASE_URL + INSTALL_URL3,
|
||||
run_test_1, "application/x-xpinstall");
|
||||
}, "application/x-xpinstall");
|
||||
});
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
gServer.stop(do_test_finished);
|
||||
}
|
||||
|
||||
// Tests homepageURL, getRecommendedURL() and getSearchURL()
|
||||
function run_test_1() {
|
||||
function check_urls(aPreference, aGetURL, aTests) {
|
||||
aTests.forEach(function(aTest) {
|
||||
Services.prefs.setCharPref(aPreference, aTest.preferenceValue);
|
||||
do_check_eq(aGetURL(aTest), aTest.expectedURL);
|
||||
});
|
||||
}
|
||||
|
||||
var urlTests = [{
|
||||
preferenceValue: BASE_URL,
|
||||
expectedURL: BASE_URL
|
||||
}, {
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%",
|
||||
expectedURL: BASE_URL + "/XPCShell/1"
|
||||
}];
|
||||
|
||||
// Extra tests for AddonRepository.getSearchURL();
|
||||
var searchURLTests = [{
|
||||
searchTerms: "test",
|
||||
preferenceValue: BASE_URL + "/search?q=%TERMS%",
|
||||
expectedURL: BASE_URL + "/search?q=test"
|
||||
}, {
|
||||
searchTerms: "test search",
|
||||
preferenceValue: BASE_URL + "/%TERMS%",
|
||||
expectedURL: BASE_URL + "/test%20search"
|
||||
}, {
|
||||
searchTerms: "odd=search:with&weird\"characters",
|
||||
preferenceValue: BASE_URL + "/%TERMS%",
|
||||
expectedURL: BASE_URL + "/odd%3Dsearch%3Awith%26weird%22characters"
|
||||
}];
|
||||
|
||||
// Setup tests for homepageURL, getRecommendedURL() and getSearchURL()
|
||||
var tests = [{
|
||||
initiallyUndefined: true,
|
||||
preference: PREF_GETADDONS_BROWSEADDONS,
|
||||
urlTests: urlTests,
|
||||
getURL: function() AddonRepository.homepageURL
|
||||
}, {
|
||||
initiallyUndefined: true,
|
||||
preference: PREF_GETADDONS_BROWSERECOMMENDED,
|
||||
urlTests: urlTests,
|
||||
getURL: function() AddonRepository.getRecommendedURL()
|
||||
}, {
|
||||
initiallyUndefined: true,
|
||||
preference: PREF_GETADDONS_BROWSESEARCHRESULTS,
|
||||
urlTests: urlTests.concat(searchURLTests),
|
||||
getURL: function getSearchURL(aTest) {
|
||||
var searchTerms = aTest && aTest.searchTerms ? aTest.searchTerms
|
||||
: "unused terms";
|
||||
return AddonRepository.getSearchURL(searchTerms);
|
||||
}
|
||||
}];
|
||||
|
||||
tests.forEach(function(aTest) {
|
||||
if (aTest.initiallyUndefined) {
|
||||
// Preference is not defined by default
|
||||
do_check_eq(Services.prefs.getPrefType(aTest.preference),
|
||||
Services.prefs.PREF_INVALID);
|
||||
do_check_eq(aTest.getURL(), DEFAULT_URL);
|
||||
}
|
||||
|
||||
check_urls(aTest.preference, aTest.getURL, aTest.urlTests);
|
||||
});
|
||||
|
||||
run_test_2();
|
||||
}
|
||||
|
||||
// Tests failure of AddonRepository.getAddonsByIDs()
|
||||
function run_test_2() {
|
||||
Services.prefs.setCharPref(GET_TEST.preference, GET_TEST.preferenceValue);
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_throw("searchAddons should not have succeeded");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
run_test_3();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.failedIDs, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
// Tests success of AddonRepository.getAddonsByIDs()
|
||||
function run_test_3() {
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_check_eq(aTotalResults, -1);
|
||||
check_results(aAddonsList, GET_RESULTS, aAddonCount, true);
|
||||
run_test_4();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_throw("searchAddons should not have failed");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.successfulIDs, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
// Tests failure of AddonRepository.retrieveRecommendedAddons()
|
||||
function run_test_4() {
|
||||
Services.prefs.setCharPref(RECOMMENDED_TEST.preference,
|
||||
RECOMMENDED_TEST.preferenceValue);
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_throw("retrieveRecommendedAddons should not have succeeded");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
run_test_5();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
AddonRepository.retrieveRecommendedAddons(FAILED_MAX_RESULTS, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
// Tests success of AddonRepository.retrieveRecommendedAddons()
|
||||
function run_test_5() {
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_check_eq(aTotalResults, -1);
|
||||
check_results(aAddonsList, SEARCH_RESULTS, aAddonCount);
|
||||
run_test_6();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_throw("retrieveRecommendedAddons should not have failed");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
AddonRepository.retrieveRecommendedAddons(MAX_RESULTS, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
// Tests failure of AddonRepository.searchAddons()
|
||||
function run_test_6() {
|
||||
Services.prefs.setCharPref(SEARCH_TEST.preference, SEARCH_TEST.preferenceValue);
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_throw("searchAddons should not have succeeded");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
run_test_7();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
var searchTerms = SEARCH_TEST.searchTerms;
|
||||
AddonRepository.searchAddons(searchTerms, FAILED_MAX_RESULTS, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
// Tests success of AddonRepository.searchAddons()
|
||||
function run_test_7() {
|
||||
var callback = {
|
||||
searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_check_eq(aTotalResults, TOTAL_RESULTS);
|
||||
check_results(aAddonsList, SEARCH_RESULTS, aAddonCount);
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
do_throw("searchAddons should not have failed");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function(aCallback) {
|
||||
var searchTerms = SEARCH_TEST.searchTerms;
|
||||
AddonRepository.searchAddons(searchTerms, MAX_RESULTS, aCallback);
|
||||
}, callback);
|
||||
}
|
||||
|
@ -1,216 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
|
||||
|
||||
const PREF_GETADDONS_BROWSEADDONS = "extensions.getAddons.browseAddons";
|
||||
const PREF_GETADDONS_BROWSERECOMMENDED = "extensions.getAddons.recommended.browseURL";
|
||||
const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url";
|
||||
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
|
||||
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
|
||||
|
||||
const BROWSE = "http://localhost:4444/";
|
||||
const RECOMMENDED = "http://localhost:4444/recommended.html";
|
||||
const SEARCH = "http://localhost:4444/search.html?q=";
|
||||
|
||||
var BROWSE_SEARCH_URLS = [
|
||||
["test", SEARCH + "test" ],
|
||||
["SEARCH", SEARCH + "SEARCH" ],
|
||||
["test search", SEARCH + "test%20search" ],
|
||||
["odd=search:with&weird\"characters", SEARCH + "odd%3Dsearch%3Awith%26weird%22characters" ]
|
||||
];
|
||||
|
||||
do_load_httpd_js();
|
||||
var server;
|
||||
|
||||
var RESULTS = [
|
||||
{
|
||||
id: "test5@tests.mozilla.org",
|
||||
name: "PASS",
|
||||
version: "1.0",
|
||||
description: "This should work fine",
|
||||
fullDescription: "Test description",
|
||||
rating: -1,
|
||||
iconURL: null,
|
||||
screenshots: [],
|
||||
homepageURL: "https://addons.mozilla.org/addon/5992",
|
||||
type: "extension",
|
||||
sourceURI: "http://localhost:4444/test.xpi",
|
||||
size: 234
|
||||
},
|
||||
{
|
||||
id: "test6@tests.mozilla.org",
|
||||
name: "PASS",
|
||||
version: "1.0",
|
||||
description: "Specific OS should work fine",
|
||||
fullDescription: null,
|
||||
rating: 4,
|
||||
iconURL: "http://localhost:4444/test_bug404024/icon.png",
|
||||
screenshots: ["http://localhost:4444/test_bug404024/thumbnail.png"],
|
||||
homepageURL: null,
|
||||
type: "theme",
|
||||
sourceURI: "http://localhost:4444/test.xpi",
|
||||
size: 1204
|
||||
}
|
||||
];
|
||||
|
||||
function checkResults(addons, length) {
|
||||
do_check_eq(addons.length, RESULTS.length);
|
||||
do_check_eq(addons.length, length);
|
||||
|
||||
for (var i = 0; i < addons.length; i++) {
|
||||
if (addons[i].name == "FAIL")
|
||||
do_throw(addons[i].id + " - " + addons[i].summary);
|
||||
if (addons[i].name != "PASS")
|
||||
do_throw(addons[i].id + " - " + "invalid add-on name " + addons[i].name);
|
||||
}
|
||||
|
||||
for (var i = 0; i < addons.length; i++) {
|
||||
do_check_neq(addons[i]["install"], null);
|
||||
|
||||
for (var p in RESULTS[i]) {
|
||||
if (p == "screenshots") {
|
||||
do_check_eq(addons[i][p].length, RESULTS[i][p].length);
|
||||
for (var j = 0; j < addons[i][p].length; j++)
|
||||
do_check_eq(addons[i][p][j], addons[i][p][j]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p == "sourceURI") {
|
||||
do_check_eq(addons[i]["install"][p].spec, RESULTS[i][p]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addons[i][p] != RESULTS[i][p])
|
||||
do_throw("Failed on property " + p + " on add-on " + addons[i].id +
|
||||
addons[i][p] + " == " + RESULTS[i][p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var RecommendedCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
// Search is complete
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
checkResults(addons, length);
|
||||
|
||||
// "search" for the same results
|
||||
AddonRepository.searchAddons("bug404024", 10, SearchCallback);
|
||||
// Should be searching now and any attempt to retrieve again should be ignored
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
AddonRepository.searchAddons("test search", 10, FailCallback);
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Recommended results failed");
|
||||
}
|
||||
};
|
||||
|
||||
var SearchCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
checkResults(addons, length);
|
||||
|
||||
server.stop(do_test_finished);
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Search results failed");
|
||||
}
|
||||
};
|
||||
|
||||
var FailCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Should not be called");
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Should not be called");
|
||||
}
|
||||
};
|
||||
|
||||
function run_test()
|
||||
{
|
||||
// Setup for test
|
||||
do_test_pending();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
// Install an add-on so we can check the same add-on isn't returns in the results
|
||||
startupManager();
|
||||
installAllFiles([do_get_addon("test_bug397778")], function() {
|
||||
restartManager();
|
||||
|
||||
server = new nsHttpServer();
|
||||
server.registerDirectory("/", do_get_file("data"));
|
||||
server.start(4444);
|
||||
|
||||
// Point the addons repository to the test server
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSEADDONS, BROWSE);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSERECOMMENDED, RECOMMENDED);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_GETRECOMMENDED, "http://localhost:4444/test_bug404024.xml");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSESEARCHRESULTS, SEARCH + "%TERMS%");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, "http://localhost:4444/test_%TERMS%.xml");
|
||||
|
||||
do_check_neq(AddonRepository, null);
|
||||
// Check the homepage and recommended urls
|
||||
do_check_eq(AddonRepository.homepageURL, BROWSE);
|
||||
do_check_eq(AddonRepository.getRecommendedURL(), RECOMMENDED);
|
||||
|
||||
// Check that search urls are correct
|
||||
for (var i = 0; i < BROWSE_SEARCH_URLS.length; i++) {
|
||||
var url = AddonRepository.getSearchURL(BROWSE_SEARCH_URLS[i][0]);
|
||||
if (url != BROWSE_SEARCH_URLS[i][1])
|
||||
do_throw("BROWSE_SEARCH_URL[" + i + "] returned " + url);
|
||||
}
|
||||
|
||||
// This should fail because we cancel it immediately.
|
||||
AddonRepository.retrieveRecommendedAddons(10, FailCallback);
|
||||
AddonRepository.cancelSearch();
|
||||
// Pull some results.
|
||||
AddonRepository.retrieveRecommendedAddons(10, RecommendedCallback);
|
||||
// Should be searching now and any attempt to retrieve again should be ignored
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
AddonRepository.retrieveRecommendedAddons(10, FailCallback);
|
||||
});
|
||||
}
|
||||
|
@ -1,216 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
|
||||
|
||||
const PREF_GETADDONS_BROWSEADDONS = "extensions.getAddons.browseAddons";
|
||||
const PREF_GETADDONS_BROWSERECOMMENDED = "extensions.getAddons.recommended.browseURL";
|
||||
const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url";
|
||||
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
|
||||
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
|
||||
|
||||
const BROWSE = "http://localhost:4444/";
|
||||
const RECOMMENDED = "http://localhost:4444/recommended.html";
|
||||
const SEARCH = "http://localhost:4444/search/";
|
||||
|
||||
var BROWSE_SEARCH_URLS = [
|
||||
["test", SEARCH + "test" ],
|
||||
["SEARCH", SEARCH + "SEARCH" ],
|
||||
["test search", SEARCH + "test%20search" ],
|
||||
["odd=search:with&weird\"characters", SEARCH + "odd%3Dsearch%3Awith%26weird%22characters" ]
|
||||
];
|
||||
|
||||
do_load_httpd_js();
|
||||
var server;
|
||||
|
||||
var RESULTS = [
|
||||
{
|
||||
id: "test5@tests.mozilla.org",
|
||||
name: "PASS",
|
||||
version: "1.0",
|
||||
description: "This should work fine",
|
||||
fullDescription: "Test description",
|
||||
rating: -1,
|
||||
iconURL: null,
|
||||
screenshots: [],
|
||||
homepageURL: "https://addons.mozilla.org/addon/5992",
|
||||
type: "extension",
|
||||
sourceURI: "http://localhost:4444/test.xpi",
|
||||
size: null
|
||||
},
|
||||
{
|
||||
id: "test6@tests.mozilla.org",
|
||||
name: "PASS",
|
||||
version: "1.0",
|
||||
description: "Specific OS should work fine",
|
||||
fullDescription: null,
|
||||
rating: 4,
|
||||
iconURL: "http://localhost:4444/test_bug404024/icon.png",
|
||||
screenshots: ["http://localhost:4444/test_bug404024/thumbnail.png"],
|
||||
homepageURL: null,
|
||||
type: "theme",
|
||||
sourceURI: "http://localhost:4444/XPCShell.xpi",
|
||||
size: 456,
|
||||
}
|
||||
];
|
||||
|
||||
function checkResults(addons) {
|
||||
do_check_eq(addons.length, RESULTS.length);
|
||||
|
||||
for (var i = 0; i < addons.length; i++) {
|
||||
if (addons[i].name == "FAIL")
|
||||
do_throw(addons[i].id + " - " + addons[i].summary);
|
||||
if (addons[i].name != "PASS")
|
||||
do_throw(addons[i].id + " - " + "invalid add-on name " + addons[i].name);
|
||||
}
|
||||
|
||||
for (var i = 0; i < addons.length; i++) {
|
||||
do_check_neq(addons[i]["install"], null);
|
||||
|
||||
for (var p in RESULTS[i]) {
|
||||
if (p == "screenshots") {
|
||||
do_check_eq(addons[i][p].length, RESULTS[i][p].length);
|
||||
for (var j = 0; j < addons[i][p].length; j++)
|
||||
do_check_eq(addons[i][p][j], addons[i][p][j]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p == "sourceURI") {
|
||||
do_check_eq(addons[i]["install"][p].spec, RESULTS[i][p]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addons[i][p] != RESULTS[i][p])
|
||||
do_throw("Failed on property " + p + " on add-on " + addons[i].id +
|
||||
addons[i][p] + " == " + RESULTS[i][p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var RecommendedCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
// Search is complete
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
checkResults(addons);
|
||||
|
||||
// "search" for the same results
|
||||
AddonRepository.searchAddons("bug417606", 10, SearchCallback);
|
||||
// Should be searching now and any attempt to retrieve again should be ignored
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
AddonRepository.searchAddons("test search", 10, FailCallback);
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Recommended results failed");
|
||||
}
|
||||
};
|
||||
|
||||
var SearchCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
do_check_false(AddonRepository.isSearching);
|
||||
do_check_eq(total, 100);
|
||||
checkResults(addons);
|
||||
|
||||
server.stop(do_test_finished);
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Search results failed");
|
||||
}
|
||||
};
|
||||
|
||||
var FailCallback = {
|
||||
searchSucceeded: function(addons, length, total) {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Should not be called");
|
||||
},
|
||||
|
||||
searchFailed: function() {
|
||||
server.stop(do_test_finished);
|
||||
do_throw("Should not be called");
|
||||
}
|
||||
};
|
||||
|
||||
function run_test()
|
||||
{
|
||||
// Setup for test
|
||||
do_test_pending();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
// Install an add-on so we can check the same add-on isn't returns in the results
|
||||
startupManager();
|
||||
installAllFiles([do_get_addon("test_bug397778")], function() {
|
||||
restartManager();
|
||||
|
||||
server = new nsHttpServer();
|
||||
server.registerDirectory("/", do_get_file("data"));
|
||||
server.start(4444);
|
||||
|
||||
// Point the addons repository to the test server
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSEADDONS, BROWSE);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSERECOMMENDED, RECOMMENDED);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_GETRECOMMENDED, "http://localhost:4444/test_bug417606.xml");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BROWSESEARCHRESULTS, SEARCH + "%TERMS%");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, "http://localhost:4444/test_%TERMS%.xml");
|
||||
|
||||
do_check_neq(AddonRepository, null);
|
||||
// Check the homepage and recommended urls
|
||||
do_check_eq(AddonRepository.homepageURL, BROWSE);
|
||||
do_check_eq(AddonRepository.getRecommendedURL(), RECOMMENDED);
|
||||
|
||||
// Check that search urls are correct
|
||||
for (var i = 0; i < BROWSE_SEARCH_URLS.length; i++) {
|
||||
var url = AddonRepository.getSearchURL(BROWSE_SEARCH_URLS[i][0]);
|
||||
if (url != BROWSE_SEARCH_URLS[i][1])
|
||||
do_throw("BROWSE_SEARCH_URL[" + i + "] returned " + url);
|
||||
}
|
||||
|
||||
// This should fail because we cancel it immediately.
|
||||
AddonRepository.retrieveRecommendedAddons(10, FailCallback);
|
||||
AddonRepository.cancelSearch();
|
||||
// Pull some results.
|
||||
AddonRepository.retrieveRecommendedAddons(10, RecommendedCallback);
|
||||
// Should be searching now and any attempt to retrieve again should be ignored
|
||||
do_check_true(AddonRepository.isSearching);
|
||||
AddonRepository.retrieveRecommendedAddons(10, FailCallback);
|
||||
});
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url
|
||||
do_load_httpd_js();
|
||||
var server;
|
||||
var RESULTS = [
|
||||
-1,
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
2,
|
||||
4,
|
||||
@ -59,8 +59,8 @@ var RecommendedCallback = {
|
||||
do_check_eq(length, RESULTS.length);
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (addons[i].rating != RESULTS[i])
|
||||
do_throw("Rating for " + addons[i].id + " was " + addons[i].rating + ", should have been " + RESULTS[i]);
|
||||
if (addons[i].averageRating != RESULTS[i])
|
||||
do_throw("Rating for " + addons[i].id + " was " + addons[i].averageRating + ", should have been " + RESULTS[i]);
|
||||
}
|
||||
server.stop(do_test_finished);
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user