From 1fe94c0a45afd9fdd16533859eaa3ec07db3a9df Mon Sep 17 00:00:00 2001 From: James Graham Date: Thu, 15 Nov 2018 11:05:56 +0000 Subject: [PATCH] Revert "Add action_sequence in testdriver" This reverts commit 3287351b606c4588e397632e2ab04641dc91094d. --- .../testdriver/actions/elementPosition.html | 2 +- .../testdriver/actions/eventOrder.html | 14 +++++++----- ...l => pointerevent_pointermove-manual.html} | 6 ----- resources/testdriver-actions.js | 22 ++++++------------- resources/testdriver.js | 4 ++-- 5 files changed, 18 insertions(+), 30 deletions(-) rename pointerevents/{pointerevent_pointermove.html => pointerevent_pointermove-manual.html} (86%) diff --git a/infrastructure/testdriver/actions/elementPosition.html b/infrastructure/testdriver/actions/elementPosition.html index ab9fb31ad093b1..145852e7b51bd0 100644 --- a/infrastructure/testdriver/actions/elementPosition.html +++ b/infrastructure/testdriver/actions/elementPosition.html @@ -34,7 +34,7 @@ let div = document.getElementById("test"); let actions = new test_driver.Actions() .pointerMove(0, 0, {origin: test}) - .pointerDown(0, 0, {origin: test}) + .pointerDown() .pointerUp() .send() .then(t.step_func_done(() => assert_array_equals(events, [50, 25]))) diff --git a/infrastructure/testdriver/actions/eventOrder.html b/infrastructure/testdriver/actions/eventOrder.html index bd7fef41e9af29..c85b861c7fd9b1 100644 --- a/infrastructure/testdriver/actions/eventOrder.html +++ b/infrastructure/testdriver/actions/eventOrder.html @@ -17,17 +17,19 @@ async_test(t => { Array.prototype.forEach.call(document.getElementsByTagName("button"), - (x) => x.addEventListener("pointerdown", () => {events.push(x.id)})); + (x) => x.addEventListener("mousedown", () => {events.push(x.id)})); let button_a = document.getElementById("a"); let button_b = document.getElementById("b"); let actions = new test_driver.Actions() - .addPointer("pointer1", "touch") - .addPointer("pointer2", "touch") - .pointerDown(0, 0, {origin: button_a, sourceName: "pointer1"}) - .pointerDown(0, 0, {origin: button_b, sourceName: "pointer2"}) - .pointerUp({sourceName: "pointer1"}) + .addPointer("pointer1") + .addPointer("pointer2") + .pointerMove(0, 0, {origin: button_a, sourceName: "pointer1"}) + .pointerMove(0, 0, {origin: button_b, sourceName: "pointer2"}) + .pointerDown({sourceName: "pointer2"}) + .pointerDown({sourceName: "pointer1"}) .pointerUp({sourceName: "pointer2"}) + .pointerUp({sourceName: "pointer1"}) .send() .then(t.step_func_done(() => assert_array_equals(events, ["a", "b"]))) .catch(e => t.step_func(() => assert_unreached("Actions sequence failed " + e))); diff --git a/pointerevents/pointerevent_pointermove.html b/pointerevents/pointerevent_pointermove-manual.html similarity index 86% rename from pointerevents/pointerevent_pointermove.html rename to pointerevents/pointerevent_pointermove-manual.html index 4b168439a4ee14..cf1a1ee4ee852e 100644 --- a/pointerevents/pointerevent_pointermove.html +++ b/pointerevents/pointerevent_pointermove-manual.html @@ -7,9 +7,6 @@ - - - @@ -35,9 +32,6 @@

Test Description: This test checks if pointermove event triggers. Move your eventTested = true; } }); - - // Inject the inputs to run this test. - new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send(); }

Pointer Events pointermove Tests

diff --git a/resources/testdriver-actions.js b/resources/testdriver-actions.js index 82cac85347bfa6..46c68858e45746 100644 --- a/resources/testdriver-actions.js +++ b/resources/testdriver-actions.js @@ -22,14 +22,6 @@ } Actions.prototype = { - ButtonType: { - LEFT: 0, - MIDDLE: 1, - RIGHT: 2, - BACK: 3, - FORWARD: 4, - }, - /** * Generate the action sequence suitable for passing to * test_driver.action_sequence @@ -106,7 +98,7 @@ * @returns {Actions} */ addKeyboard: function(name, set=true) { - this.createSource("key", name); + this.createSource("key", name, true); if (set) { this.setKeyboard(name); } @@ -133,7 +125,7 @@ * @returns {Actions} */ addPointer: function(name, pointerType="mouse", set=true) { - this.createSource("pointer", name, {pointerType: pointerType}); + this.createSource("pointer", name, true, {pointerType: pointerType}); if (set) { this.setPointer(name); } @@ -233,9 +225,9 @@ * pointer source * @returns {Actions} */ - pointerDown: function(x, y, {origin="viewport", button=this.ButtonType.LEFT, sourceName=null}={}) { + pointerDown: function({button=0, sourceName=null}={}) { let source = this.getSource("pointer", sourceName); - source.pointerDown(this, button, x, y, origin); + source.pointerDown(this, button); return this; }, @@ -247,7 +239,7 @@ * source * @returns {Actions} */ - pointerUp: function({button=this.ButtonType.LEFT, sourceName=null}={}) { + pointerUp: function({button=0, sourceName=null}={}) { let source = this.getSource("pointer", sourceName); source.pointerUp(this, button); return this; @@ -367,12 +359,12 @@ return data; }, - pointerDown: function(actions, button, x, y, origin) { + pointerDown: function(actions, button) { let tick = actions.tickIdx; if (this.actions.has(tick)) { tick = actions.addTick().tickIdx; } - this.actions.set(tick, {type: "pointerDown", button, x, y, origin}); + this.actions.set(tick, {type: "pointerDown", button}); }, pointerUp: function(actions, button) { diff --git a/resources/testdriver.js b/resources/testdriver.js index 8ffd765072c4e7..e0741e8d61d4d6 100644 --- a/resources/testdriver.js +++ b/resources/testdriver.js @@ -192,7 +192,7 @@ * @returns {Promise} fufiled after the actions are performed, or rejected in * the cases the WebDriver command errors */ - action_sequence: function(actions) { + action_sequence(actions) { return window.test_driver_internal.action_sequence(actions); } }; @@ -233,7 +233,7 @@ /** * Send a sequence of pointer actions * - * @returns {Promise} fulfilled after actions are sent, rejected if any actions + * @returns {Promise} fufilled after actions are sent, rejected if any actions * fail */ action_sequence: function(actions) {