test_libraryloader.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
29 function runTest () {
30  var libraryManager = Cc["@songbirdnest.com/Songbird/library/Manager;1"].
31  getService(Ci.sbILibraryManager);
32  var enumerator = libraryManager.getLibraries();
33 
34  var libraryCount = 0;
35  var fileNames = [];
36  while (enumerator.hasMoreElements()) {
37  let library = enumerator.getNext();
38  let propBag = library.creationParameters;
39  let dbFile = propBag.getPropertyAsInterface("databaseFile", Ci.nsIFile);
40  if (dbFile) {
41  fileNames[libraryCount] = dbFile.leafName;
42  }
43  libraryCount++;
44  }
45  assertTrue(libraryCount >= 3);
46  assertTrue(fileNames.indexOf("main@library.songbirdnest.com.db") != -1);
47  assertTrue(fileNames.indexOf("web@library.songbirdnest.com.db") != -1);
48  assertTrue(fileNames.indexOf("playqueue@library.songbirdnest.com.db") != -1);
49 
50  enumerator = libraryManager.getLibraries();
51  var library = enumerator.getNext();
52  assertTrue(library);
53 }
const Cc
function assertTrue(aTest, aMessage)
getService(Ci.sbIFaceplateManager)
function runTest()
Test file.
var libraryManager
const Ci