Bug 1240044 - wait for MozAfterPaint in browser_profiler_tree_abstract tests on CLOSED TREE;r=bgrins

While waiting for a fix at test harness level, added a helper waiting for MozAfterPaint
when running in e10s mode for all the browser_profiler_tree-abstract tests.

--HG--
extra : commitid : CvYNKvoSNBl
This commit is contained in:
Julian Descottes 2016-01-21 15:42:52 +01:00
Родитель 4722a4bfe8
Коммит a3731f18e6
6 изменённых файлов: 35 добавлений и 6 удалений

Просмотреть файл

@ -132,7 +132,6 @@ skip-if = os == 'linux' || debug # bug 1186322 for Linux, bug 1203895 for leaks
[browser_perf-telemetry-03.js] [browser_perf-telemetry-03.js]
[browser_perf-telemetry-04.js] [browser_perf-telemetry-04.js]
[browser_profiler_tree-abstract-01.js] [browser_profiler_tree-abstract-01.js]
skip-if = e10s && os == 'linux' # bug 1186322
[browser_profiler_tree-abstract-02.js] [browser_profiler_tree-abstract-02.js]
[browser_profiler_tree-abstract-03.js] [browser_profiler_tree-abstract-03.js]
[browser_profiler_tree-abstract-04.js] [browser_profiler_tree-abstract-04.js]

Просмотреть файл

@ -11,7 +11,7 @@ var { Heritage } = Cu.import("resource://devtools/client/shared/widgets/ViewHelp
function* spawnTest() { function* spawnTest() {
let container = document.createElement("vbox"); let container = document.createElement("vbox");
gBrowser.selectedBrowser.parentNode.appendChild(container); yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
// Populate the tree and test the root item... // Populate the tree and test the root item...

Просмотреть файл

@ -11,10 +11,9 @@ var { Heritage } = Cu.import("resource://devtools/client/shared/widgets/ViewHelp
function* spawnTest() { function* spawnTest() {
let container = document.createElement("vbox"); let container = document.createElement("vbox");
gBrowser.selectedBrowser.parentNode.appendChild(container); yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
// Populate the tree and test `expand`, `collapse` and `getChild`... // Populate the tree and test `expand`, `collapse` and `getChild`...
let treeRoot = new MyCustomTreeItem(gDataSrc, { parent: null }); let treeRoot = new MyCustomTreeItem(gDataSrc, { parent: null });
treeRoot.autoExpandDepth = 1; treeRoot.autoExpandDepth = 1;
treeRoot.attachTo(container); treeRoot.attachTo(container);

Просмотреть файл

@ -11,7 +11,7 @@ var { Heritage } = Cu.import("resource://devtools/client/shared/widgets/ViewHelp
function* spawnTest() { function* spawnTest() {
let container = document.createElement("vbox"); let container = document.createElement("vbox");
gBrowser.selectedBrowser.parentNode.appendChild(container); yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
// Populate the tree by pressing RIGHT... // Populate the tree by pressing RIGHT...

Просмотреть файл

@ -10,7 +10,7 @@ var { Heritage } = Cu.import("resource://devtools/client/shared/widgets/ViewHelp
function* spawnTest() { function* spawnTest() {
let container = document.createElement("vbox"); let container = document.createElement("vbox");
gBrowser.selectedBrowser.parentNode.appendChild(container); yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
// Populate the tree and test the root item... // Populate the tree and test the root item...

Просмотреть файл

@ -206,6 +206,37 @@ function onceSpread(aTarget, aEventName, aUseCapture) {
return once(aTarget, aEventName, aUseCapture, true); return once(aTarget, aEventName, aUseCapture, true);
} }
/**
* Returns a promise that will resolve when the window triggers a MozAfterPaint
* event. This ensures the current tab has been painted.
* @return {Promise}
*/
function waitForMozAfterPaint() {
return new Promise(resolve => {
let onMozAfterPaint = function() {
window.removeEventListener("MozAfterPaint", onMozAfterPaint);
resolve();
};
window.addEventListener("MozAfterPaint", onMozAfterPaint);
});
}
/**
* Appends the provided element to the provided parent node. If run in e10s
* mode, will also wait for MozAfterPaint to make sure the tab is rendered.
* Should be reviewed if Bug 1240509 lands
*/
function* appendAndWaitForPaint(parent, element) {
let isE10s = Services.appinfo.browserTabsRemoteAutostart;
if (isE10s) {
let onMozAfterPaint = waitForMozAfterPaint();
parent.appendChild(element);
return onMozAfterPaint;
}
parent.appendChild(element);
}
function test () { function test () {
Task.spawn(spawnTest).then(finish, handleError); Task.spawn(spawnTest).then(finish, handleError);
} }