Skip to content

Commit 3ce6105

Browse files
Cleanup to prepare for postMessage / remote runner (#435)
1 parent 2387b9f commit 3ce6105

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

resources/benchmark-runner.mjs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,6 @@ export class BenchmarkRunner {
403403
const prepareEndLabel = "runner-prepare-end";
404404

405405
performance.mark(prepareStartLabel);
406-
this._removeFrame();
407-
await this._appendFrame();
408-
this._page = new Page(this._frame);
409-
410406
let suites = [...this._suites];
411407
if (this._suiteOrderRandomNumberGenerator)
412408
this._shuffleSuites(suites);
@@ -432,10 +428,17 @@ export class BenchmarkRunner {
432428
const suites = await this._prepareAllSuites();
433429
try {
434430
for (const suite of suites) {
435-
if (!suite.disabled)
431+
if (suite.disabled)
432+
continue;
433+
434+
try {
435+
await this._appendFrame();
436+
this._page = new Page(this._frame);
436437
await this.runSuite(suite);
438+
} finally {
439+
this._removeFrame();
440+
}
437441
}
438-
439442
} finally {
440443
await this._finishRunAllSuites();
441444
}
@@ -446,8 +449,6 @@ export class BenchmarkRunner {
446449
const finalizeEndLabel = "runner-finalize-end";
447450

448451
performance.mark(finalizeStartLabel);
449-
// Remove frame to clear the view for displaying the results.
450-
this._removeFrame();
451452
await this._finalize();
452453
performance.mark(finalizeEndLabel);
453454
performance.measure("runner-finalize", finalizeStartLabel, finalizeEndLabel);

tests/benchmark-runner-tests.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe("BenchmarkRunner", () => {
138138

139139
it("should remove the previous frame and then the current frame", () => {
140140
assert.calledTwice(_loadFrameStub);
141-
assert.calledOnce(_appendFrameStub);
141+
assert.calledTwice(_appendFrameStub);
142142
assert.calledTwice(_removeFrameStub);
143143
});
144144

0 commit comments

Comments
 (0)