27 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
37 LOG(
"Starting the shutdown service unit test");
40 controller.startTest();
59 this._listeners.push(
new sbTestTask(
"Test Task 1"));
60 this._listeners.push(
new sbTestTask(
"Test Task 2"));
61 this._listeners.push(
new sbTestTask(
"Test Task 3"));
64 var shutdownService =
Cc[
"@songbirdnest.com/shutdown-service;1"]
65 .getService(
Ci.sbIJobProgress);
66 shutdownService.addJobProgressListener(
this);
69 shutdownService.QueryInterface(
Ci.nsIObserver);
70 var fakeBool =
Cc[
"@mozilla.org/supports-PRBool;1"]
71 .createInstance(
Ci.nsISupportsPRBool);
72 shutdownService.observe(fakeBool,
73 "quit-application-requested",
81 onJobProgress:
function(aJobProgress) {
85 if (aJobProgress.status ==
Ci.sbIJobProgress.STATUS_SUCCEEDED) {
86 LOG(
"The shutdown service has successfully completed");
89 var shutdownService =
Cc[
"@songbirdnest.com/shutdown-service;1"]
90 .getService(
Ci.sbIJobProgress);
91 shutdownService.removeJobProgressListener(
this);
94 this._listeners.splice(0);
108 this._titleText = aTitleText;
111 .getService(
Ci.nsIObserverService);
112 observerService.addObserver(
this,
"songbird-shutdown",
false);
119 status :
Ci.sbIJobProgress.STATUS_RUNNING,
121 statusText :
"Testing Shutdown Job",
131 getErrorMessages:
function() {
135 addJobProgressListener:
function(aJobListener) {
137 this._jobListener = aJobListener;
140 removeJobProgressListener:
function(aJobListener) {
141 this._jobListener =
null;
145 get needsToRunTask() {
149 startTask:
function() {
150 LOG(
"Starting shutdown task: " + this._titleText);
152 this.status =
Ci.sbIJobProgress.STATUS_RUNNING;
153 this._jobListener.onJobProgress(
this);
155 this.
_timer =
Cc[
"@mozilla.org/timer;1"].createInstance(
Ci.nsITimer);
156 this.
_timer.initWithCallback(
this, 3000,
Ci.nsITimerCallback.TYPE_ONE_SHOT);
165 notify:
function(aTimer) {
166 LOG(
"Completed shutdown task: " + this._titleText);
170 .getService(
Ci.nsIObserverService);
171 observerService.removeObserver(
this,
"songbird-shutdown");
173 this.status =
Ci.sbIJobProgress.STATUS_SUCCEEDED;
174 this._jobListener.onJobProgress(
this);
188 dump(
"----------------------------------------------------------\n");
189 dump(
" " + aMessage +
"\n");
190 dump(
"----------------------------------------------------------\n");
static nsCOMPtr< nsIObserverService > observerService
function assertNotEqual(aExpected, aActual, aMessage)
sbOSDControlService prototype QueryInterface
function assertTrue(aTest, aMessage)
function sbTestTask(aTitleText)
function sbShutdownTestController()
sbDeviceFirmwareAutoCheckForUpdate prototype _timer
TimerLoop prototype notify
function runTest()
Advanced DataRemote unit tests.
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe