Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JS class syntax in harness code #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions MotionMark/resources/debug-runner/debug-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,35 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
ProgressBar = Utilities.createClass(
function(element, ranges)

class ProgressBar {
constructor(element, ranges)
{
this._element = element;
this._ranges = ranges;
this._currentRange = 0;
this._updateElement();
}, {
}

_updateElement: function()
_updateElement()
{
this._element.style.width = (this._currentRange * (100 / this._ranges)) + "%";
},
}

incrementRange: function()
incrementRange()
{
++this._currentRange;
this._updateElement();
}
});
}

DeveloperResultsTable = Utilities.createSubclass(ResultsTable,
function(element, headers)
class DeveloperResultsTable extends ResultsTable {
constructor(element, headers)
{
ResultsTable.call(this, element, headers);
}, {
super(element, headers);
}

_addGraphButton: function(td, testName, testResult, testData)
_addGraphButton(td, testName, testResult, testData)
{
var button = Utilities.createElement("button", { class: "small-button" }, td);
button.textContent = Strings.text.graph + "…";
Expand All @@ -60,9 +61,9 @@ DeveloperResultsTable = Utilities.createSubclass(ResultsTable,
button.addEventListener("click", function(e) {
benchmarkController.showTestGraph(e.target.testName, e.target.testResult, e.target.testData);
});
},
}

_isNoisyMeasurement: function(jsonExperiment, data, measurement, options)
_isNoisyMeasurement(jsonExperiment, data, measurement, options)
{
const percentThreshold = 10;
const averageThreshold = 2;
Expand All @@ -74,9 +75,9 @@ DeveloperResultsTable = Utilities.createSubclass(ResultsTable,
return Math.abs(data[Strings.json.measurements.average] - options["frame-rate"]) >= averageThreshold;

return false;
},
}

_addTest: function(testName, testResult, options, testData)
_addTest(testName, testResult, options, testData)
{
var row = Utilities.createElement("tr", {}, this.element);

Expand Down Expand Up @@ -120,7 +121,7 @@ DeveloperResultsTable = Utilities.createSubclass(ResultsTable,
td.textContent = header.text(testResult);
}, this);
}
});
}

Utilities.extendObject(window.benchmarkRunnerClient, {
testsCount: null,
Expand Down
Loading