multiple-url.https.html (918B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/dispatcher/dispatcher.js"></script> 5 <script src="/common/utils.js"></script> 6 <script src="../resources/utils.js"></script> 7 <script src="resources/utils.sub.js"></script> 8 9 <script> 10 setup(() => assertSpeculationRulesIsSupported()); 11 12 promise_test(async t => { 13 let urls = getPrefetchUrlList(5); 14 insertSpeculationRules({ prefetch: [{ source: 'list', urls: urls }] }); 15 await new Promise(resolve => t.step_timeout(resolve, 3000)); 16 17 let prefetched_count = (await Promise.all(urls.map(isUrlPrefetched))).reduce( 18 (count, was_prefetched) => count + (was_prefetched ? 1 : 0), 0); 19 20 assert_greater_than_equal(prefetched_count, 2, "At least two urls should be prefetched to pass the test."); 21 }, "browser should be able to prefetch multiple urls"); 22 </script>