DoYouEvenBench: Extract tests and runner code from benchmark.js/html
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jan 2014 23:22:22 +0000 (23:22 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jan 2014 23:22:22 +0000 (23:22 +0000)
commit31fb60330202304f06e94020a46e8e02020ecd1d
tree08d8b70772cc3fd14d8cab983010e63db0f62bf5
parent616487a450dbd794ed6afd5f5650bb9fc66577bb
DoYouEvenBench: Extract tests and runner code from benchmark.js/html
https://bugs.webkit.org/show_bug.cgi?id=126596

Reviewed by Stephanie Lewis.

Extracted benchmark-runner.js and tests.js out of benchmark.js and benchmark.html.

Added a "client" interface to BenchmarkRunner so that benchmark.html could register necessary hooks to
update its UI. Also made BenchmarkRunner store a tree of results so that the serialization of test names
could be isolated from BenchmarkRunner itself in the future.

* DoYouEvenBench/benchmark.html:
Moved the code to instantiate and update UI here from benchmark.js. The test code was moved out of this
file into resources/tests.js.

* DoYouEvenBench/resources/benchmark-runner.js: Renamed from PerformanceTests/DoYouEvenBench/benchmark.js.
(SimplePromise): Moved from benchmark.js
(SimplePromise.prototype.then): Ditto.
(SimplePromise.prototype.resolve): Ditto.
(BenchmarkTestStep): Added. Wraps each test step.
(BenchmarkRunner.suite): Moved from benchmark.js.
(BenchmarkRunner.setClient): Added.
(BenchmarkRunner.waitForElement): Moved.
(BenchmarkRunner._removeFrame): Ditto.
(BenchmarkRunner._appendFrame): Ditto. Set the width and the height of the iframe as they're more than
presentational as they affect performance.
(BenchmarkRunner._waitAndWarmUp): Ditto.
(BenchmarkRunner._runTest): Ditto.
(BenchmarkRunner._testName): Ditto.
(BenchmarkState): Ditto.
(BenchmarkState.prototype.currentSuite): Ditto.
(BenchmarkState.prototype.currentTest): Ditto.
(BenchmarkState.prototype.next): Ditto.
(BenchmarkState.prototype.isFirstTest): Ditto.
(BenchmarkState.prototype.prepareCurrentSuite): Ditto.
(BenchmarkRunner.step): Ditto.
(BenchmarkRunner._runTestAndRecordResults): Ditto. Note the code to update the UI has been move to
benchmark.html. Also moved the code to accumulate the totals here from _finalize.
(BenchmarkRunner._finalize): Moved.

* DoYouEvenBench/resources/tests.js: Copied from PerformanceTests/DoYouEvenBench/benchmark.html.
Uses BenchmarkTestStep instead of an array for each test step.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/ChangeLog
PerformanceTests/DoYouEvenBench/benchmark.html
PerformanceTests/DoYouEvenBench/resources/benchmark-runner.js [moved from PerformanceTests/DoYouEvenBench/benchmark.js with 55% similarity]
PerformanceTests/DoYouEvenBench/resources/tests.js [new file with mode: 0644]