[rygel] tests: Check for Content-Range format



commit a68291af4a65f42340453d34d3ec096d20d51f3f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Mar 22 15:34:21 2010 +0200

    tests: Check for Content-Range format

 tests/rygel-http-byte-seek-test.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tests/rygel-http-byte-seek-test.vala b/tests/rygel-http-byte-seek-test.vala
index cf2b0c2..88c08c2 100644
--- a/tests/rygel-http-byte-seek-test.vala
+++ b/tests/rygel-http-byte-seek-test.vala
@@ -74,6 +74,8 @@ private class Rygel.HTTPGet : GLib.Object {
 }
 
 private class Rygel.HTTPByteSeekTest : GLib.Object {
+    private Regex range_regex;
+
     public static int main (string[] args) {
         try {
             var test = new HTTPByteSeekTest ();
@@ -97,6 +99,11 @@ private class Rygel.HTTPByteSeekTest : GLib.Object {
         this.test_start_stop_seek ();
     }
 
+    private HTTPByteSeekTest () {
+        this.range_regex = new Regex ("bytes +[0-9]+-[0-9]+/[0-9]+",
+                                      RegexCompileFlags.CASELESS);
+    }
+
     private void test_no_seek () throws HTTPSeekError {
         var request = new HTTPGet ();
 
@@ -138,6 +145,7 @@ private class Rygel.HTTPByteSeekTest : GLib.Object {
         assert (header == "bytes");
         header = request.msg.response_headers.get ("Content-Range");
         assert (header != null);
+        assert (this.range_regex.match (header));
 
         assert (request.msg.response_headers.get_content_length () ==
                 seek.stop - seek.start);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]