[rygel] tests: Mock HTTPSeek.total_length
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tests: Mock HTTPSeek.total_length
- Date: Thu, 7 Apr 2011 23:22:19 +0000 (UTC)
commit 1ae036c129d9ad0842b13628bc1ed0de73b4877c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Apr 4 22:28:50 2011 +0300
tests: Mock HTTPSeek.total_length
tests/rygel-http-gst-response-test.vala | 18 +++++++++++++-----
tests/rygel-http-response-test.vala | 4 +++-
tests/rygel-http-seekable-response-test.vala | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/tests/rygel-http-gst-response-test.vala b/tests/rygel-http-gst-response-test.vala
index 734e72b..8032ed2 100644
--- a/tests/rygel-http-gst-response-test.vala
+++ b/tests/rygel-http-gst-response-test.vala
@@ -64,7 +64,9 @@ public class Rygel.HTTPGstResponseTest : Rygel.HTTPResponseTest {
var seek = null as HTTPSeek;
if (!this.item.is_live_stream ()) {
- seek = new HTTPByteSeek (0, HTTPResponseTest.MAX_BYTES - 1);
+ seek = new HTTPByteSeek (0,
+ HTTPResponseTest.MAX_BYTES - 1,
+ this.item.size);
msg.response_headers.set_content_length (seek.length);
}
@@ -115,6 +117,12 @@ public class Rygel.MediaItem {
private static const long MAX_BUFFERS =
HTTPResponseTest.MAX_BYTES / BLOCK_SIZE;
+ public int64 size {
+ get {
+ return MAX_BUFFERS * BLOCK_SIZE;
+ }
+ }
+
private dynamic Element src;
public MediaItem () {
@@ -140,14 +148,14 @@ public class Rygel.MediaItem {
}
internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
- public HTTPByteSeek (int64 start, int64 stop) {
- base (start, stop);
+ public HTTPByteSeek (int64 start, int64 stop, int64 total_length) {
+ base (start, stop, total_length);
}
}
internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
- public HTTPTimeSeek (int64 start, int64 stop) {
- base (start, stop);
+ public HTTPTimeSeek (int64 start, int64 stop, int64 total_length) {
+ base (start, stop, total_length);
}
}
diff --git a/tests/rygel-http-response-test.vala b/tests/rygel-http-response-test.vala
index 32c9a25..6d5478a 100644
--- a/tests/rygel-http-response-test.vala
+++ b/tests/rygel-http-response-test.vala
@@ -237,10 +237,12 @@ public class Rygel.HTTPSeek : GLib.Object {
public int64 start { get; private set; }
public int64 stop { get; private set; }
public int64 length { get; private set; }
+ public int64 total_length { get; private set; }
- public HTTPSeek (int64 start, int64 stop) {
+ public HTTPSeek (int64 start, int64 stop, int64 total_length) {
this.start = start;
this.stop = stop;
+ this.total_length = total_length;
this.length = stop - start + 1;
}
diff --git a/tests/rygel-http-seekable-response-test.vala b/tests/rygel-http-seekable-response-test.vala
index 097ac9a..8b72aeb 100644
--- a/tests/rygel-http-seekable-response-test.vala
+++ b/tests/rygel-http-seekable-response-test.vala
@@ -76,8 +76,8 @@ public class Rygel.HTTPSeekableResponseTest : Rygel.HTTPResponseTest {
internal override HTTPResponse create_response (Soup.Message msg)
throws Error {
- var seek = new HTTPSeek (0, HTTPResponseTest.MAX_BYTES - 1);
var item = new MediaItem ();
+ var seek = new HTTPSeek (0, HTTPResponseTest.MAX_BYTES - 1, item.size);
var request = new HTTPGet (this.server.context.server,
msg,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]