33 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
38 .getService(
Ci.sbILibraryManager);
39 libraryManager.registerLibrary(library,
false);
42 library.addListener(batchListener,
44 Ci.sbIMediaList.LISTENER_FLAGS_BATCHBEGIN |
45 Ci.sbIMediaList.LISTENER_FLAGS_BATCHEND);
46 batchListener.waitForEndBatch();
50 expectCallback:
false,
52 onBeforeMediaListRemoved:
function() {
55 onMediaListRemoved:
function() {
56 this.seenCallback =
true;
59 assertEqual(this.expectCallback, this.seenCallback);
60 this.expectCallback =
true;
61 this.seenCallback =
false;
67 var list = library.createMediaList(
"simple");
68 callback.expectCallback =
true;
69 batchListener.waitForCompletion(
function(){
70 monitor.setMediaList(list);
76 list = library.createMediaList(
"simple");
77 monitor.setMediaList(list);
78 monitor.setMediaList(
null);
79 callback.expectCallback =
false;
80 batchListener.waitForCompletion(
function()
81 library.remove(list));
85 list = library.createMediaList(
"simple");
86 callback.expectCallback =
true;
87 monitor.setMediaList(list);
88 batchListener.waitForCompletion(
function()
93 list = library.createMediaList(
"simple");
94 var list2 = library.createMediaList(
"simple");
95 callback.expectCallback =
true;
96 monitor.setMediaList(list2);
97 library.runInBatchMode(
function() {
99 library.remove(list2);
104 callback.expectCallback =
true;
105 list = library.createMediaList(
"simple");
106 monitor.setMediaList(list);
107 libraryManager.unregisterLibrary(library);
113 libraryManager.registerLibrary(library,
false);
114 monitor.setMediaList(library);
115 callback.expectCallback =
true;
116 libraryManager.unregisterLibrary(library);
119 monitor.setMediaList(
null);
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test LibraryUtils.RemovalMonitor.
function BatchEndListener()
function createLibrary(databaseGuid, databaseLocation)
Javascript wrappers for common library tasks.