null-image-source.html (1071B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Null image source check for src, srcset and picture parent</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id=log></div> 7 <img id="src_id" src=""> 8 <img id="srcset_id" srcset=""> 9 <picture><img id="parent_picture_id"></picture> 10 <script> 11 async_test(function(t) { 12 img = document.getElementById('src_id'); 13 img.onerror = t.step_func(function(e) { 14 assert_equals(e.type, "error", "null image source check failed"); 15 t.done(); 16 }); 17 }, "img with empty src"); 18 19 async_test(function(t) { 20 img = document.getElementById('srcset_id'); 21 img.onerror = t.unreached_func("empty srcset fires an error"); 22 t.step_timeout(function() { t.done(); }, 2000); 23 }, "img with empty srcset"); 24 25 async_test(function(t) { 26 img = document.getElementById('parent_picture_id'); 27 img.onerror = t.unreached_func("null img with picture parent fires an error"); 28 t.step_timeout(function() { t.done(); }, 2000); 29 }, "img with picture parent"); 30 </script>