deprecated-config-apis.https.html (1679B)
1 <!DOCTYPE html> 2 <title>Tests for configs as arguments to `deprecatedReplaceInURN` and `deprecatedURNToURL`.</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="resources/utils.js"></script> 6 <script src="/common/utils.js"></script> 7 <script src="/common/get-host-info.sub.js"></script> 8 9 <body> 10 <script> 11 12 promise_test(async () => { 13 const expected_url = location.href + '?foo'; 14 const config = await generateURNFromFledgeRawURL(location.href + '?${X}', [], true); 15 await navigator.deprecatedReplaceInURN(config, {'${X}': 'foo'}); 16 const url = await navigator.deprecatedURNToURL(config, false); 17 assert_equals(url, expected_url, 'The retrieved mapped url should match.'); 18 }, 'deprecated urn APIs should work with configs generated by an API'); 19 20 promise_test(async () => { 21 const config = new FencedFrameConfig(location.href); 22 try { 23 await navigator.deprecatedReplaceInURN(config, {}); 24 assert_unreached('deprecatedReplaceInURN must throw for default configs'); 25 } catch (e) { 26 assert_equals(e.message, 27 "Failed to execute 'deprecatedReplaceInURN' on 'Navigator': " 28 + "Passed config must have a mapped URL."); 29 } 30 try { 31 await navigator.deprecatedURNToURL(config, false); 32 assert_unreached('deprecatedURNToURL must throw for default configs'); 33 } catch (e) { 34 assert_equals(e.message, 35 "Failed to execute 'deprecatedURNToURL' on 'Navigator': " 36 + "Passed config must have a mapped URL."); 37 } 38 }, 'deprecated urn APIs should not work with configs generated by a WebIDL constructor'); 39 40 </script> 41 </body> 42 </html>