summaryrefslogtreecommitdiffstats
path: root/content/test
diff options
context:
space:
mode:
authorkochi@chromium.org <kochi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 07:08:42 +0000
committerkochi@chromium.org <kochi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 07:08:42 +0000
commit6fc9bd393f0831662c2690f86d83e5d19084732a (patch)
treec20dc4db34b702849dec5d009f0c94bff921381f /content/test
parent8f41ef18d8a028e713769acbcc9a2bdea0d39cdd (diff)
downloadchromium_src-6fc9bd393f0831662c2690f86d83e5d19084732a.zip
chromium_src-6fc9bd393f0831662c2690f86d83e5d19084732a.tar.gz
chromium_src-6fc9bd393f0831662c2690f86d83e5d19084732a.tar.bz2
Revert 177607
> Add browser test for encrypted media with media source config changes. > > > BUG=169109 > > > Review URL: https://chromiumcodereview.appspot.com/11778075 TBR=shadi@chromium.org Review URL: https://codereview.chromium.org/12026011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test')
-rw-r--r--content/test/data/media/encrypted_config_change.html94
-rw-r--r--content/test/data/media/encrypted_frame_size_change.html2
-rw-r--r--content/test/data/media/encrypted_media_utils.js22
3 files changed, 8 insertions, 110 deletions
diff --git a/content/test/data/media/encrypted_config_change.html b/content/test/data/media/encrypted_config_change.html
deleted file mode 100644
index ae2414f..0000000
--- a/content/test/data/media/encrypted_config_change.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<html>
- <head>
- <title>Test encrypted media source config changes.</title>
- </head>
- <body onload="runTest();">
- <video controls></video>
- <script src="encrypted_media_utils.js" type="text/javascript"></script>
- <script type="text/javascript">
- var video = document.querySelector('video');
-
- var MEDIA_1 = 'bear-320x240-av-enc_av.webm';
- var MEDIA_1_WIDTH = 320;
- var MEDIA_1_HEIGHT = 240;
-
- var MEDIA_2 = 'bear-640x360-av-enc_av.webm';
- var MEDIA_2_WIDTH = 640;
- var MEDIA_2_HEIGHT = 360;
- var MEDIA_2_LENGTH = 2.75;
-
- // The time in secs to append the second media source.
- var APPEND_TIME = 1;
- // DELTA is the time after APPEND_TIME where the second video dimensions
- // are guaranteed to take effect.
- var DELTA = 0.1;
- // Append MEDIA_2 source at APPEND_TIME, so expected total duration is:
- var TOTAL_DURATION = APPEND_TIME + MEDIA_2_LENGTH;
-
- function appendNextSource(mediaSource) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", MEDIA_2);
- xhr.responseType = 'arraybuffer';
- xhr.addEventListener('load', function(e) {
- var srcBuffer = mediaSource.sourceBuffers[0];
- srcBuffer.timestampOffset = APPEND_TIME;
- srcBuffer.append(new Uint8Array(e.target.response));
- mediaSource.endOfStream();
- });
- xhr.send();
- }
-
- function onTimeUpdate() {
- checkVideoProperties();
- // Seek to APPEND_TIME because after a seek a timeUpdate event is fired
- // before video width and height properties get updated.
- if (video.currentTime < APPEND_TIME) {
- // Seek to save test execution time (about 1 secs) and to test seek
- // on the first buffer.
- video.currentTime = APPEND_TIME - DELTA;
- } else if (video.currentTime > APPEND_TIME + DELTA) {
- video.removeEventListener('timeupdate', onTimeUpdate);
- video.removeEventListener('ended', failTest);
- installTitleEventHandler(video, 'ended');
- // Seek to save test execution time and to test seek on second buffer.
- video.currentTime = APPEND_TIME + MEDIA_2_LENGTH * 0.9;
- }
- }
-
- function checkVideoProperties() {
- // Video duration is a float value so we check it within a range.
- if (!video.duration ||
- Math.abs(video.duration - TOTAL_DURATION) > DELTA) {
- failTest('Unexpected video.duration = ' + video.duration +
- ', expected duration = ' + TOTAL_DURATION);
- }
- if (video.currentTime <= APPEND_TIME) {
- if (video.videoWidth != MEDIA_1_WIDTH ||
- video.videoHeight != MEDIA_1_HEIGHT) {
- logVideoDimensions();
- failTest('Unexpected dimensions for first video segment.');
- }
- } else if (video.currentTime >= APPEND_TIME + DELTA) {
- if (video.videoWidth != MEDIA_2_WIDTH ||
- video.videoHeight != MEDIA_2_HEIGHT) {
- logVideoDimensions();
- failTest('Unexpected dimensions for second video segment.');
- }
- }
- }
-
- function logVideoDimensions() {
- console.log('video.currentTime = ' + video.currentTime +
- ', video dimensions = ' + video.videoWidth + 'x' +
- video.videoHeight + '.');
- }
-
- function runTest() {
- loadEncryptedMedia(video, MEDIA_1, keySystem, KEY, appendNextSource);
- video.addEventListener('timeupdate', onTimeUpdate);
- video.addEventListener('ended', failTest);
- video.play();
- }
- </script>
- </body>
-</html> \ No newline at end of file
diff --git a/content/test/data/media/encrypted_frame_size_change.html b/content/test/data/media/encrypted_frame_size_change.html
index 43f1587..db3c72d 100644
--- a/content/test/data/media/encrypted_frame_size_change.html
+++ b/content/test/data/media/encrypted_frame_size_change.html
@@ -31,7 +31,7 @@
video.addEventListener('pause', function() {
video.addEventListener('seeked', function() {
if (!firstVideoSeek) {
- console.log('One video seeked.');
+ setDocTitle('One video seeked.');
firstVideoSeek = true;
return;
}
diff --git a/content/test/data/media/encrypted_media_utils.js b/content/test/data/media/encrypted_media_utils.js
index 2c7e607..c10b11c 100644
--- a/content/test/data/media/encrypted_media_utils.js
+++ b/content/test/data/media/encrypted_media_utils.js
@@ -49,7 +49,7 @@ function isHeartbeatMessage(msg) {
}
function failTest(msg) {
- console.log('failTest', msg);
+ console.log("failTest('" + msg + "')");
if (msg instanceof Event)
failMessage = msg.target + '.' + msg.type;
else
@@ -57,13 +57,8 @@ function failTest(msg) {
setDocTitle('FAILED');
}
-var titleChanged = false;
function setDocTitle(title) {
- // If document title is 'ENDED', then update it with new title to possibly
- // mark a test as failure. Otherwise, keep the first title change in place.
- if (!titleChanged || document.title.toUpperCase() == 'ENDED')
- document.title = title.toUpperCase();
- titleChanged = true;
+ document.title = title.toUpperCase();
}
function installTitleEventHandler(element, event) {
@@ -73,13 +68,10 @@ function installTitleEventHandler(element, event) {
}
function loadEncryptedMediaFromURL(video) {
- if (!(video && mediaFile && keySystem && KEY))
- failTest('Missing parameters in loadEncryptedMediaFromURL().');
return loadEncryptedMedia(video, mediaFile, keySystem, KEY);
}
-function loadEncryptedMedia(video, mediaFile, keySystem, key,
- appendSourceCallbackFn) {
+function loadEncryptedMedia(video, mediaFile, keySystem, key) {
var keyRequested = false;
var sourceOpened = false;
// Add properties to enable verification that events occurred.
@@ -87,6 +79,9 @@ function loadEncryptedMedia(video, mediaFile, keySystem, key,
video.receivedHeartbeat = false;
video.isHeartbeatExpected = keySystem === EXTERNAL_CLEAR_KEY_KEY_SYSTEM;
+ if (!(video && mediaFile && keySystem && key))
+ failTest('Missing parameters in loadEncryptedMedia().');
+
function onSourceOpen(e) {
if (sourceOpened)
return;
@@ -99,10 +94,7 @@ function loadEncryptedMedia(video, mediaFile, keySystem, key,
xhr.responseType = 'arraybuffer';
xhr.addEventListener('load', function(e) {
srcBuffer.append(new Uint8Array(e.target.response));
- if (appendSourceCallbackFn)
- appendSourceCallbackFn(mediaSource);
- else
- mediaSource.endOfStream();
+ mediaSource.endOfStream();
});
xhr.send();
}