Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 661083 adding a testaddon for the manifest localization
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvold committed Aug 20, 2014
1 parent f1e469c commit 7ba6834
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python-lib/cuddlefish/prefs.py
Expand Up @@ -81,7 +81,7 @@
# Point the url-classifier to a nonexistent local URL for fast failures.
'browser.safebrowsing.provider.0.gethashURL' : 'http://localhost/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.0.updateURL' : 'http://localhost/safebrowsing-dummy/update',
}
}

# When launching a temporary new Thunderbird profile, use these preferences.
# Note that these were taken from:
Expand Down Expand Up @@ -135,4 +135,9 @@
'mail.smtpservers' : "smtp1",
'mail.startup.enabledMailCheckOnce' : True,
'mailnews.start_page_override.mstone' : "ignore",
}
}

DEFAULT_TEST_PREFS = {
'general.useragent.locale': "en-US",
'intl.locale.matchOS': "en-US"
}
4 changes: 4 additions & 0 deletions python-lib/cuddlefish/runner.py
Expand Up @@ -18,6 +18,7 @@
from cuddlefish.prefs import DEFAULT_THUNDERBIRD_PREFS
from cuddlefish.prefs import DEFAULT_FENNEC_PREFS
from cuddlefish.prefs import DEFAULT_NO_CONNECTIONS_PREFS
from cuddlefish.prefs import DEFAULT_TEST_PREFS

# Used to remove noise from ADB output
CLEANUP_ADB = re.compile(r'^(I|E)/(stdout|stderr|GeckoConsole)\s*\(\s*\d+\):\s*(.*)$')
Expand Down Expand Up @@ -433,6 +434,9 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
cmdargs = []
preferences = dict(DEFAULT_COMMON_PREFS)

if is_running_tests:
preferences.update(DEFAULT_TEST_PREFS)

if no_connections:
preferences.update(DEFAULT_NO_CONNECTIONS_PREFS)

Expand Down
4 changes: 4 additions & 0 deletions test/addons/manifest-localized/locale/en-US.properties
@@ -0,0 +1,4 @@
extensions.manifest-localized@jetpack.title = title-en
extensions.manifest-localized@jetpack.author = author-en
extensions.manifest-localized@jetpack.description = description-en
extensions.manifest-localized@jetpack.homepage = homepage-en
20 changes: 20 additions & 0 deletions test/addons/manifest-localized/main.js
@@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

const { Cu } = require('chrome');
const self = require('sdk/self');
const { AddonManager } = Cu.import('resource://gre/modules/AddonManager.jsm', {});

exports["test add-on manifest was localized"] = (assert, done) => {
AddonManager.getAddonByID(self.id, addon => {
assert.equal(addon.name, "title-en", "title was translated");
assert.equal(addon.description, "description-en", "description was translated");
assert.equal(addon.creator, "author-en", "author was translated");
assert.equal(addon.homepageURL, "homepage-en", "homepage was translated");
done();
});
};

require("sdk/test/runner").runTestsFromModule(module);
10 changes: 10 additions & 0 deletions test/addons/manifest-localized/package.json
@@ -0,0 +1,10 @@
{
"name": "manifest-localized",
"id": "manifest-localized@jetpack",
"license": "MPL 2.0",
"version": "0.1",
"title": "Manifest Not Localized",
"author": "Manifest Not Localized",
"description": "Manifest Not Localized",
"homepage": "Manifest Not Localized"
}

0 comments on commit 7ba6834

Please sign in to comment.