Bug 792935 - Add DASH to test_info_leak, test_progress and test_standalone r=cpearce
authorSteve Workman <sworkman@mozilla.com>
Mon, 28 Jan 2013 18:34:28 -0800
changeset 120139 c9341e21fb33d5af280c05ffcb0154ebac635ac6
parent 120138 c3e9f94548f257ef1a040c16d89631c696da5209
child 120140 33ad7882738af41aeccd4d76fc1f66d5a1f38001
push idunknown
push userunknown
push dateunknown
reviewerscpearce
bugs792935
milestone21.0a1
Bug 792935 - Add DASH to test_info_leak, test_progress and test_standalone r=cpearce
content/base/src/nsContentUtils.cpp
content/media/test/manifest.js
content/media/test/test_info_leak.html
content/media/test/test_seekable1.html
content/media/test/test_standalone.html
layout/build/nsContentDLF.h
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -6375,16 +6375,26 @@ nsContentUtils::FindInternalContentViewe
     docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
     if (docFactory && aLoaderType) {
       *aLoaderType = TYPE_CONTENT;
     }
     return docFactory.forget();
   }
 #endif
 
+#ifdef MOZ_DASH
+  if (DecoderTraits::IsDASHMPDType(nsDependentCString(aType))) {
+    docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
+    if (docFactory && aLoaderType) {
+      *aLoaderType = TYPE_CONTENT;
+    }
+    return docFactory.forget();
+  }
+#endif
+
 #ifdef MOZ_GSTREAMER
   if (DecoderTraits::IsGStreamerSupportedType(nsDependentCString(aType))) {
     docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
     if (docFactory && aLoaderType) {
       *aLoaderType = TYPE_CONTENT;
     }
     return docFactory.forget();
   }
--- a/content/media/test/manifest.js
+++ b/content/media/test/manifest.js
@@ -22,16 +22,17 @@ var gSmallTests = [
 // during resource download.
 var gProgressTests = [
   { name:"r11025_u8_c1.wav", type:"audio/x-wav", duration:1.0, size:11069 },
   { name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 },
   { name:"seek.ogv", type:"video/ogg", duration:3.966, size:285310 },
   { name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.266, size:28942 },
   { name:"seek.webm", type:"video/webm", duration:3.966, size:215529 },
   { name:"gizmo.mp4", type:"video/mp4", duration:5.56, size:383631 },
+  { name:"dash-manifest.mpd", type:"application/dash+xml", duration:3.966 },
   { name:"bogus.duh", type:"bogus/duh" }
 ];
 
 // Used by test_played.html
 var gPlayedTests = [
   { name:"big.wav", type:"audio/x-wav", duration:9.0 },
   { name:"sound.ogg", type:"audio/ogg", duration:4.0 },
   { name:"seek.ogv", type:"video/ogg", duration:3.966 },
@@ -251,25 +252,34 @@ var gInfoLeakTests = [
     src: fileUriToSrc("tests/content/media/test/404.ogg", false),
   }, {
     type: 'video/webm',
     src: fileUriToSrc("tests/content/media/test/seek.webm", true),
   }, {
     type: 'video/webm',
     src: fileUriToSrc("tests/content/media/test/404.webm", false),
   }, {
+    type: 'application/dash+xml',
+    src: fileUriToSrc("tests/content/media/test/dash-manifest.mpd", true),
+  }, {
+    type: 'application/dash+xml',
+    src: fileUriToSrc("tests/content/media/test/404.mpd", false),
+  }, {
     type: 'video/ogg',
     src: 'http://localhost/404.ogv',
   }, {
     type: 'audio/x-wav',
     src: 'http://localhost/404.wav',
   }, {
     type: 'video/webm',
     src: 'http://localhost/404.webm',
   }, {
+    type: 'application/dash+xml',
+    src: 'http://localhost/404.mpd',
+  }, {
     type: 'video/ogg',
     src: 'http://example.com/tests/content/media/test/test_info_leak.html'
   }, {
     type: 'audio/ogg',
     src: 'http://example.com/tests/content/media/test/test_info_leak.html'
   }
 ];
 
--- a/content/media/test/test_info_leak.html
+++ b/content/media/test/test_info_leak.html
@@ -76,17 +76,17 @@ function listener(evt) {
     // other events to come in. Note: we don't expect any events to come
     // in, unless we've leaked some info, and 1 second should be enough time
     // for the leak to show up.
     setTimeout(function() {finish(v);}, 1000); 
   }
 }
 
 function createMedia(type, src, token) {
-  var tag = /^video/.test(type) ? "video" : "audio";
+  var tag = getMajorMimeType(test.type);
   var v = document.createElement(tag);
   for (var i=0; i<gEventTypes.length; i++) {
     v.addEventListener(gEventTypes[i], listener, false);
   }
   v.src = src;
   v.name = src;
   document.body.appendChild(v);
   v.eventNum = 0;
--- a/content/media/test/test_seekable1.html
+++ b/content/media/test/test_seekable1.html
@@ -45,17 +45,17 @@ function createTestArray() {
       t.name = gProgressTests[k].name;
       t.type = gProgressTests[k].type;
       A.push(t);
     }
   return A;
 }
 
 function startTest(test, token) {
-  var elemType = /^audio/.test(test.type) ? "audio" : "video";
+  var elemType = getMajorMimeType(test.type);
   var element = document.createElement(elemType);
   element.src = test.name;
   element.token = token;
   test.setup(element);
   manager.started(token);
 }
 
 manager.runTests(createTestArray(), startTest);
