зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577369 [wpt PR 18731] - Reland Add tick duration argument to testdriver Action, a=testonly
Automatic update from web-platform-tests Reland Add tick duration argument to testdriver Action We want to allow the users to define the duration for every tick, so we add an argument to Action class which will be a duration for all ticks. If there is a tick which need a different duration, we can call addTick or pause to pass a different value. Bug: 606367 Change-Id: Ifaad20fd6f6d2a3c97b54960b13289012bd4abc2 TBR=nzolghadr@chromium.org Change-Id: Ifaad20fd6f6d2a3c97b54960b13289012bd4abc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775502 Reviewed-by: Lan Wei <lanwei@chromium.org> Commit-Queue: Lan Wei <lanwei@chromium.org> Cr-Commit-Position: refs/heads/master@{#691445} -- wpt-commits: 42e89dc19437759785c27d35191b4f049276c7b8 wpt-pr: 18731
This commit is contained in:
Родитель
25d00a146b
Коммит
bd02aec3da
|
@ -3,8 +3,10 @@
|
|||
|
||||
/**
|
||||
* Builder for creating a sequence of actions
|
||||
* The default tick duration is set to 16ms, which is one frame time based on
|
||||
* 60Hz display.
|
||||
*/
|
||||
function Actions() {
|
||||
function Actions(defaultTickDuration=16) {
|
||||
this.sourceTypes = new Map([["key", KeySource],
|
||||
["pointer", PointerSource],
|
||||
["none", GeneralSource]]);
|
||||
|
@ -19,6 +21,7 @@
|
|||
}
|
||||
this.createSource("none");
|
||||
this.tickIdx = 0;
|
||||
this.defaultTickDuration = defaultTickDuration;
|
||||
}
|
||||
|
||||
Actions.prototype = {
|
||||
|
@ -40,7 +43,7 @@
|
|||
let actions = [];
|
||||
for (let [sourceType, sourceName] of this.sourceOrder) {
|
||||
let source = this.sources.get(sourceType).get(sourceName);
|
||||
let serialized = source.serialize(this.tickIdx + 1);
|
||||
let serialized = source.serialize(this.tickIdx + 1, this.defaultTickDuration);
|
||||
if (serialized) {
|
||||
serialized.id = sourceName;
|
||||
actions.push(serialized);
|
||||
|
@ -278,17 +281,14 @@
|
|||
}
|
||||
|
||||
GeneralSource.prototype = {
|
||||
serialize: function(tickCount) {
|
||||
if (!this.actions.size) {
|
||||
return undefined;
|
||||
}
|
||||
serialize: function(tickCount, defaultTickDuration) {
|
||||
let actions = [];
|
||||
let data = {"type": "none", "actions": actions};
|
||||
for (let i=0; i<tickCount; i++) {
|
||||
if (this.actions.has(i)) {
|
||||
actions.push(this.actions.get(i));
|
||||
} else {
|
||||
actions.push({"type": "pause"});
|
||||
actions.push({"type": "pause", duration: defaultTickDuration});
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
|
Загрузка…
Ссылка в новой задаче