Files
sousa-gecko/testing/web-platform/tests/fenced-frame/automatic-beacon-two-events-clear.https.html
T
Blink WPT Bot 73db1095d7 Bug 1925636 [wpt PR 48701] - Reland "Fenced frame: Fix some WPTs in headless mode.", a=testonly
Automatic update from web-platform-tests
Reland "Fenced frame: Fix some WPTs in headless mode." (#48701)

The original CL was crashing in an instance where multiClick() was
invoked without an await. This fixes the crash by awaiting the clicks
instead of continuing with/finishing the test before all the clicks
have propagated inside navigate-ancestor-test-runner.https.html.

Original change's description:
> Fenced frame: Fix some WPTs in headless mode.
>
> There is currently a push to allow Chromium web platform tests to run
> in headless mode (i.e. without a content shell). This requires some
> changes to how fenced frame tests work. Headless mode does not support
> test_driver functions from inside of fenced frames, as those require
> access to the main frame's window to pass the message onto, which
> fenced frames deliberately block for privacy reasons. This CL fixes
> some of the tests that fail in headless mode by moving those
> test_driver calls to the main frame, specifically clicking actions
> (which we already have multiClick() to handle this in main frames),
> and set_permission().
>
> See the headless mode explainer:
> https://chromium.googlesource.com/chromium/src/+/HEAD/headless/README.md
>
> Change-Id: Iab82a581b67f8f8851c7716a2d72caf566f3b2ae
> Bug: 366257368
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935060
> Reviewed-by: Andrew Verge <averge@chromium.org>
> Commit-Queue: Liam Brady <lbrady@google.com>
> Cr-Commit-Position: refs/heads/main@{#1370151}

Bug: 366257368
Change-Id: Id998687c2f3de41a7b0dcd5197ba74fb22ef979e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5938155
Reviewed-by: Andrew Verge <averge@chromium.org>
Commit-Queue: Liam Brady <lbrady@google.com>
Cr-Commit-Position: refs/heads/main@{#1370703}

Co-authored-by: Liam Brady <lbrady@google.com>
--

wpt-commits: f50cf7fbd84ccdf90f6973b8ce7d75175adb3dc1
wpt-pr: 48701
2024-10-22 23:41:34 +00:00

55 lines
2.1 KiB
HTML

<!DOCTYPE html>
<title>Test setReportEventDataForAutomaticBeacons called only once</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="resources/utils.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/automatic-beacon-helper.js"></script>
<body>
<script>
promise_test(async(t) => {
const fencedframe = await attachFencedFrameContext(
{generator_api: 'fledge', register_beacon: true,
origin: get_host_info().HTTPS_REMOTE_ORIGIN});
let beacon_event = {
eventType: "reserved.top_navigation_commit",
eventData: "This is the beacon data!",
destination: ["buyer"],
once: true,
}
await setupAutomaticBeacon(fencedframe, [beacon_event],
"resources/dummy.html", NavigationTrigger.ClickOnce);
// The first click should trigger the automatic beacon and clear the beacon
// data.
await new test_driver.Actions()
.pointerMove(0, 0, {origin: fencedframe.element})
.pointerDown()
.pointerUp()
.send();
await verifyBeaconData(beacon_event.eventType, beacon_event.eventData,
get_host_info().HTTPS_REMOTE_ORIGIN);
// The second click should not have any associated automatic beacon info, so
// no beacon should be sent.
// Set up a timeout to ensure that there's enough time to send any potential
// automatic beacons.
await new test_driver.Actions()
.pointerMove(0, 0, {origin: fencedframe.element})
.pointerDown()
.pointerUp()
.send();
await verifyBeaconData(beacon_event.eventType, beacon_event.eventData,
get_host_info().HTTPS_REMOTE_ORIGIN, false, t);
}, 'Set expiring automatic beacon but trigger two events in a click handler');
</script>
</body>