Back out f08e636ecdc4 (bug 792935) for mochitest failures
authorSteve Workman <sworkman@mozilla.com>
Thu, 31 Jan 2013 10:54:26 -0800
changeset 130364 1ce8f535ff87099eeff0492079fa5bb12686477b
parent 130363 efc9d9f5f30ee04ced4ce563d7f50a8e6cf97a5b
child 130365 f75f99c52648bf9fe9c28089011833430dea0d5b
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs792935
milestone21.0a1
backs outf08e636ecdc4170e4ca59339e1150158904723b4
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out f08e636ecdc4 (bug 792935) for mochitest failures
content/media/test/Makefile.in
content/media/test/dash/dash-manifest-sjs.mpd
content/media/test/dash_detect_stream_switch.sjs
content/media/test/manifest.js
content/media/test/test_dash_detect_stream_switch.html
--- a/content/media/test/Makefile.in
+++ b/content/media/test/Makefile.in
@@ -338,19 +338,16 @@ MOCHITEST_FILES += \
 		test_can_play_type_no_webm.html \
 		$(NULL)
 endif
 
 ifdef MOZ_DASH
 MOCHITEST_FILES += \
     test_can_play_type_dash.html \
     dash/dash-manifest.mpd \
-    dash/dash-manifest-sjs.mpd \
-    test_dash_detect_stream_switch.html \
-    dash_detect_stream_switch.sjs \
     dash/dash-webm-video-320x180.webm \
     dash/dash-webm-video-428x240.webm \
     dash/dash-webm-audio-128k.webm \
     $(NULL)
 else
 MOCHITEST_FILES += \
     test_can_play_type_no_dash.html \
     $(NULL)
deleted file mode 100644
--- a/content/media/test/dash/dash-manifest-sjs.mpd
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<MPD
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns="urn:mpeg:DASH:schema:MPD:2011"
-  xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
-  type="static"
-  mediaPresentationDuration="PT3.958S"
-  minBufferTime="PT1S"
-  profiles="urn:webm:dash:profile:webm-on-demand:2012">
-  <BaseURL>./dash_detect_stream_switch.sjs?name=</BaseURL>
-  <Period id="0" start="PT0S" duration="PT3.958S" >
-    <AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
-      <Representation id="0" bandwidth="54207" width="320" height="180">
-        <BaseURL>dash-webm-video-320x180.webm</BaseURL>
-        <SegmentBase indexRange="35090-35123">
-          <Initialization range="0-228" />
-        </SegmentBase>
-      </Representation>
-      <Representation id="1" bandwidth="78006" width="428" height="240">
-        <BaseURL>dash-webm-video-428x240.webm</BaseURL>
-        <SegmentBase indexRange="50173-50206">
-          <Initialization range="0-228" />
-        </SegmentBase>
-      </Representation>
-    </AdaptationSet>
-    <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="48000" subsegmentStartsWithSAP="1">
-      <Representation id="2" bandwidth="57264">
-        <BaseURL>dash-webm-audio-128k.webm</BaseURL>
-        <SegmentBase indexRange="41927-41946">
-          <Initialization range="0-4521" />
-        </SegmentBase>
-      </Representation>
-    </AdaptationSet>
-  </Period>
-</MPD>
deleted file mode 100644
--- a/content/media/test/dash_detect_stream_switch.sjs
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: JavaScript; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* dash_detect_stream_switch.sjs
- *
- * Parses requests for DASH manifests and ensures stream switching takes place
- * by verifying the subsegments downloaded and the streams they belong to.
- * If unexpected subsegments (byte ranges) are requested, the script will
- * will respond with a 404.
- */
-
-var DEBUG = false;
-
-function parseQuery(request, key) {
-  var params = request.queryString.split('&');
-  if (DEBUG) {
-    dump("DASH-SJS: request params = \"" + params + "\"\n");
-  }
-  for (var j = 0; j < params.length; ++j) {
-    var p = params[j];
-	if (p == key)
-	  return true;
-    if (p.indexOf(key + "=") === 0)
-	  return p.substring(key.length + 1);
-	if (p.indexOf("=") < 0 && key === "")
-	  return p;
-  }
-  return false;
-}
-
-function handleRequest(request, response)
-{
-  try {
-    var name = parseQuery(request, "name");
-    var range = request.hasHeader("Range") ? request.getHeader("Range")
-                                           : undefined;
-    
-    // Should not get request for 1st subsegment from 2nd stream, nor 2nd
-    // subsegment from 1st stream.
-    if (name == "dash-webm-video-320x180.webm" && range == "bytes=25514-32767" ||
-        name == "dash-webm-video-428x240.webm" && range == "bytes=228-35852") 
-    {
-      throw "Should not request " + name + " with byte-range " + range;
-    } else {
-      var rangeSplit = range.split("=");
-      if (rangeSplit.length != 2) {
-        throw "DASH-SJS: ERROR: invalid number of tokens (" + rangeSplit.length +
-              ") delimited by \'=\' in \'Range\' header.";
-      }
-      var offsets = rangeSplit[1].split("-");
-      if (offsets.length != 2) {
-        throw "DASH-SJS: ERROR: invalid number of tokens (" + offsets.length +
-              ") delimited by \'-\' in \'Range\' header.";
-      }
-      var startOffset = parseInt(offsets[0]);
-      var endOffset = parseInt(offsets[1]);
-      var file = Components.classes["@mozilla.org/file/directory_service;1"].
-                            getService(Components.interfaces.nsIProperties).
-                            get("CurWorkD", Components.interfaces.nsILocalFile);
-      var fis  = Components.classes['@mozilla.org/network/file-input-stream;1'].
-                            createInstance(Components.interfaces.nsIFileInputStream);
-      var bis  = Components.classes["@mozilla.org/binaryinputstream;1"].
-                            createInstance(Components.interfaces.nsIBinaryInputStream);
-
-      var paths = "tests/content/media/test/" + name;
-      var split = paths.split("/");
-      for (var i = 0; i < split.length; ++i) {
-        file.append(split[i]);
-      }
-
-      fis.init(file, -1, -1, false);
-      // Exception: start offset should be within file bounds.
-      if (startOffset > file.fileSize) {
-        throw "Starting offset [" + startOffset + "] is after end of file [" +
-              file.fileSize + "].";
-      }
-      // End offset may be too large in the MPD. Real world HTTP servers just
-      // return what data they can; do the same here - reduce the end offset.
-      if (endOffset >= file.fileSize) {
-        if (DEBUG) {
-          dump("DASH-SJS: reducing endOffset [" + endOffset + "] to fileSize [" +
-               (file.fileSize-1) + "]\n");
-        }
-        endOffset = file.fileSize-1;
-      }
-      fis.seek(Components.interfaces.nsISeekableStream.NS_SEEK_SET, startOffset);
-      bis.setInputStream(fis);
-      
-      var byteLengthToRead = endOffset + 1 - startOffset;
-      var totalBytesExpected = byteLengthToRead + startOffset;
-      if (DEBUG) {
-        dump("DASH-SJS: byteLengthToRead = " + byteLengthToRead +
-             " byteLengthToRead+startOffset = " + totalBytesExpected +
-             " fileSize = " + file.fileSize + "\n");
-      }
-
-      var bytes = bis.readBytes(byteLengthToRead);
-      response.setStatusLine(request.httpVersion, 206, "Partial Content");
-      response.setHeader("Content-Length", ""+bytes.length, false);
-      response.setHeader("Content-Type", "application/dash+xml", false);
-      var contentRange = "bytes " + startOffset + "-" + endOffset + "/" +
-                         file.fileSize;
-      response.setHeader("Content-Range", contentRange, false);
-      response.write(bytes, bytes.length);
-      bis.close();
-    }
-  } catch (e) {
-    dump ("DASH-SJS-ERROR: " + e + "\n");
-    response.setStatusLine(request.httpVersion, 404, "Not found");
-  }
-}
--- a/content/media/test/manifest.js
+++ b/content/media/test/manifest.js
@@ -190,23 +190,16 @@ var gInvalidTests = [
   { name:"invalid-m2c0.opus", type:"audio/ogg; codecs=opus"},
   { name:"invalid-m2c1.opus", type:"audio/ogg; codecs=opus"},
   { name:"invalid-cmap-short.opus", type:"audio/ogg; codecs=opus"},
   { name:"invalid-cmap-s0c0.opus", type:"audio/ogg; codecs=opus"},
   { name:"invalid-cmap-s0c2.opus", type:"audio/ogg; codecs=opus"},
   { name:"invalid-cmap-s1c2.opus", type:"audio/ogg; codecs=opus"},
 ];
 
