Bug 1317101 - Part 8c: Run plain mochitests in both parent-process and remote configurations. r?billm draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 12 Nov 2016 19:16:03 -0800
changeset 438080 ed15f2287eb17c5a1e7887011697ba7e762d33a9
parent 438079 02913757cfe6c0c0de832482a69e57d19e448c06
child 536819 235e71907049d473a0e87014d6b0747961839313
push id35614
push usermaglione.k@gmail.com
push dateSun, 13 Nov 2016 03:28:59 +0000
reviewersbillm
bugs1317101
milestone52.0a1
Bug 1317101 - Part 8c: Run plain mochitests in both parent-process and remote configurations. r?billm MozReview-Commit-ID: 3gs4vAlFBeU
toolkit/components/extensions/moz.build
toolkit/components/extensions/test/mochitest/head.js
toolkit/components/extensions/test/mochitest/mochitest-common.ini
toolkit/components/extensions/test/mochitest/mochitest-remote.ini
toolkit/components/extensions/test/mochitest/mochitest.ini
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -28,14 +28,17 @@ TESTING_JS_MODULES += [
     'ExtensionTestCommon.jsm',
     'ExtensionXPCShellUtils.jsm',
 ]
 
 DIRS += ['schemas']
 
 JAR_MANIFESTS += ['jar.mn']
 
-MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
+MOCHITEST_MANIFESTS += [
+    'test/mochitest/mochitest-remote.ini',
+    'test/mochitest/mochitest.ini'
+]
 MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += [
     'test/xpcshell/native_messaging.ini',
     'test/xpcshell/xpcshell.ini',
 ]
--- a/toolkit/components/extensions/test/mochitest/head.js
+++ b/toolkit/components/extensions/test/mochitest/head.js
@@ -1,10 +1,23 @@
 "use strict";
 
