interest-groups.tentative.https.sub.html (1400B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/utils.js"></script> 5 <script src="/shared-storage/resources/util.js"></script> 6 <script src="/fenced-frame/resources/utils.js"></script> 7 8 <body> 9 <script> 10 'use strict'; 11 12 promise_test(async t => { 13 const ig = { 14 owner: window.location.origin, 15 name: 'default name', 16 lifetimeMs: 100000 17 }; 18 19 await navigator.joinAdInterestGroup(ig); 20 await sharedStorage.worklet.addModule('resources/simple-module.js'); 21 22 const ancestor_key = token(); 23 let url0 = generateURL("/shared-storage/resources/frame0.html", 24 [ancestor_key]); 25 let url1 = generateURL("/shared-storage/resources/frame1.html", 26 [ancestor_key]); 27 28 let select_url_result = await sharedStorage.selectURL( 29 "verify-interest-groups", [{url: url0}, {url: url1}], 30 {data: {'expectedOwner': ig.owner, 'expectedName': ig.name}, 31 resolveToConfig: true}); 32 assert_true(validateSelectURLResult(select_url_result, true)); 33 attachFencedFrame(select_url_result, 'opaque-ads'); 34 const result = await nextValueFromServer(ancestor_key); 35 36 // This indicates that `interestGroups()` returns expected result. 37 assert_equals(result, "frame1_loaded"); 38 }, 'Basic test for `interestGroups()` in the shared storage worklet'); 39 40 </script> 41 </body>