Bug 1268912 - Use unicode apostrophe for client.name2 in sync properties, working around issues with sync tests. r=markh draft
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Wed, 13 Jul 2016 11:55:19 -0400
changeset 392923 9ab96c5be9a8a3e5c8d711cdf609ca631199a229
parent 392922 39784b9cd9262a7ed15d31dc1f5b8f2cbf8ab412
child 526431 b5892e2776193ce98caf2e94da02ac4786ad395f
push id24146
push userbmo:tchiovoloni@mozilla.com
push dateTue, 26 Jul 2016 14:08:42 +0000
reviewersmarkh
bugs1268912
milestone50.0a1
Bug 1268912 - Use unicode apostrophe for client.name2 in sync properties, working around issues with sync tests. r=markh MozReview-Commit-ID: 5XArwMUQwQF
browser/base/content/test/general/browser_misused_characters_in_strings.js
services/sync/locales/en-US/sync.properties
services/sync/tests/unit/head_helpers.js
--- a/browser/base/content/test/general/browser_misused_characters_in_strings.js
+++ b/browser/base/content/test/general/browser_misused_characters_in_strings.js
@@ -95,20 +95,16 @@ let gWhitelist = [{
   }, {
     file: "netError.dtd",
     key: "inadequateSecurityError.longDesc",
     type: "single-quote"
   }, {
     file: "netErrorApp.dtd",
     key: "securityOverride.warningContent",
     type: "single-quote"
-  }, {
-    file: "sync.properties",
-    key: "client.name2",
-    type: "apostrophe"
   }
 ];
 
 var moduleLocation = gTestPath.replace(/\/[^\/]*$/i, "/parsingTestHelpers.jsm");
 var {generateURIsFromDirTree} = Cu.import(moduleLocation, {});
 
 /**
  * Check if an error should be ignored due to matching one of the whitelist
--- a/services/sync/locales/en-US/sync.properties
+++ b/services/sync/locales/en-US/sync.properties
@@ -1,14 +1,14 @@
 # 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/.
 
 # %1: the user name (Ed), %2: the app name (Firefox), %3: the operating system (Android)
-client.name2 = %1$S's %2$S on %3$S
+client.name2 = %1$S’s %2$S on %3$S
 
 # %S is the date and time at which the last sync successfully completed
 lastSync2.label = Last sync: %S
 
 # signInToSync.description is the tooltip for the Sync buttons when Sync is
 # not configured.
 signInToSync.description = Sign In To Sync
 
--- a/services/sync/tests/unit/head_helpers.js
+++ b/services/sync/tests/unit/head_helpers.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 Cu.import("resource://services-common/async.js");
 Cu.import("resource://testing-common/services/common/utils.js");
 Cu.import("resource://testing-common/PlacesTestUtils.jsm");
+Cu.import("resource://services-sync/util.js");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, 'SyncPingSchema', function() {
   let ns = {};
   Cu.import("resource://gre/modules/FileUtils.jsm", ns);
   let stream = Cc["@mozilla.org/network/file-input-stream;1"]
                .createInstance(Ci.nsIFileInputStream);
   let jsonReader = Cc["@mozilla.org/dom/json;1"]
@@ -385,8 +386,17 @@ function sync_engine_and_validate_telem(
     }
     if (caughtError) {
       Svc.Obs.notify("weave:service:sync:error", caughtError);
     } else {
       Svc.Obs.notify("weave:service:sync:finish");
     }
   });
 }
+
+// Avoid an issue where `client.name2` containing unicode characters causes
+// a number of tests to fail, due to them assuming that we do not need to utf-8
+// encode or decode data sent through the mocked server (see bug 1268912).
+Utils.getDefaultDeviceName = function() {
+  return "Test device name";
+};
+
+