Bug 1389160 - use non-ascii in path to extensions dir by default for specified tests r?kmag draft
authorRobert Helmer <rhelmer@mozilla.com>
Wed, 16 Aug 2017 23:14:57 -0700
changeset 648380 ce116d66be1b27e3eeda1520455439e2038fee23
parent 648379 34aeb23c13ad0da7dc63e57e5ac6ef206d423c54
child 726811 f922635d91a32aacf05dc1a0314b3ca19838cda6
push id74740
push userbmo:rhelmer@mozilla.com
push dateThu, 17 Aug 2017 17:53:01 +0000
reviewerskmag
bugs1389160
milestone57.0a1
Bug 1389160 - use non-ascii in path to extensions dir by default for specified tests r?kmag MozReview-Commit-ID: 4OMqS9T4T7f
toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
toolkit/mozapps/extensions/test/moz.build
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/head_nonascii.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell-nonascii.ini
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -213,24 +213,35 @@ class AddonsList {
 }
 
 var AddonTestUtils = {
   addonIntegrationService: null,
   addonsList: null,
   appInfo: null,
   addonStartup: null,
   testUnpacked: false,
+  testNonAsciiProfile: false,
   useRealCertChecks: false,
   usePrivilegedSignatures: true,
 
   init(testScope) {
     this.testScope = testScope;
 
     // Get the profile directory for tests to use.
-    this.profileDir = testScope.do_get_profile();
+
+    if (this.testNonAsciiProfile) {
+      let nonAsciiDir = testScope.do_get_tempdir();
+      nonAsciiDir.append("★ ☂");
+      this.registerDirectory("ProfD", nonAsciiDir);
+      this.profileDir = nonAsciiDir;
+    } else {
+      this.profileDir = testScope.do_get_profile();
+    }
+
+    dump(`rhelmer debug profile dir: ${this.profileDir.path}\n`);
 
     this.profileExtensions = this.profileDir.clone();
     this.profileExtensions.append("extensions");
 
     this.addonStartup = this.profileDir.clone();
     this.addonStartup.append("addonStartup.json.lz4");
 
     // Register a temporary directory for the tests.
--- a/toolkit/mozapps/extensions/test/moz.build
+++ b/toolkit/mozapps/extensions/test/moz.build
@@ -9,11 +9,12 @@ DIRS += ['browser']
 BROWSER_CHROME_MANIFESTS += ['xpinstall/browser.ini']
 MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
 
 TESTING_JS_MODULES += [
     'AddonManagerTesting.jsm',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += [
+    'xpcshell/xpcshell-nonascii.ini',
     'xpcshell/xpcshell-unpack.ini',
     'xpcshell/xpcshell.ini',
 ]
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -146,16 +146,25 @@ Object.defineProperty(this, "TEST_UNPACK
   get() {
     return AddonTestUtils.testUnpacked;
   },
   set(val) {
    return AddonTestUtils.testUnpacked = val;
   },
 });
 
+Object.defineProperty(this, "NON_ASCII_PROFILE", {
+  get() {
+    return AddonTestUtils.testNonAsciiProfile;
+  },
+  set(val) {
+   return AddonTestUtils.testNonAsciiProfile = val;
+  },
+});
+
 // We need some internal bits of AddonManager
 var AMscope = Components.utils.import("resource://gre/modules/AddonManager.jsm", {});
 var { AddonManager, AddonManagerInternal, AddonManagerPrivate } = AMscope;
 
 const promiseAddonByID = AddonManager.getAddonByID;
 const promiseAddonsByIDs = AddonManager.getAddonsByIDs;
 const promiseAddonsWithOperationsByTypes = AddonManager.getAddonsWithOperationsByTypes;
 
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_nonascii.js
@@ -0,0 +1,3 @@
+/* globals Services, NON_ASCII_PROFILE: true */
+/* exported NON_ASCII_PROFILE */
+NON_ASCII_PROFILE = true;
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-nonascii.ini
@@ -0,0 +1,10 @@
+[DEFAULT]
+head = head_addons.js head_nonascii.js
+tail =
+firefox-appdir = browser
+skip-if = toolkit == 'android'
+dupe-manifest =
+tags = addons
+
+[test_install.js]
+[test_legacy.js]