Bug 1455322 - Allow TPS ping validation to be disabled by the `testing.tps.skipPingValidation` preference r=markh
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Tue, 24 Apr 2018 11:16:27 -0700
changeset 415922 1b3d3412d21063418454b851af3d85943c8f7110
parent 415921 3ece4329ec731cb6c1d1238007f8206ca0688fa2
child 415923 a13c398c9213cee950cc214becfc4d5ea75e048b
push id33911
push usercsabou@mozilla.com
push dateFri, 27 Apr 2018 10:01:39 +0000
treeherdermozilla-central@822936017145 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1455322
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455322 - Allow TPS ping validation to be disabled by the `testing.tps.skipPingValidation` preference r=markh MozReview-Commit-ID: 66KgorRWaC
services/sync/tps/extensions/tps/resource/tps.jsm
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -857,20 +857,30 @@ var TPS = {
       .parent // <root>/services/sync
       .parent // <root>/services
       .parent // <root>
       ;
     root.appendRelativePath(OS.Path.normalize(relativePath));
     return root;
   },
 
+  // Default ping validator that always says the ping passes. This should be
+  // overridden unless the `testing.tps.skipPingValidation` pref is true.
+  pingValidator(ping) {
+    Logger.logInfo("Not validating ping -- disabled by pref");
+    return true;
+  },
+
   // Attempt to load the sync_ping_schema.json and initialize `this.pingValidator`
   // based on the source of the tps file. Assumes that it's at "../unit/sync_ping_schema.json"
   // relative to the directory the tps test file (testFile) is contained in.
   _tryLoadPingSchema(testFile) {
+    if (Services.prefs.getBoolPref("testing.tps.skipPingValidation", false)) {
+      return;
+    }
     try {
       let schemaFile = this._getFileRelativeToSourceRoot(testFile,
         "services/sync/tests/unit/sync_ping_schema.json");
 
       let stream = Cc["@mozilla.org/network/file-input-stream;1"]
                    .createInstance(Ci.nsIFileInputStream);
 
       stream.init(schemaFile, FileUtils.MODE_RDONLY, FileUtils.PERMS_FILE, 0);