From 2c3b0d0a3256231a434f4266fb1cd19757c0eca1 Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Mon, 19 Jan 2015 23:46:00 +0100 Subject: [PATCH] Bug 992685 - Part 3. Test video element resize event. r=roc --- dom/media/test/test_video_dimensions.html | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dom/media/test/test_video_dimensions.html b/dom/media/test/test_video_dimensions.html index 8c7439e825c..8f972160924 100644 --- a/dom/media/test/test_video_dimensions.html +++ b/dom/media/test/test_video_dimensions.html @@ -24,12 +24,28 @@ var startTest = function(test, token) { var numVideoElementsFinished = 0; + var ondurationchange = function(ev) { + var v = ev.target; + info(v.testName + " got durationchange"); + v.durationchange = true; + }; + var onresize = function(ev) { + var v = ev.target; + info(v.testName + " got resize"); + ok(!v.resize, v.testName + " should only fire resize once for same size"); + v.resize = true; + ok(v.durationchange, v.testName + + " durationchange event should have been emitted before resize"); + is(v.videoWidth, test.width, v.testName + " width should be set on resize"); + is(v.videoHeight, test.height, v.testName + " height should be set on resize"); + }; var onloadedmetadata = function(ev) { var v = ev.target; + info(v.testName + " got loadedmetadata"); ok(!v.loadedmetadata, v.testName + " should only fire loadedmetadata once"); v.loadedmetadata = true; - is(v.videoWidth, test.width, v.testName + " video width should be set on loadedmetadata"); - is(v.videoHeight, test.height, v.testName + " video height should be set on loadedmetadata"); + ok(v.resize, v.testName + + " resize event should have been emitted before loadedmetadata"); numVideoElementsFinished += 1; if (v === v1) { @@ -45,6 +61,10 @@ var startTest = function(test, token) { } }; var setupElement = function(v, id) { + v.durationchange = false; + v.ondurationchange = ondurationchange; + v.resize = false; + v.onresize = onresize; v.loadedmetadata = false; v.onloadedmetadata = onloadedmetadata; document.body.appendChild(v);