27 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
32 var fsWatcher =
Cc[
"@songbirdnest.com/filesystem/watcher;1"]
33 .createInstance(
Ci.sbIFileSystemWatcher);
34 if (!fsWatcher.isSupported) {
41 var watchDir =
Cc[
"@mozilla.org/file/directory_service;1"]
42 .getService(
Ci.nsIProperties)
43 .get(
"ProfD",
Ci.nsIFile);
46 watchDir.append(
"invalid_watch_dir");
47 if (watchDir.exists()) {
49 watchDir.remove(
true);
56 onWatcherError:
function(aErrorType, aDescription)
58 var isCorrectErrorCode =
false;
60 var
message =
"WATCHER ERROR RECIEVED: ";
62 case Ci.sbIFileSystemListener.ROOT_PATH_MISSING:
63 isCorrectErrorCode =
true;
64 message +=
"ROOT_PATH_MISSING ";
67 case Ci.sbIFileSystemListener.INVALID_DIRECTORY:
68 message +=
"INVALID_DIRECTORY ";
71 case Ci.sbIFileSystemListener.SESSION_LOAD_ERROR:
72 message +=
"SESSION_LOAD_ERROR ";
76 message +=
"INVALID ERROR TYPE!!!! ";
79 LOG(message += aDescription);
88 LOG(
"ROOT PATH TEST");
91 fsWatcher.init(listener, watchDir.path,
true);
92 fsWatcher.startWatching();
98 function LOG(aMessage)
100 dump(
"----------------------------------------------------------\n");
101 dump(
" " + aMessage +
"\n");
102 dump(
"----------------------------------------------------------\n");
function assertTrue(aTest, aMessage)
function runTest()
Advanced DataRemote unit tests.