Bug 1224703 - part 2: Enable tests on emulator r=billm

This commit is contained in:
Fabrice Desré 2016-01-05 15:37:06 -08:00
parent 4655a2a36b
commit e0070a9225
15 changed files with 56 additions and 10 deletions

View File

@ -80,6 +80,12 @@ this.UserCustomizations = {
},
isFromExtension: function(aURI) {
if (!aURI && Services.prefs.getBoolPref("webextensions.tests")) {
// That's the case in mochitests because of the packaging setup:
// aURI is expected to be the appURI from the jarChannel but there is
// no real app associated to mochitest's jar:remoteopenfile:/// uris.
return true;
}
return this.appId.has(aURI.host);
},

View File

@ -5096,5 +5096,7 @@ pref("toolkit.pageThumbs.screenSizeDivisor", 7);
pref("toolkit.pageThumbs.minWidth", 0);
pref("toolkit.pageThumbs.minHeight", 0);
pref("webextensions.tests", false);
// Allow customization of the fallback directory for file uploads
pref("dom.input.fallbackUploadDir", "");

View File

@ -338,3 +338,5 @@ user_pref("browser.urlbar.suggest.searches", false);
user_pref("browser.urlbar.userMadeSearchSuggestionsChoice", true);
user_pref("dom.audiochannel.mutedByDefault", false);
user_pref("webextensions.tests", true);

View File

@ -46,6 +46,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Schemas",
"resource://gre/modules/Schemas.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/ExtensionManagement.jsm");
@ -911,6 +913,10 @@ Extension.prototype = extend(Object.create(ExtensionData.prototype), {
broadcast(msg, data) {
return new Promise(resolve => {
let count = Services.ppmm.childCount;
if (AppConstants.MOZ_NUWA_PROCESS) {
// The nuwa process is frozen, so don't expect it to answer.
count--;
}
Services.ppmm.addMessageListener(msg + "Complete", function listener() {
count--;
if (count == 0) {

View File

@ -180,6 +180,7 @@ Script.prototype = {
// `document_idle` state.
if (AppConstants.platform == "gonk" && scheduled != "document_idle") {
Cu.reportError(`Script injection: ignoring ${url} at ${scheduled}`);
continue;
}
url = extension.baseURI.resolve(url);

View File

@ -13,6 +13,7 @@ const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
/*
* This file should be kept short and simple since it's loaded even
@ -142,6 +143,16 @@ var Service = {
}
// Create the moz-extension://uuid mapping.
// On b2g, in content processes we can't load jar:file:/// content, so we
// switch to jar:remoteopenfile:/// instead
// This is mostly exercised by generated extensions in tests. Installed
// extensions in b2g get an app: uri that also maps to the right jar: uri.
if (AppConstants.MOZ_B2G &&
Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT &&
uri.spec.startsWith("jar:file://")) {
uri = Services.io.newURI("jar:remoteopen" + uri.spec.substr("jar:".length), null, null);
}
let handler = Services.io.getProtocolHandler("moz-extension");
handler.QueryInterface(Ci.nsISubstitutingProtocolHandler);
handler.setSubstitution(uuid, uri);

View File

@ -3,6 +3,7 @@
const { interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
var {
EventManager,

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = os == 'android' || buildapp == 'b2g' || buildapp == 'mulet' || asan
skip-if = os == 'android' || buildapp == 'mulet' || asan
support-files =
head.js
file_WebRequest_page1.html
@ -26,32 +26,42 @@ support-files =
[test_ext_simple.html]
[test_ext_geturl.html]
[test_ext_contentscript.html]
skip-if = buildapp == 'b2g' # runat != document_idle is not supported.
[test_ext_i18n_css.html]
[test_ext_generate.html]
[test_ext_localStorage.html]
[test_ext_onmessage_removelistener.html]
[test_ext_notifications.html]
[test_ext_permission_xhr.html]
skip-if = buildapp == 'b2g' # JavaScript error: jar:remoteopenfile:///data/local/tmp/generated-extension.xpi!/content.js, line 46: NS_ERROR_ILLEGAL_VALUE:
[test_ext_runtime_connect.html]
skip-if = buildapp == 'b2g' # port.sender.tab is undefined on b2g.
[test_ext_runtime_connect2.html]
skip-if = buildapp == 'b2g' # port.sender.tab is undefined on b2g.
[test_ext_runtime_disconnect.html]
[test_ext_runtime_getPlatformInfo.html]
[test_ext_sandbox_var.html]
[test_ext_sendmessage_reply.html]
skip-if = buildapp == 'b2g' # sender.tab is undefined on b2g.
[test_ext_sendmessage_reply2.html]
skip-if = buildapp == 'b2g' # sender.tab is undefined on b2g.
[test_ext_sendmessage_doublereply.html]
skip-if = buildapp == 'b2g' # sender.tab is undefined on b2g.
[test_ext_storage.html]
[test_ext_background_runtime_connect_params.html]
[test_ext_cookies.html]
[test_ext_cookies_permissions.html]
skip-if = e10s # Uses cookie service via SpecialPowers.Services, which does not support e10s.
skip-if = e10s || buildapp == 'b2g' # Uses cookie service via SpecialPowers.Services, which does not support e10s.
[test_ext_bookmarks.html]
skip-if = buildapp == 'b2g' # unimplemented api.
[test_ext_alarms.html]
[test_ext_background_window_properties.html]
[test_ext_background_sub_windows.html]
[test_ext_background_api_injection.html]
[test_ext_jsversion.html]
skip-if = e10s # Uses a console monitor which doesn't work from a content process. The code being tested doesn't run in a tab content process in any case.
skip-if = e10s || buildapp == 'b2g' # Uses a console monitor which doesn't work from a content process. The code being tested doesn't run in a tab content process in any case.
[test_ext_i18n.html]
[test_ext_webrequest.html]
skip-if = buildapp == 'b2g' # webrequest api uninplemented (bug 1199504)
[test_ext_webnavigation.html]
skip-if = buildapp == 'b2g' # needs TabManager which is not yet implemented

View File

@ -43,7 +43,7 @@ let extensionData = {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
"run_at": "document_idle",
}],
},

View File

@ -65,7 +65,7 @@ function makeExtension() {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
"run_at": "document_idle",
}],
},

View File

@ -34,7 +34,7 @@ let extensionData = {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
"run_at": "document_idle",
}],
},

View File

@ -15,7 +15,7 @@
function backgroundScript() {
browser.runtime.getPlatformInfo(info => {
let validOSs = ["mac", "win", "android", "cros", "linux", "openbsd"];
let validOSs = ["mac", "win", "android", "cros", "linux", "openbsd", "gonk"];
let validArchs = ["arm", "x86-32", "x86-64"];
browser.test.assertTrue(validOSs.indexOf(info.os) != -1, "OS is valid");

View File

@ -32,7 +32,7 @@ let extensionData = {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
"run_at": "document_idle",
}],
},

View File

@ -51,7 +51,7 @@ let extensionData = {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
"run_at": "document_idle",
}],
},

View File

@ -279,5 +279,12 @@ this.AppConstants = Object.freeze({
// URL to the hg revision this was built from (e.g.
// "https://hg.mozilla.org/mozilla-central/rev/6256ec9113c1")
// On unofficial builds, this is an empty string.
SOURCE_REVISION_URL: "@SOURCE_REV_URL@"
SOURCE_REVISION_URL: "@SOURCE_REV_URL@",
MOZ_NUWA_PROCESS:
#ifdef MOZ_NUWA_PROCESS
true
#else
false
#endif
});