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 #22951 from KevinGrandon/bug_1052497_browser_chrom…
…e_loading_color Bug 1052497 - [Browser] Update black load screen to white in browser while loading a page
- Loading branch information
Showing
5 changed files
with
189 additions
and
5 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
102 changes: 102 additions & 0 deletions
102
apps/system/test/marionette/browser_site_loading_background_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,102 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var Home = require( | ||
'../../../../apps/verticalhome/test/marionette/lib/home2'); | ||
var Search = require( | ||
'../../../../apps/search/test/marionette/lib/search'); | ||
var Server = require('../../../../shared/test/integration/server'); | ||
var System = require('./lib/system'); | ||
var Rocketbar = require('./lib/rocketbar'); | ||
|
||
marionette('Browser - Site loading background', function() { | ||
|
||
var client = marionette.client({ | ||
prefs: { | ||
'dom.w3c_touch_events.enabled': 1 | ||
}, | ||
settings: { | ||
'ftu.manifestURL': null, | ||
'lockscreen.enabled': false | ||
} | ||
}); | ||
|
||
var home, rocketbar, search, server, system; | ||
|
||
suiteSetup(function(done) { | ||
Server.create(__dirname + '/fixtures/', function(err, _server) { | ||
server = _server; | ||
done(); | ||
}); | ||
}); | ||
|
||
suiteTeardown(function() { | ||
server.stop(); | ||
}); | ||
|
||
setup(function() { | ||
home = new Home(client); | ||
rocketbar = new Rocketbar(client); | ||
search = new Search(client); | ||
system = new System(client); | ||
system.waitForStartup(); | ||
|
||
// Need to wait for the homescreen to be ready as this test takes a | ||
// screenshot. Without the homescreen, we may take a screenshot of the | ||
// system boot screen. | ||
client.apps.launch(Home.URL); | ||
home.waitForLaunch(); | ||
client.switchToFrame(); | ||
|
||
search.removeGeolocationPermission(); | ||
}); | ||
|
||
/** | ||
* Validates the current background color of the current frame. | ||
* Takes a screenshot and parses the pixel data in canvas. | ||
*/ | ||
function validateBackgroundColor(r, g, b) { | ||
var screenshot = client.screenshot(); | ||
var pix = client.executeAsyncScript(function(screenshot) { | ||
var img = document.createElement('img'); | ||
img.src = 'data:image/png;base64,' + screenshot; | ||
|
||
img.onload = function() { | ||
var canvas = document.createElement('canvas'); | ||
canvas.width = img.width; | ||
canvas.height = img.height; | ||
var ctx = canvas.getContext('2d'); | ||
|
||
ctx.drawImage(img, 0, 0); | ||
var x = img.width / 2; | ||
var y = img.height / 2; | ||
|
||
var pixelData = ctx.getImageData(x, y, 1, 1); | ||
marionetteScriptFinished(JSON.stringify(pixelData.data)); | ||
}; | ||
|
||
}, [screenshot]); | ||
pix = JSON.parse(pix); | ||
assert.equal(pix[0], r); | ||
assert.equal(pix[1], g); | ||
assert.equal(pix[2], b); | ||
} | ||
|
||
test('validate loading background color', function() { | ||
var url = server.url('darkpage.html'); | ||
server.cork(url); | ||
|
||
// Use the home-screen search box to open up the system browser | ||
rocketbar.homescreenFocus(); | ||
rocketbar.enterText(url + '\uE006'); | ||
|
||
var frame = client.helper.waitForElement( | ||
'div[transition-state="opened"] iframe[src="' + url + '"]'); | ||
validateBackgroundColor(255, 255, 255); | ||
|
||
server.uncork(url); | ||
client.switchToFrame(frame); | ||
client.helper.waitForElement('body'); | ||
validateBackgroundColor(0, 0, 0); | ||
}); | ||
}); |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Dark page</title> | ||
<style type="text/css"> | ||
html, body { background: #000; color: #fff; } | ||
</style> | ||
</head> | ||
<body> | ||
<header><h1>Mozilla</h1></header> | ||
</body> | ||
</html> |
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
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