diff options
Diffstat (limited to 'tests/wpt/tests/fenced-frame/automatic-beacon-cross-origin-navigation.https.html')
-rw-r--r-- | tests/wpt/tests/fenced-frame/automatic-beacon-cross-origin-navigation.https.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/wpt/tests/fenced-frame/automatic-beacon-cross-origin-navigation.https.html b/tests/wpt/tests/fenced-frame/automatic-beacon-cross-origin-navigation.https.html new file mode 100644 index 00000000000..5a191174cfe --- /dev/null +++ b/tests/wpt/tests/fenced-frame/automatic-beacon-cross-origin-navigation.https.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<title>Test cross-origin automatic beacons</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> + +<body> +<script> +promise_test(async(t) => { + const actions = new test_driver.Actions(); + const fencedframe = await attachFencedFrameContext({ + generator_api: 'fledge', + automatic_beacon: true + }); + const new_url = new URL("resources/close.html", location.href); + const beacon_data = "this is the beacon data"; + const beacon_type = "reserved.top_navigation_start"; + + await fencedframe.execute(async (new_url, beacon_data, beacon_type) => { + let beacon_event = { + eventType: beacon_type, + eventData: beacon_data, + destination: ["buyer"], + crossOriginExposed: true, + } + window.fence.setReportEventDataForAutomaticBeacons(beacon_event); + + // Add a cross-origin iframe that will perform the top-level navigation. + const iframe = await attachIFrameContext({ + origin: get_host_info().HTTPS_REMOTE_ORIGIN, + headers: [["Allow-Fenced-Frame-Automatic-Beacons", "true"]] + }); + await iframe.execute(async (new_url) => { + addEventListener("click", (event) => { + window.open(new_url, "_blank"); + }); + }, [new_url]); + }, [new_url, beacon_data, beacon_type]); + + await actions.pointerMove(0, 0, {origin: fencedframe.element}) + .pointerDown() + .pointerUp() + .send(); + + const received_beacon_data = + await nextAutomaticBeacon(beacon_type, beacon_data); +}, 'Automatic beacon in a cross-origin subframe'); +</script> +</body> |