Bug 1669628 Part 2: Removing fast enough timing checks on intermittent test browser/browser_touch_simulation.js. r=jdescottes

This is a timing test that includes checks on whether an event happened "fast
enough". Those checks are too hard to dial in between short enough to be
relevant and long enough to ensure it's never intermittent. This change takes
them out while preserving the rest of the test, including the checks that some
events happen after a "slow enough" delay.

Differential Revision: https://phabricator.services.mozilla.com/D92954
This commit is contained in:
Brad Werth 2020-10-09 08:06:15 +00:00
Родитель 9fd7c4a9f4
Коммит f99f295b79
1 изменённых файлов: 6 добавлений и 49 удалений

Просмотреть файл

@ -11,19 +11,10 @@ const PREF_DOM_META_VIEWPORT_ENABLED = "dom.meta-viewport.enabled";
// A 300ms delay between a `touchend` and `click` event is added whenever double-tap zoom
// is allowed.
const DELAY_MIN = 250;
const NO_DELAY_MAX = 80;
addRDMTask(TEST_URL, async function({ ui }) {
reloadOnTouchChange(true);
await SpecialPowers.pushPrefEnv({
set: [
["privacy.reduceTimerPrecision", false],
["privacy.reduceTimerPrecision.unconditional", false],
["privacy.resistFingerprinting", false],
],
});
await waitBootstrap(ui);
await testWithNoTouch(ui);
await toggleTouchSimulation(ui);
@ -33,8 +24,6 @@ addRDMTask(TEST_URL, async function({ ui }) {
await testWithMetaViewportDisabled(ui);
testTouchButton(ui);
await SpecialPowers.popPrefEnv();
reloadOnTouchChange(false);
});
@ -246,10 +235,10 @@ async function testWithMetaViewportEnabled(ui) {
await SpecialPowers.spawn(
ui.getViewportBrowser(),
[{ delay_min: DELAY_MIN, no_delay_max: NO_DELAY_MAX }],
async function({ delay_min, no_delay_max }) {
[{ delay_min: DELAY_MIN }],
async function({ delay_min }) {
// A helper for testing the delay between touchend and click events.
async function testDelay(mvc, el, shouldDelay = false) {
async function testDelay(mvc, el) {
const touchendPromise = ContentTaskUtils.waitForEvent(el, "touchend");
const clickPromise = ContentTaskUtils.waitForEvent(el, "click");
await EventUtils.synthesizeClick(el);
@ -257,16 +246,11 @@ async function testWithMetaViewportEnabled(ui) {
const { timeStamp: clickTimeStamp } = await clickPromise;
const delay = clickTimeStamp - touchendTimestamp;
const time_target = shouldDelay ? delay_min : no_delay_max;
const expected = shouldDelay
? delay >= time_target
: delay <= time_target;
const expected = delay >= delay_min;
ok(
expected,
`${mvc}: There should be ${
shouldDelay ? "greater than" : "less than"
} a ${time_target}ms delay between touch events and mouse events. Got delay of ${delay}ms`
`${mvc}: There should be greater than a ${delay_min}ms delay between touch events and mouse events. Got delay of ${delay}ms`
);
}
@ -288,34 +272,7 @@ async function testWithMetaViewportEnabled(ui) {
);
meta.content = "";
await promiseReflow();
await testDelay("(empty)", div, true);
info(
"testWithMetaViewportEnabled: " +
"click the div element with " +
"<meta name='viewport' content='user-scalable=no'>"
);
meta.content = "user-scalable=no";
await promiseReflow();
await testDelay(meta.content, div, false);
info(
"testWithMetaViewportEnabled: " +
"click the div element with " +
"<meta name='viewport' content='minimum-scale=1,maximum-scale=1'>"
);
meta.content = "minimum-scale=1,maximum-scale=1";
await promiseReflow();
await testDelay(meta.content, div, false);
info(
"testWithMetaViewportEnabled: " +
"click the div element with " +
"<meta name='viewport' content='width=device-width'>"
);
meta.content = "width=device-width";
await promiseReflow();
await testDelay(meta.content, div, false);
await testDelay("(empty)", div);
}
);