-// Files to test for stream switching. Note: media files referenced in DASH MPD
-// files should be accessed via dash_detect_stream_switch.sjs.
-var gStreamSwitchTests = [
-  { name:"dash-manifest-sjs.mpd", type:"application/dash+xml",
-    width:320, height:180, duration:3.966 }
-];
-
 // Converts a path/filename to a file:// URI which we can load from disk.
 // Optionally checks whether the file actually exists on disk at the location
 // we've specified.
 function fileUriToSrc(path, mustExist) {
   // android mochitest doesn't support file://
   if (navigator.appVersion.indexOf("Android") != -1)
     return path;
 
deleted file mode 100644
--- a/content/media/test/test_dash_detect_stream_switch.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=792935
--->
-<head>
-  <title>Test for Bug 792935 - DASH Stream Switching</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="manifest.js"></script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792935">Mozilla Bug 792935</a>
-  
-</div>
-<pre id="test">
-<script type="text/javascript">
-
-var manager = new MediaTestManager;
-
-function createTestArray() {
-  var tests = [];
-  var tmpVid = document.createElement("video");
-
-  for (var testNum=0; testNum<gStreamSwitchTests.length; testNum++) {
-    var test = gStreamSwitchTests[testNum];
-    if (!tmpVid.canPlayType(test.type)) {
-      continue;
-    }
-    tests.push(test);
-  }
-  return tests;
-}
-
-function ended(evt) {
-  var v = evt.target;
-  if (v.parentNode) {
-    v.parentNode.removeChild(v);
-  }
-  ok(true, "Fully played DASH video implies correct byte ranges downloaded.");
-  dump("STREAM-SWITCH-TEST: Finished " + v._name + "\n");
-  manager.finished(v.token);
-}
-
-function error(evt) {
-  var v = evt.target;
-  ok(false, "Error suggests wrong byte range requested for " + v._name);
-}
-
-function startTest(test, token) {
-  var v = document.createElement('video');
-  manager.started(token);
-  v.type = test.type;
-  v.src = test.name;
-  v._name = test.name + " stream switch test";
-  v.token = token;
-  v.autoplay = true;
-
-  v.addEventListener("error", error, false);
-  v.addEventListener("ended", ended, false);
-
-  dump("STREAM-SWITCH-TEST: Started " + name + "\n");
-  document.body.appendChild(v);
-}
-
-
-manager.runTests(createTestArray(), startTest);
-
-</script>
-</pre>
-</body>
-</html>