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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-04-22 14:34:55 +00:00
parent bcdbd607cf
commit 19c1077e83
3 changed files with 10 additions and 16 deletions

View File

@ -7,15 +7,12 @@ 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]);

View File

@ -7,15 +7,12 @@ 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]);

View File

@ -8,14 +8,14 @@ function run_test() {
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");
}
}