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
18
gaia/tv_apps/notification-receiver/test/unit/.jshintrc
Executable file
18
gaia/tv_apps/notification-receiver/test/unit/.jshintrc
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../../.jshintrc",
|
||||
"predef": [
|
||||
"assert",
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"require",
|
||||
"requireApp",
|
||||
"sinon",
|
||||
"mocha",
|
||||
"loadBodyHTML"
|
||||
]
|
||||
}
|
||||
|
||||
107
gaia/tv_apps/notification-receiver/test/unit/receiver_test.js
Executable file
107
gaia/tv_apps/notification-receiver/test/unit/receiver_test.js
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
/* global MockPresentation, MockPresentationSession, MockNotification,
|
||||
Receiver */
|
||||
|
||||
'use strict';
|
||||
|
||||
require('/js/receiver.js');
|
||||
require('/shared/test/unit/mocks/mock_notification.js');
|
||||
require('/shared/test/unit/mocks/mock_presentation.js');
|
||||
require('/shared/test/unit/mocks/mock_presentation_session.js');
|
||||
|
||||
suite('notification-receiver/Receiver', function() {
|
||||
var receiver;
|
||||
var realPresentation;
|
||||
var realNotification;
|
||||
|
||||
suiteSetup(function() {
|
||||
realPresentation = navigator.presentation;
|
||||
navigator.presentation = MockPresentation;
|
||||
|
||||
realNotification = window.Notification;
|
||||
window.Notification = MockNotification;
|
||||
});
|
||||
|
||||
suiteTeardown(function() {
|
||||
navigator.presentation = realPresentation;
|
||||
window.Notification = realNotification;
|
||||
});
|
||||
|
||||
suite('init()', function() {
|
||||
// TODO: Since presentation API spec has changed, we need to re-write these
|
||||
// test cases and align them to new presentation API spec.
|
||||
|
||||
setup(function() {
|
||||
this.sinon.spy(MockPresentationSession, 'addEventListener');
|
||||
receiver = new Receiver();
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
MockPresentationSession.addEventListener.restore();
|
||||
navigator.presentation._mReset();
|
||||
receiver.uninit();
|
||||
});
|
||||
/*
|
||||
test('> should call handleStateChange once ' +
|
||||
'when session object is not ready', function() {
|
||||
this.sinon.spy(receiver, '_handleSessionReady');
|
||||
|
||||
assert.isFalse(receiver._handleSessionReady.called);
|
||||
receiver.init();
|
||||
navigator.presentation._mInjectSession(
|
||||
MockPresentationSession._mCreateSession());
|
||||
assert.isTrue(receiver._handleSessionReady.calledOnce);
|
||||
assert.ok(
|
||||
MockPresentationSession.addEventListener.calledWith('message'));
|
||||
assert.isTrue(
|
||||
MockPresentationSession.addEventListener.calledWith('statechange'));
|
||||
});
|
||||
|
||||
test('> _handleSessionReady should called once ' +
|
||||
'when session object is ready', function() {
|
||||
navigator.presentation._mInjectSession(
|
||||
MockPresentationSession._mCreateSession());
|
||||
this.sinon.spy(receiver, '_handleSessionReady');
|
||||
|
||||
assert.isFalse(receiver._handleSessionReady.called);
|
||||
receiver.init();
|
||||
assert.isTrue(receiver._handleSessionReady.calledOnce);
|
||||
assert.ok(
|
||||
MockPresentationSession.addEventListener.calledWith('message'));
|
||||
assert.isTrue(
|
||||
MockPresentationSession.addEventListener.calledWith('statechange'));
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
suite('onmessage', function() {
|
||||
// TODO: Since presentation API spec has changed, we need to re-write these
|
||||
// test cases and align them to new presentation API spec.
|
||||
/*
|
||||
setup(function() {
|
||||
receiver = new Receiver();
|
||||
this.sinon.spy(receiver, '_handleMessage');
|
||||
navigator.presentation._mInjectSession(
|
||||
MockPresentationSession._mCreateSession());
|
||||
receiver.init();
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
navigator.presentation._mReset();
|
||||
receiver.uninit();
|
||||
});
|
||||
|
||||
test('should invoke _handleMessage', function() {
|
||||
// XXX: evt is subject to changed if we change message data format
|
||||
var evt = {
|
||||
data: JSON.stringify({
|
||||
type: 'start-ringing',
|
||||
call: '0987654321'
|
||||
})
|
||||
};
|
||||
MockPresentationSession._mFireEvent('message', evt);
|
||||
assert.isTrue(receiver._handleMessage.calledOnce);
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue