automatic-beacon-two-events-persist.https.html (1975B)
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 // `once` defaults to false. 21 let beacon_event = { 22 eventType: "reserved.top_navigation_commit", 23 eventData: "This is the beacon data!", 24 destination: ["buyer"], 25 } 26 27 await setupAutomaticBeacon(fencedframe, [beacon_event]); 28 29 // The first click should trigger the automatic beacon, but the beacon data 30 // should not be cleared out. 31 await new test_driver.Actions() 32 .pointerMove(0, 0, {origin: fencedframe.element}) 33 .pointerDown() 34 .pointerUp() 35 .send(); 36 await verifyBeaconData(beacon_event.eventType, beacon_event.eventData, 37 get_host_info().HTTPS_REMOTE_ORIGIN); 38 39 // The second click should still have associated automatic beacon data, and a 40 // beacon should be sent. 41 await new test_driver.Actions() 42 .pointerMove(0, 0, {origin: fencedframe.element}) 43 .pointerDown() 44 .pointerUp() 45 .send(); 46 await verifyBeaconData(beacon_event.eventType, beacon_event.eventData, 47 get_host_info().HTTPS_REMOTE_ORIGIN); 48 }, 'Set persisting automatic beacon but trigger two events in a click handler'); 49 50 </script> 51 </body>