+// We run tests under two different configurations, from mochitest.ini and
+// mochitest-remote.ini. When running from mochitest-remote.ini, the tests are
+// copied to the sub-directory "test-oop-extensions", which we detect here, and
+// use to select our configuration.
+if (location.pathname.includes("test-oop-extensions")) {
+  add_task(() => {
+    return SpecialPowers.pushPrefEnv({set: [
+      ["dom.ipc.processCount", 1],
+      ["extensions.webextensions.outOfProcess", true],
+    ]});
+  });
+}
+
 /* exported waitForLoad */
 
 function waitForLoad(win) {
   return new Promise(resolve => {
     win.addEventListener("load", function listener() {
       win.removeEventListener("load", listener, true);
       resolve();
     }, true);
copy from toolkit/components/extensions/test/mochitest/mochitest.ini
copy to toolkit/components/extensions/test/mochitest/mochitest-common.ini
--- a/toolkit/components/extensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
@@ -31,17 +31,16 @@ support-files =
   file_sample.html
   redirection.sjs
   file_privilege_escalation.html
   file_ext_test_api_injection.js
   file_permission_xhr.html
   file_teardown_test.js
   return_headers.sjs
   webrequest_worker.js
-tags = webextensions
 
 [test_clipboard.html]
 # skip-if = # disabled test case with_permission_allow_copy, see inline comment.
 [test_ext_inIncognitoContext_window.html]
 skip-if = os == 'android' # Android does not currently support windows.
 [test_ext_geturl.html]
 [test_ext_background_canvas.html]
 [test_ext_content_security_policy.html]
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/mochitest-remote.ini
@@ -0,0 +1,12 @@
+[DEFAULT]
+# This is a horrible hack:
+# In order to run tests under two configurations, we create two mochitest
+# manifests, and include a manifest with a common set of tests from each. In
+# order to detect which manifest we're running from, we install the tests listed
+# in this manifest to the sub-directory "test-oop-extensions", and then check
+# whether we're running from that directory from head.js
+install-to-subdir = test-oop-extensions
+tags = webextensions remote-webextensions
+
+
+[include:mochitest-common.ini]
--- a/toolkit/components/extensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest.ini
@@ -1,110 +1,5 @@
 [DEFAULT]
-support-files =
-  head.js
-  file_mixed.html
-  head_webrequest.js
-  file_csp.html
-  file_csp.html^headers^
-  file_WebRequest_page3.html
-  file_webNavigation_clientRedirect.html
-  file_webNavigation_clientRedirect_httpHeaders.html
-  file_webNavigation_clientRedirect_httpHeaders.html^headers^
-  file_webNavigation_frameClientRedirect.html
-  file_webNavigation_frameRedirect.html
-  file_webNavigation_manualSubframe.html
-  file_webNavigation_manualSubframe_page1.html
-  file_webNavigation_manualSubframe_page2.html
-  file_WebNavigation_page1.html
-  file_WebNavigation_page2.html
-  file_WebNavigation_page3.html
-  file_with_about_blank.html
-  file_image_good.png
-  file_image_bad.png
-  file_image_redirect.png
-  file_style_good.css
-  file_style_bad.css
-  file_style_redirect.css
-  file_script_good.js
-  file_script_bad.js
-  file_script_redirect.js
-  file_script_xhr.js
-  file_sample.html
-  redirection.sjs
-  file_privilege_escalation.html
-  file_ext_test_api_injection.js
-  file_permission_xhr.html
-  file_teardown_test.js
-  return_headers.sjs
-  webrequest_worker.js
-tags = webextensions
+tags = webextensions in-process-webextensions
 
-[test_clipboard.html]
-# skip-if = # disabled test case with_permission_allow_copy, see inline comment.
-[test_ext_inIncognitoContext_window.html]
-skip-if = os == 'android' # Android does not currently support windows.
-[test_ext_geturl.html]
-[test_ext_background_canvas.html]
-[test_ext_content_security_policy.html]
-[test_ext_contentscript.html]
-[test_ext_contentscript_api_injection.html]
-[test_ext_contentscript_context.html]
-[test_ext_contentscript_create_iframe.html]
-[test_ext_contentscript_devtools_metadata.html]
-[test_ext_contentscript_exporthelpers.html]
-[test_ext_contentscript_css.html]
-[test_ext_contentscript_about_blank.html]
-[test_ext_contentscript_teardown.html]
-skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
-[test_ext_exclude_include_globs.html]
-[test_ext_i18n_css.html]
-[test_ext_generate.html]
-[test_ext_notifications.html]
-[test_ext_permission_xhr.html]
-[test_ext_runtime_connect.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_runtime_connect_twoway.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_runtime_connect2.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_runtime_disconnect.html]
-[test_ext_runtime_id.html]
-[test_ext_sandbox_var.html]
-[test_ext_sendmessage_reply.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_sendmessage_reply2.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_sendmessage_doublereply.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_sendmessage_no_receiver.html]
-[test_ext_storage_content.html]
-[test_ext_storage_tab.html]
-skip-if = os == 'android' # Android does not currently support tabs.
-[test_ext_test.html]
-[test_ext_cookies.html]
-skip-if = os == 'android' # Bug 1258975 on android.
-[test_ext_background_api_injection.html]
-[test_ext_background_generated_url.html]
-[test_ext_background_teardown.html]
-[test_ext_tab_teardown.html]
-skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
-[test_ext_unload_frame.html]
-[test_ext_i18n.html]
-skip-if = (os == 'android') # Bug 1258975 on android.
-[test_ext_web_accessible_resources.html]
-skip-if = (os == 'android') # Bug 1258975 on android.
-[test_ext_webrequest_background_events.html]
-skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
-[test_ext_webrequest_basic.html]
-skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
-[test_ext_webrequest_suspend.html]
-skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
-[test_ext_webrequest_upload.html]
-skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
-[test_ext_webnavigation.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_webnavigation_filters.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_window_postMessage.html]
-[test_ext_subframes_privileges.html]
-skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
-[test_ext_xhr_capabilities.html]
+
+[include:mochitest-common.ini]