summaryrefslogtreecommitdiff
path: root/tests/rygel-http-item-uri-test.vala
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2010-03-10 17:54:17 +0200
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2010-03-11 01:08:07 +0200
commit2574f662e4a47e3c6945e82d6dff0a1e1a6af2bb (patch)
tree0a004dbee39854ac71d67593ae984c29499bfab2 /tests/rygel-http-item-uri-test.vala
parenta714bd0f4bfe3d03de1ffa2abd655172aa518a69 (diff)
downloadrygel-2574f662e4a47e3c6945e82d6dff0a1e1a6af2bb.tar.gz
tests: Skip the test if network is not available
Diffstat (limited to 'tests/rygel-http-item-uri-test.vala')
-rw-r--r--tests/rygel-http-item-uri-test.vala19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/rygel-http-item-uri-test.vala b/tests/rygel-http-item-uri-test.vala
index ef6cd042..118ba826 100644
--- a/tests/rygel-http-item-uri-test.vala
+++ b/tests/rygel-http-item-uri-test.vala
@@ -4,6 +4,10 @@ public errordomain Rygel.HTTPRequestError {
NOT_FOUND = Soup.KnownStatusCode.NOT_FOUND
}
+public errordomain Rygel.TestError {
+ SKIP
+}
+
public class Rygel.HTTPServer : GLib.Object {
private const string SERVER_PATH = "/RygelHTTPServer/Rygel/Test";
@@ -11,9 +15,14 @@ public class Rygel.HTTPServer : GLib.Object {
public GUPnP.Context context;
- public HTTPServer () throws Error {
+ public HTTPServer () throws TestError {
this.path_root = SERVER_PATH;
- this.context = new GUPnP.Context (null, "lo", 0);
+
+ try {
+ this.context = new GUPnP.Context (null, "lo", 0);
+ } catch (Error error) {
+ throw new TestError.SKIP ("Network context not available");
+ }
assert (this.context != null);
assert (this.context.host_ip != null);
@@ -33,6 +42,10 @@ public class Rygel.HTTPItemURITest : GLib.Object {
var test = new HTTPItemURITest ();
test.run ();
+ } catch (TestError error) {
+ // FIXME: We should catch the exact error but currently valac issues
+ // unreachable warning if we do so.
+ return 77;
} catch (Error error) {
critical ("%s", error.message);
@@ -54,7 +67,7 @@ public class Rygel.HTTPItemURITest : GLib.Object {
}
}
- private HTTPItemURITest () throws Error {
+ private HTTPItemURITest () throws TestError {
this.server = new HTTPServer ();
}