Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: LayoutTests/http/tests/media/mixed-range-response.html

Issue 1226473002: Add LayoutTests for mixed range response handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/media/mixed-range-response.html
diff --git a/LayoutTests/http/tests/media/mixed-range-response.html b/LayoutTests/http/tests/media/mixed-range-response.html
new file mode 100644
index 0000000000000000000000000000000000000000..3d7ea641fe03b3330e3c075fe03e8cc0cffd5412
--- /dev/null
+++ b/LayoutTests/http/tests/media/mixed-range-response.html
@@ -0,0 +1,30 @@
+<title>Mixed range responses must be handled as an error.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<body>
+<script>
+// This file tests the following behavior:
+// 1. The audio element sends the first request.
+// 2. mixed-range-response.php returns the first 3 bytes ("Ogg").
+// 3. The element sends the second request with "Range: bytes=3-" header.
+// 4. mixed-range-response.php returns 206 response.
+// 5. The element sends the thired request to load-video.php.
+// 6. load-video.php returns the audio file from the fourth byte.
+//
+// The original URLs of 2. (mixed-range-response.php) and 6. (load-video.php)
+// are different. So an error should be occur.
+
+async_test(function(t) {
+ var audio = document.createElement('audio');
+ audio.oncanplay = t.step_func(function() {
+ throw 'CanPlay event should not be fired.';
+ });
+ audio.onerror = t.step_func(function() {
+ t.done();
+ });
+ audio.src = './resources/mixed-range-response.php';
+ document.body.appendChild(audio);
+});
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698