Skip to content

Commit

Permalink
Bug 1414706 - dump debug info immediately when a test times out. r=jya
Browse files Browse the repository at this point in the history
For now we dump debug info when the whole test case finishes. However, it
would be harder to relate the debug info to the timed out test when there
are multiple test timeouts.

Note we don't call |this.finished(token)| until v.mozDumpDebugInfo() is done
because |this.finished(token)| might finish the whole test case and clean up
the page which might change the output of v.mozDumpDebugInfo().

MozReview-Commit-ID: BrdZ0EVpaBQ

--HG--
extra : rebase_source : ee5d20c3ab605568e7fe895f14b8e9468fffd5ab
extra : source : 1288e105a94ac05fc3a978b7287dd45ecdfb6e8d
  • Loading branch information
jwwang committed Nov 3, 2017
1 parent 67c58fe commit 4e6da88
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions dom/media/test/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1630,8 +1630,6 @@ function MediaTestManager() {
// Instead MediaTestManager will manage timeout of each test.
SimpleTest.requestLongerTimeout(1000);

this.hasTimeout = false;

// Return how many seconds elapsed since |begin|.
function elapsedTime(begin) {
var end = new Date();
Expand Down Expand Up @@ -1683,10 +1681,10 @@ function MediaTestManager() {
this.numTestsRunning++;
this.handlers[token] = handler;

var onTimeout = () => {
this.hasTimeout = true;
var onTimeout = async () => {
ok(false, "Test timed out!");
info(`${token} timed out!`);
await dumpDebugInfoForToken(token);
this.finished(token);
};
// Default timeout to 180s for each test.
Expand Down Expand Up @@ -1752,9 +1750,6 @@ function MediaTestManager() {
if (this.onFinished) {
this.onFinished();
}
if (this.hasTimeout) {
dumpDebugInfo();
}
var onCleanup = () => {
var end = new Date();
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
Expand Down Expand Up @@ -1789,6 +1784,20 @@ function isSlowPlatform() {
return SpecialPowers.Services.appinfo.name == "B2G" || getAndroidVersion() == 10;
}

async function dumpDebugInfoForToken(token) {
for (let v of document.getElementsByTagName("video")) {
if (token === v.token) {
return v.mozDumpDebugInfo();
}
}
for (let a of document.getElementsByTagName("audio")) {
if (token === a.token) {
return a.mozDumpDebugInfo();
}
}
return Promise.resolve();
}

function dumpDebugInfo() {
for (var v of document.getElementsByTagName("video")) {
v.mozDumpDebugInfo();
Expand Down

0 comments on commit 4e6da88

Please sign in to comment.