OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <title>Verifies there are no spurious repaints for audio in a video tag.</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <video></video> | |
6 <script> | |
7 async_test(function(t) { | |
8 var video = document.querySelector('video'); | |
9 | |
10 video.addEventListener('canplaythrough', t.step_func(function() { | |
11 internals.startTrackingRepaints(document); | |
12 video.play(); | |
13 }), false); | |
14 | |
15 video.addEventListener('ended', t.step_func(function() { | |
16 var layerTree = internals.layerTreeAsText( | |
17 document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS); | |
18 var repaintRects = JSON.parse(layerTree).children[0].repaintRects; | |
19 internals.stopTrackingRepaints(document); | |
20 | |
21 // Manually verify the number of repaints instead of using a repaint | |
22 // test since media playback is asynchronous by nature and its threading | |
23 // will cause a variance in the number of repaints on test bots. | |
24 var minExpected = 3, maxExpected = 4, expectedRect = [8, 8, 300, 150]; | |
25 | |
26 t.add_cleanup(function() { | |
27 if (t.status == t.PASS) | |
28 return; | |
29 console.log('FAIL! An unexpected number of repaints occurred;' + | |
30 ' expected ' + minExpected + ' to ' + maxExpected + | |
31 ' with rects of [' + expectedRect.join(', ') + '].' + | |
32 ' Actual layer tree: ' + layerTree); | |
33 }); | |
34 | |
35 assert_between_inclusive(repaintRects.length, minExpected, maxExpected); | |
36 for (var i = 0; i < repaintRects.length; ++i) | |
37 assert_array_equals(repaintRects[i], expectedRect); | |
38 | |
39 t.done(); | |
40 }), false); | |
41 | |
42 video.src = 'content/silence.wav'; | |
43 }); | |
44 </script> | |
OLD | NEW |