Skip to content

Commit

Permalink
Bug 1169861 - Ignore holdcamera when lockscreen is locked r=etienne_s
Browse files Browse the repository at this point in the history
  • Loading branch information
lissyx committed Jun 10, 2015
1 parent d2f31eb commit 3a2c1d7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
8 changes: 7 additions & 1 deletion apps/system/js/camera_trigger.js
@@ -1,4 +1,4 @@
/* globals BaseModule, MozActivity */
/* globals BaseModule, MozActivity, Service */

'use strict';

Expand All @@ -15,6 +15,12 @@
TRACE: false,

_handle_holdcamera: function(event) {
// Avoid triggering the Camera app multiple times if the lockscreen is
// locked
if (Service.query('locked')) {
return;
}

this.debug('Received holdcamera');
/* jshint unused:false */
var activity = new MozActivity({
Expand Down
3 changes: 2 additions & 1 deletion apps/system/test/marionette/homescreen_navigation_test.js
Expand Up @@ -15,7 +15,8 @@ marionette('Homescreen navigation >', function() {
},
settings: {
'devtools.overlay': true,
'hud.reflows': true
'hud.reflows': true,
'notifications.resend': false
}
}
});
Expand Down
30 changes: 26 additions & 4 deletions apps/system/test/unit/camera_trigger_test.js
@@ -1,4 +1,4 @@
/* global MocksHelper, BaseModule */
/* global MocksHelper, BaseModule, Service */
'use strict';

require('/js/service.js');
Expand Down Expand Up @@ -36,9 +36,31 @@ suite('system/CameraTrigger', function() {
activitySpy = this.sinon.spy(window, 'MozActivity');
});

test('holdcamera triggers MozActivity', function() {
window.dispatchEvent(new CustomEvent('holdcamera', {}));
sinon.assert.calledWith(activitySpy, expectedActivity);
suite('LockScreen not locked', function() {
setup(function() {
this.sinon.stub(Service, 'query', function() {
return false;
});
});

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() {
return true;
});
});

test('holdcamera inhibited by lockscreen', function() {
window.dispatchEvent(new CustomEvent('holdcamera', {}));
sinon.assert.notCalled(activitySpy);
});
});

});
});

0 comments on commit 3a2c1d7

Please sign in to comment.