Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #25280 from KevinGrandon/bug_1084458_confirm_dialo…
Browse files Browse the repository at this point in the history
…g_shb

Bug 1084458 - [Soft Home button] buttons on OTA screen confirmation are partially covered
  • Loading branch information
KevinGrandon authored and mikehenrty committed Oct 21, 2014
1 parent 518a4c7 commit e458f58
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/system/style/themes/default/core.css
Expand Up @@ -21,16 +21,19 @@

/* Fullscreen layout apps need to correct for SHB using css since
the layout manager does not account for SHB in this case. */
#screen.fullscreen-layout-app.software-button-enabled [role="dialog"].generic-dialog {
#screen.fullscreen-layout-app.software-button-enabled [role="dialog"].generic-dialog,
#screen > #dialog-screen {
bottom: var(--software-home-button-height);
}

@media (orientation: landscape) {
#screen.software-button-enabled [role="dialog"].generic-dialog {
#screen.software-button-enabled [role="dialog"].generic-dialog,
#screen > #dialog-screen {
right: var(--software-home-button-height);
}

#screen.fullscreen-layout-app.software-button-enabled [role="dialog"].generic-dialog {
#screen.fullscreen-layout-app.software-button-enabled [role="dialog"].generic-dialog,
#screen > #dialog-screen {
bottom: 0;
}
}
Expand Down
@@ -0,0 +1,83 @@
'use strict';

var fs = require('fs');

var Home = require(
'../../../verticalhome/test/marionette/lib/home2');
var System = require('./lib/system');

var SHARED_PATH = __dirname + '/../../../../shared/test/integration/';

marionette('Software Home Button - Update Dialog Confirm', function() {

var client = marionette.client({
prefs: {
'focusmanager.testmode': true,
'dom.w3c_touch_events.enabled': 1
},
settings: {
'ftu.manifestURL': null,
'lockscreen.enabled': false,
'software-button.enabled': true
}
});

var home, system;
setup(function() {
home = new Home(client);
system = new System(client);
system.waitForStartup();
home.waitForLaunch();
client.switchToFrame();
});

function triggerUpdateDownload() {
client.executeScript(function() {
window.wrappedJSObject.dispatchEvent(new CustomEvent('mozChromeEvent', {
detail: {
type: 'update-downloaded'
}
}));
});
}

test('Update confirm screen with battery', function() {
client.executeScript(fs.readFileSync(
SHARED_PATH + '/mock_navigator_battery.js', 'utf8'));

triggerUpdateDownload();

function rect(el) {
return el.getBoundingClientRect();
}
var winHeight = client.findElement('body').size().height;
client.waitFor(function() {
var dialog = client.findElement('#dialog-screen');
var dialogRect = dialog.scriptWith(rect);
var shbRect = system.softwareButtons.scriptWith(rect);
return dialogRect.bottom === shbRect.top &&
winHeight === (dialogRect.height + shbRect.height);
});
});

test('Update confirm screen without battery', function() {
client.executeScript(function() {
window.wrappedJSObject.navigator.battery.level = 0;
window.wrappedJSObject.navigator.battery.charging = false;
});

triggerUpdateDownload();

function rect(el) {
return el.getBoundingClientRect();
}
var winHeight = client.findElement('body').size().height;
client.waitFor(function() {
var dialog = client.findElement('#dialog-screen');
var dialogRect = dialog.scriptWith(rect);
var shbRect = system.softwareButtons.scriptWith(rect);
return dialogRect.bottom === shbRect.top &&
winHeight === (dialogRect.height + shbRect.height);
});
});
});
12 changes: 12 additions & 0 deletions shared/test/integration/mock_navigator_battery.js
@@ -0,0 +1,12 @@
'use strict';

var win = document.defaultView;
var battery = {
level: 0,
charging: false,
addEventListener: function() {}
};

win.wrappedJSObject.navigator.__defineGetter__('battery', function() {
return battery;
});

0 comments on commit e458f58

Please sign in to comment.