Bug 1545851, part 1 - Change test_process_directives.js to use nsIProperty. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Mon, 22 Apr 2019 14:34:55 +0000
changeset 470374 9dec6983ccaca948dcde3db9cdd6a9ee94d53c3c
parent 470373 927791bc9befd7ec45fed4a8ac5eca36538e9e60
child 470375 1ee2dbf025098374e660fd92b1cee4f13c7b695e
push id112868
push useropoprus@mozilla.com
push dateMon, 22 Apr 2019 22:19:22 +0000
treeherdermozilla-inbound@24537856cc88 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1545851
milestone68.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 1545851, part 1 - Change test_process_directives.js to use nsIProperty. r=froydnj This will let us make nsISupportsString builtinclass. Differential Revision: https://phabricator.services.mozilla.com/D28286
xpcom/tests/unit/data/child_process_directive_service.js
xpcom/tests/unit/data/main_process_directive_service.js
xpcom/tests/unit/test_process_directives.js
--- a/xpcom/tests/unit/data/child_process_directive_service.js
+++ b/xpcom/tests/unit/data/child_process_directive_service.js
@@ -2,20 +2,17 @@
  * 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/. */
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function TestProcessDirective() {}
 TestProcessDirective.prototype = {
 
   /* Boilerplate */
-  QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsString]),
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty]),
   contractID: "@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1",
   classID: Components.ID("{4bd1ba60-45c4-11e4-916c-0800200c9a66}"),
 
-  type: Ci.nsISupportsString.TYPE_STRING,
-  data: "child process",
-  toString() {
-    return this.data;
-  },
+  name: "child process",
+  value: "some value",
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestProcessDirective]);
--- a/xpcom/tests/unit/data/main_process_directive_service.js
+++ b/xpcom/tests/unit/data/main_process_directive_service.js
@@ -2,20 +2,17 @@
  * 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/. */
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function TestProcessDirective() {}
 TestProcessDirective.prototype = {
 
   /* Boilerplate */
-  QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsString]),
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty]),
   contractID: "@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1",
   classID: Components.ID("{9b6f4160-45be-11e4-916c-0800200c9a66}"),
 
-  type: Ci.nsISupportsString.TYPE_STRING,
-  data: "main process",
-  toString() {
-    return this.data;
-  },
+  name: "main process",
+  value: "some value",
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestProcessDirective]);
--- a/xpcom/tests/unit/test_process_directives.js
+++ b/xpcom/tests/unit/test_process_directives.js
@@ -3,19 +3,19 @@ const {Services} = ChromeUtils.import("r
 function run_test() {
   Components.manager.autoRegister(do_get_file("data/process_directive.manifest"));
 
   let isChild = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
 
   if (isChild) {
     Assert.equal(false, "@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1" in Cc);
   } else {
-    let svc = Cc["@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1"].createInstance(Ci.nsISupportsString);
-    Assert.equal(svc.data, "main process");
+    let svc = Cc["@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1"].createInstance(Ci.nsIProperty);
+    Assert.equal(svc.name, "main process");
   }
 
   if (!isChild) {
     Assert.equal(false, "@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1" in Cc);
   } else {
-    let svc = Cc["@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1"].createInstance(Ci.nsISupportsString);
-    Assert.equal(svc.data, "child process");
+    let svc = Cc["@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1"].createInstance(Ci.nsIProperty);
+    Assert.equal(svc.name, "child process");
   }
 }