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
78
gaia/apps/system/test/unit/camera_trigger_test.js
Executable file
78
gaia/apps/system/test/unit/camera_trigger_test.js
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
/* global MocksHelper, BaseModule, Service */
|
||||
'use strict';
|
||||
|
||||
require('/js/service.js');
|
||||
require('/js/base_module.js');
|
||||
require('/js/camera_trigger.js');
|
||||
require('/test/unit/mock_activity.js');
|
||||
|
||||
var mocksForCameraTrigger = new MocksHelper([
|
||||
'MozActivity'
|
||||
]).init();
|
||||
|
||||
suite('system/CameraTrigger', function() {
|
||||
var subject;
|
||||
mocksForCameraTrigger.attachTestHelpers();
|
||||
|
||||
setup(function() {
|
||||
subject = BaseModule.instantiate('CameraTrigger');
|
||||
subject.start();
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
subject.stop();
|
||||
});
|
||||
|
||||
suite('Launch Camera', function() {
|
||||
var activitySpy;
|
||||
var expectedActivity = {
|
||||
name: 'record',
|
||||
data: {
|
||||
type: 'photos'
|
||||
}
|
||||
};
|
||||
|
||||
setup(function() {
|
||||
activitySpy = this.sinon.spy(window, 'MozActivity');
|
||||
});
|
||||
|
||||
suite('Allows MozActivity', function() {
|
||||
setup(function() {
|
||||
this.sinon.stub(Service, 'query', function(name) {
|
||||
return (name !== 'locked' && name !== 'isFtuRunning');
|
||||
});
|
||||
});
|
||||
|
||||
test('holdcamera triggers MozActivity', function() {
|
||||
window.dispatchEvent(new CustomEvent('holdcamera', {}));
|
||||
sinon.assert.calledWith(activitySpy, expectedActivity);
|
||||
});
|
||||
});
|
||||
|
||||
suite('LockScreen is locked', function() {
|
||||
setup(function() {
|
||||
this.sinon.stub(Service, 'query', function(name) {
|
||||
return (name === 'locked');
|
||||
});
|
||||
});
|
||||
|
||||
test('holdcamera inhibited by lockscreen', function() {
|
||||
window.dispatchEvent(new CustomEvent('holdcamera', {}));
|
||||
sinon.assert.notCalled(activitySpy);
|
||||
});
|
||||
});
|
||||
|
||||
suite('FTU is running', function() {
|
||||
setup(function() {
|
||||
this.sinon.stub(Service, 'query', function(name) {
|
||||
return (name === 'isFtuRunning');
|
||||
});
|
||||
});
|
||||
test('holdcamera inhibited when FTU running', function() {
|
||||
window.dispatchEvent(new CustomEvent('holdcamera', {}));
|
||||
sinon.assert.notCalled(activitySpy);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue