This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
music_test.js
104 lines (84 loc) · 2.74 KB
/
music_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* global require, marionette, setup, suite, test, __dirname */
'use strict';
var assert = require('assert');
var Music = require('./lib/music.js');
var FakeActivityCaller = require('./lib/fakeactivitycaller.js');
marionette('Music ui tests', function() {
var apps = {};
apps[FakeActivityCaller.DEFAULT_ORIGIN] = __dirname + '/fakeactivitycaller';
var client = marionette.client({
profile: {
prefs: {
'device.storage.enabled': true,
'device.storage.testing': true,
'device.storage.prompt.testing': true
},
apps: apps
}
});
var music, system;
setup(function() {
music = new Music(client);
system = client.loader.getAppClass('system');
system.waitForFullyLoaded();
});
suite('Launch regular music with no audio files', function() {
setup(function() {
client.fileManager.removeAllFiles();
});
test('Overlay should be shown when storage has no songs', function() {
music.launch();
music.waitFinishedScanning();
music.waitForMessageOverlayShown(true);
});
});
suite('Launch regular music with one audio file', function() {
setup(function() {
client.fileManager.add([
{ type: 'music', filePath: 'test_media/samples/Music/b2g.ogg' }
]);
});
test('Overlay should be hidden when storage has some songs', function() {
music.launch();
music.waitFinishedScanning();
music.waitForMessageOverlayShown(false);
music.waitForFirstTile();
});
});
suite('Launch music picker with no audio files', function() {
var activitycaller;
setup(function() {
activitycaller = new FakeActivityCaller(client);
client.fileManager.removeAllFiles();
});
test('Overlay should be shown when storage has no songs', function() {
try {
activitycaller.launch();
activitycaller.tapPickButton();
activitycaller.selectMusicApp();
music.switchToMe();
music.waitFinishedScanning();
music.waitForMessageOverlayShown(true);
} catch (e) { assert.ok(false, e.stack); }
});
});
suite('Launch music picker with one audio file', function() {
var activitycaller;
setup(function() {
activitycaller = new FakeActivityCaller(client);
client.fileManager.add([
{ type: 'music', filePath: 'test_media/samples/Music/b2g.ogg' }
]);
});
test('Overlay should be hidden when storage has some songs', function() {
try {
activitycaller.launch();
activitycaller.tapPickButton();
activitycaller.selectMusicApp();
music.switchToMe();
music.waitFinishedScanning();
music.waitForMessageOverlayShown(false);
} catch (e) { assert.ok(false, e.stack); }
});
});
});