--- a/content/media/test/test_standalone.html
+++ b/content/media/test/test_standalone.html
@@ -13,18 +13,18 @@
 
 var iframes = [];
 
 for (var i=0; i<gSmallTests.length; ++i) {
   var test = gSmallTests[i];
 
   // We can't play WAV files in stand alone documents, so just don't
   // run the test on non-video content types.
-  var isVideo = /^video/.test(test.type) ? true : false;
-  if (!isVideo || !document.createElement("video").canPlayType(test.type))
+  var tag = getMajorMimeType(test.type);
+  if (tag != "video" || !document.createElement("video").canPlayType(test.type))
     continue;
   
   var f = document.createElement("iframe");
   f.src = test.name;
   f._test = test;
   f.id = "frame" + i;
   iframes.push(f);
   document.body.appendChild(f);
--- a/layout/build/nsContentDLF.h
+++ b/layout/build/nsContentDLF.h
@@ -59,16 +59,23 @@ NS_NewContentDocumentLoaderFactory(nsIDo
 #ifdef MOZ_WEBM
 #define CONTENTDLF_WEBM_CATEGORIES \
     { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
 #else
 #define CONTENTDLF_WEBM_CATEGORIES
 #endif
 
+#ifdef MOZ_DASH
+#define CONTENTDLF_DASH_CATEGORIES \
+    { "Gecko-Content-Viewers", APPLICATION_DASH, "@mozilla.org/content/document-loader-factory;1" },
+#else
+#define CONTENTDLF_DASH_CATEGORIES
+#endif
+
 #define CONTENTDLF_CATEGORIES \
     { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
@@ -80,12 +87,14 @@ NS_NewContentDocumentLoaderFactory(nsIDo
     { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_RDF, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", TEXT_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", APPLICATION_CACHED_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", VIEWSOURCE_CONTENT_TYPE, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", IMAGE_SVG_XML, "@mozilla.org/content/document-loader-factory;1" }, \
     { "Gecko-Content-Viewers", APPLICATION_MATHML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
-    CONTENTDLF_WEBM_CATEGORIES
+    CONTENTDLF_WEBM_CATEGORIES \
+    CONTENTDLF_DASH_CATEGORIES
+
 
 #endif