This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
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 #25280 from KevinGrandon/bug_1084458_confirm_dialo…
…g_shb Bug 1084458 - [Soft Home button] buttons on OTA screen confirmation are partially covered
- Loading branch information
1 parent
518a4c7
commit e458f58
Showing
3 changed files
with
101 additions
and
3 deletions.
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
83 changes: 83 additions & 0 deletions
83
apps/system/test/marionette/software_home_update_dialog_confirm_test.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,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); | ||
}); | ||
}); | ||
}); |
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,12 @@ | ||
'use strict'; | ||
|
||
var win = document.defaultView; | ||
var battery = { | ||
level: 0, | ||
charging: false, | ||
addEventListener: function() {} | ||
}; | ||
|
||
win.wrappedJSObject.navigator.__defineGetter__('battery', function() { | ||
return battery; | ||
}); |