Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
79
gaia/dev_apps/music-oga/test/unit/mock_db.js
Executable file
79
gaia/dev_apps/music-oga/test/unit/mock_db.js
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
/* exported MockDatabase */
|
||||
'use strict';
|
||||
|
||||
var MockDatabase = {
|
||||
|
||||
cancelEnumeration: function() {},
|
||||
|
||||
_mockResultsMetadataAlbum: [
|
||||
{
|
||||
metadata: {
|
||||
album: 'Crime of the Century',
|
||||
artist: 'Supertramp',
|
||||
title: 'School'
|
||||
}
|
||||
},
|
||||
{
|
||||
metadata: {
|
||||
album: 'Crisis? What Crisis?',
|
||||
artist: 'Supertramp',
|
||||
title: 'Lady'
|
||||
}
|
||||
},
|
||||
{
|
||||
metadata: {
|
||||
album: 'Even in the Quietests Moments...',
|
||||
artist: 'Supertramp',
|
||||
title: 'Fool\'s Overture'
|
||||
}
|
||||
},
|
||||
{
|
||||
metadata: {
|
||||
album: 'Breakfast in America',
|
||||
artist: 'Supertramp',
|
||||
title: 'Goodbye Stranger'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
enumerate: function(key, range, direction, callback) {
|
||||
|
||||
switch (key) {
|
||||
case 'metadata.album':
|
||||
this._mockResultsMetadataAlbum.forEach((entry) => callback(entry));
|
||||
// the end
|
||||
callback(null);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
},
|
||||
|
||||
enumerateAll: function(key, range, direction, callback) {
|
||||
var results = [];
|
||||
|
||||
switch (key) {
|
||||
case 'metadata.album':
|
||||
results = results.concat(this._mockResultsMetadataAlbum);
|
||||
break;
|
||||
}
|
||||
|
||||
callback(results);
|
||||
},
|
||||
|
||||
advancedEnumerate: function(key, range, direction, index, callback) {
|
||||
// XXX: This assumes that the callback immediately calls cancelEnumeration!
|
||||
callback(this._mockResultsMetadataAlbum[index]);
|
||||
},
|
||||
|
||||
count: function(key, range, callback) {
|
||||
var result = 0;
|
||||
|
||||
switch (key) {
|
||||
case 'metadata.album':
|
||||
result = this._mockResultsMetadataAlbum.length;
|
||||
break;
|
||||
}
|
||||
|
||||
callback(result);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue