36 .getService(
Ci.sbIFaceplateManager);
44 var faceplateManagerListener = {
48 expectDestroyID:
null,
50 onCreatePane:
function(pane) {
52 this.expectCreateID =
null;
55 onShowPane:
function(pane) {
57 this.expectShowID =
null;
60 onDestroyPane:
function(pane) {
62 this.expectDestroyID =
null;
66 if (!iid.equals(Components.interfaces.sbIFeathersChangeListener))
67 throw Components.results.NS_ERROR_NO_INTERFACE;
91 testFaceplatePaneData();
99 faceplateManagerListener.expectCreateID =
null;
100 faceplateManagerListener.expectDestroyID =
null;
106 return Components.results.NS_OK;
115 function testCreatePanes() {
116 for (var
i = 0;
i < 3;
i++) {
117 var
id =
"testpane" +
i;
120 faceplateManagerListener.expectCreateID =
id;
134 function testAccessors() {
140 Ci.sbIFaceplatePane);
141 assertEnumeratorEqualsArray(enumerator, panes);
144 for (var
i = 0;
i < panes.length;
i++) {
151 function testShowPane() {
152 faceplateManagerListener.expectShowID = panes[0].id;
165 function testDestroyPanes() {
166 for (var
i = 0;
i < panes.length;
i++) {
168 faceplateManagerListener.expectDestroyID = panes[
i].id;
180 function testFaceplatePaneData() {
190 assertEqual(pane.getData(topic), this.expectValue);
193 pane.addObserver(observer);
196 var keys = [
"test1",
"test2"];
197 observer.expectKey = keys[0];
198 observer.expectValue =
"success1";
199 pane.setData(observer.expectKey, observer.expectValue);
200 observer.expectKey = keys[1];
201 observer.expectValue =
"success2";
202 pane.setData(observer.expectKey, observer.expectValue);
205 var enumerator = wrapStringEnumerator(pane.getKeys());
206 assertEnumeratorEqualsArray(enumerator, keys);
209 pane.removeObserver(observer);
210 observer.expectKey =
null;
211 pane.setData(
"test",
"blah");
221 function wrapEnumerator(enumerator, iface)
223 while (enumerator.hasMoreElements()) {
224 yield enumerator.getNext().QueryInterface(iface);
231 function wrapStringEnumerator(enumerator)
233 while (enumerator.hasMore()) {
234 yield enumerator.getNext();
243 function assertEnumeratorEqualsArray(enumerator, list) {
244 list = list.concat();
245 for (var item in enumerator) {
247 list.splice(list.indexOf(item), 1);
255 function clearManager () {
257 for (pane in enumerator) {
var faceplateManager
FaceplateManager test file.
sbOSDControlService prototype QueryInterface
function assertEqual(aExpected, aActual, aMessage)
_getSelectedPageStyle s i
sbDeviceFirmwareAutoCheckForUpdate prototype observe