Bug 1317101 - Part 8c: Run plain mochitests in both parent-process and remote configurations. r=billm
authorKris Maglione <maglione.k@gmail.com>
Tue, 15 Nov 2016 18:20:52 -0800
changeset 896453 93ef05cf81ef89a9810e97f820a80db8ef784885
parent 896452 7651bcf89bf1669c7cd3c1d954ccd440f91599bf
child 896454 478d8f5e7ebb18092190b68eb49921b076e32d18
push id155501
push userashiue@mozilla.com
push dateFri, 18 Nov 2016 03:26:06 +0000
treeherdertry@c775a1cfc96e [default view] [failures only]
reviewersbillm
bugs1317101
milestone53.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
toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html
toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -29,14 +29,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.remote", 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
+skip-if = !e10s
+
+[include:mochitest-common.ini]
--- a/toolkit/components/extensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest.ini
@@ -1,112 +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_filter.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]
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html
@@ -90,17 +90,17 @@ add_task(function* test_webRequest_backg
       for (let name of eventNames) {
         browser.webRequest[name].addListener(
           listener.bind(null, name),
           {urls: ["https://example.com/*"]}
         );
       }
 
       fetch("https://example.com/example.txt").then(() => {
-        browser.test.pass("Fetch succeeded.");
+        browser.test.succeed("Fetch succeeded.");
       }, () => {
         browser.test.fail("fetch recieved");
         browser.test.sendMessage("done");
       });
     },
   });
 
   yield extension.startup();
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html
@@ -1,18 +1,18 @@
 <!DOCTYPE HTML>
 
 <html>
 <head>
 <meta charset="utf-8">
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <script type="text/javascript" src="head_webrequest.js"></script>
   <script type="text/javascript" src="head.js"></script>
-  <script type="text/javascript" src="head_webrequest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 <script>
 "use strict";
 
 let extension;
 add_task(function* setup() {
   // Clear the image cache, since it gets in the way otherwise.
   let imgTools = SpecialPowers.Cc["@mozilla.org/image/tools;1"].getService(SpecialPowers.Ci.imgITools);