automatic-beacon-two-events-clear.https.html (2111B)
1 <!DOCTYPE html> 2 <title>Test setReportEventDataForAutomaticBeacons called only once</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/utils.js"></script> 6 <script src="/common/dispatcher/dispatcher.js"></script> 7 <script src="resources/utils.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <script src="/common/get-host-info.sub.js"></script> 12 <script src="resources/automatic-beacon-helper.js"></script> 13 14 <body> 15 <script> 16 promise_test(async(t) => { 17 const fencedframe = await attachFencedFrameContext( 18 {generator_api: 'fledge', register_beacon: true, 19 origin: get_host_info().HTTPS_REMOTE_ORIGIN}); 20 21 let beacon_event = { 22 eventType: "reserved.top_navigation_commit", 23 eventData: "This is the beacon data!", 24 destination: ["buyer"], 25 once: true, 26 } 27 await setupAutomaticBeacon(fencedframe, [beacon_event], 28 "resources/dummy.html", NavigationTrigger.ClickOnce); 29 30 // The first click should trigger the automatic beacon and clear the beacon 31 // data. 32 await new test_driver.Actions() 33 .pointerMove(0, 0, {origin: fencedframe.element}) 34 .pointerDown() 35 .pointerUp() 36 .send(); 37 await verifyBeaconData(beacon_event.eventType, beacon_event.eventData, 38 get_host_info().HTTPS_REMOTE_ORIGIN); 39 40 // The second click should not have any associated automatic beacon info, so 41 // no beacon should be sent. 42 // Set up a timeout to ensure that there's enough time to send any potential 43 // automatic beacons. 44 await new test_driver.Actions() 45 .pointerMove(0, 0, {origin: fencedframe.element}) 46 .pointerDown() 47 .pointerUp() 48 .send(); 49 await verifyBeaconData(beacon_event.eventType, beacon_event.eventData, 50 get_host_info().HTTPS_REMOTE_ORIGIN, false, t); 51 }, 'Set expiring automatic beacon but trigger two events in a click handler'); 52 53 </script> 54 </body>