зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1034138 - d. Test BackgroundHangMonitor permahangs; r=vladan
This commit is contained in:
Родитель
79918be67b
Коммит
0a54b380f0
|
@ -32,17 +32,25 @@ function run_test() {
|
|||
}
|
||||
}
|
||||
|
||||
// Run two events in the event loop:
|
||||
// the first event causes a hang;
|
||||
// the second event checks results from the first event.
|
||||
// Run three events in the event loop:
|
||||
// the first event causes a transient hang;
|
||||
// the second event causes a permanent hang;
|
||||
// the third event checks results from previous events.
|
||||
|
||||
do_execute_soon(() => {
|
||||
// Cause a hang lasting 1 second.
|
||||
// Cause a hang lasting 1 second (transient hang).
|
||||
let startTime = Date.now();
|
||||
while ((Date.now() - startTime) < 1000) {
|
||||
}
|
||||
});
|
||||
|
||||
do_execute_soon(() => {
|
||||
// Cause a hang lasting 10 seconds (permanent hang).
|
||||
let startTime = Date.now();
|
||||
while ((Date.now() - startTime) < 10000) {
|
||||
}
|
||||
});
|
||||
|
||||
do_execute_soon(() => {
|
||||
do_test_pending();
|
||||
|
||||
|
@ -79,6 +87,14 @@ function run_test() {
|
|||
notEqual(endHangs.hangs[0].stack.length, 0);
|
||||
equal(typeof endHangs.hangs[0].stack[0], "string");
|
||||
|
||||
// Make sure one of the hangs is a permanent
|
||||
// hang containing a native stack.
|
||||
ok(endHangs.hangs.some((hang) => (
|
||||
Array.isArray(hang.nativeStack) &&
|
||||
hang.nativeStack.length !== 0 &&
|
||||
typeof hang.nativeStack[0] === "string"
|
||||
)));
|
||||
|
||||
check_histogram(endHangs.hangs[0].histogram);
|
||||
|
||||
do_test_finished();
|
||||
|
|
Загрузка…
Ссылка в новой задаче