test_manager_async.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
31 function runTest () {
32 
33  var port = getTestServerPortNumber();
34 
35  var server = Cc["@mozilla.org/server/jshttp;1"]
36  .createInstance(Ci.nsIHttpServer);
37 
38  server.start(port);
39  server.registerDirectory("/", getFile("."));
40 
41  var library = createLibrary("test_playlistmanager");
42 
43  var manager = Cc["@songbirdnest.com/Songbird/PlaylistReaderManager;1"]
44  .getService(Ci.sbIPlaylistReaderManager);
45  var listener = Cc["@songbirdnest.com/Songbird/PlaylistReaderListener;1"]
46  .createInstance(Ci.sbIPlaylistReaderListener);
47 
48  listener.observer = {
49  observe: function(aSubject, aTopic, aData) {
50  assertMediaList(mediaList, getFile("absolute_remote_localhost_result.xml"), port);
51  server.stop(function() {});
52  // Prevent closure from leaking
53  listener.observer = null;
54  testFinished();
55  }
56  }
57 
58  var mediaList = library.createMediaList("simple");
59  var uri = newURI("http://localhost:" + port + "/absolute_remote.m3u");
60  manager.loadPlaylist(uri, mediaList, null, false, listener);
61 
62  testPending();
63 }
64 
const Cc
function testFinished()
function runTest()
Test file.
function server(port, basePath)
Definition: httpd.js:4758
function getFile(fileName)
return null
Definition: FeedWriter.js:1143
function createLibrary(databaseGuid, databaseLocation)
Definition: test_load.js:151
function newURI(aURLString)
var uri
Definition: FeedWriter.js:1135
const Ci
function assertMediaList(aMediaList, aItemTestsFile, aPort)
function getTestServerPortNumber()
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe
function testPending()