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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18926 from dominickuo/bug-998906
Bug 998906 - [Music] display the correct overlay after the enumeration in ListView, r=jimporter
- Loading branch information
Showing
7 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Fake Remote Controls</title> | ||
<script defer src="/js/fakeactivitycaller.js"></script> | ||
</head> | ||
|
||
<body> | ||
<span>I am fake activity caller</span> | ||
</body> | ||
|
||
</html> |
23 changes: 23 additions & 0 deletions
23
apps/music/test/marionette/fakeactivitycaller/js/fakeactivitycaller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* global MozActivity */ | ||
'use strict'; | ||
|
||
var FakeActivityCaller = { | ||
init: function() { | ||
this.callActicity(); | ||
}, | ||
|
||
callActicity: function() { | ||
var activity = new MozActivity({ | ||
name: 'pick', | ||
data: { | ||
type: 'audio/*' | ||
} | ||
}); | ||
|
||
activity.onerror = function(e) { | ||
console.warn('pick activity error:', activity.error.name); | ||
}; | ||
} | ||
}; | ||
|
||
FakeActivityCaller.init(); |
10 changes: 10 additions & 0 deletions
10
apps/music/test/marionette/fakeactivitycaller/manifest.webapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Fake Activity Caller", | ||
"description": "A fake activity caller app", | ||
"type": "certified", | ||
"launch_path": "/index.html", | ||
"developer": { | ||
"name": "The Gaia Team", | ||
"url": "https://github.com/mozilla-b2g/gaia" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* global module */ | ||
'use strict'; | ||
|
||
function FakeActivityCaller(client, origin) { | ||
this.client = client; | ||
this.origin = origin || ('app://' + FakeActivityCaller.DEFAULT_ORIGIN); | ||
} | ||
|
||
module.exports = FakeActivityCaller; | ||
|
||
FakeActivityCaller.DEFAULT_ORIGIN = 'fakeactivity.gaiamobile.org'; | ||
|
||
FakeActivityCaller.prototype = { | ||
client: null, | ||
|
||
launch: function() { | ||
this.client.switchToFrame(); | ||
this.client.apps.launch(this.origin); | ||
this.client.apps.switchToApp(this.origin); | ||
}, | ||
|
||
close: function() { | ||
this.client.apps.close(this.origin); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* global require, marionette, setup, suite, test, __dirname */ | ||
'use strict'; | ||
|
||
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({ | ||
prefs: { | ||
'device.storage.enabled': true, | ||
'device.storage.testing': true, | ||
'device.storage.prompt.testing': true | ||
}, | ||
|
||
settings: { | ||
'lockscreen.enabled': false, | ||
'ftu.manifestURL': null | ||
}, | ||
|
||
apps: apps | ||
}); | ||
|
||
var music; | ||
|
||
setup(function() { | ||
music = new Music(client); | ||
}); | ||
|
||
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.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.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() { | ||
activitycaller.launch(); | ||
|
||
music.switchToMe(); | ||
music.waitForMessageOverlayShown(true); | ||
}); | ||
}); | ||
|
||
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() { | ||
activitycaller.launch(); | ||
|
||
music.switchToMe(); | ||
music.waitForMessageOverlayShown(false); | ||
}); | ||
}); | ||
}); |