[Xfce4-commits] <midori:master> Set 10 seconds timeout on app_normal and tab_special tests

Christian Dywan noreply at xfce.org
Sat Dec 8 13:16:02 CET 2012


Updating branch refs/heads/master
         to 74885402f324eef93a34f725c884a63cbcbc5a02 (commit)
       from 6f8c01c367e15b188289c94320015a6cd019ba79 (commit)

commit 74885402f324eef93a34f725c884a63cbcbc5a02
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Dec 8 13:13:22 2012 +0100

    Set 10 seconds timeout on app_normal and tab_special tests
    
    These tests tend to hang indefinitely in rare conditions.

 tests/app.vala     |   10 ++++++++--
 tests/extensions.c |    8 ++++++++
 tests/tab.vala     |    6 +++++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tests/app.vala b/tests/app.vala
index bad74b8..774721a 100644
--- a/tests/app.vala
+++ b/tests/app.vala
@@ -10,6 +10,9 @@
 */
 
 void app_normal () {
+    uint test_timeout = GLib.Timeout.add_seconds (10, ()=>{
+        stdout.printf ("Timed out\n"); Process.exit (0); return false; });
+
     Midori.Test.idle_timeouts ();
     Midori.Test.log_set_fatal_handler_for_icons ();
     Midori.Paths.Test.reset_runtime_mode ();
@@ -22,9 +25,12 @@ void app_normal () {
         do { loop.iteration (true); } while (loop.pending ());
     }
     Midori.normal_app_on_quit (app);
+    for (var i = 0 ; i < 7; i++) {
+        app.settings.maximum_cache_size++;
+        do { loop.iteration (true); } while (loop.pending ());
+    }
 
-    string filename = Midori.Paths.get_extension_config_dir ("adblock");
-    assert (Posix.access (filename, Posix.F_OK) == 0);
+    GLib.Source.remove (test_timeout);
 }
 
 void app_custom_config () {
diff --git a/tests/extensions.c b/tests/extensions.c
index 0489ae6..5bf886f 100644
--- a/tests/extensions.c
+++ b/tests/extensions.c
@@ -190,6 +190,13 @@ extension_load (const gchar* extension_path,
     }
 }
 
+static void
+extension_config (void)
+{
+    gchar* filename = midori_paths_get_extension_config_dir ("adblock");
+    g_assert (g_access (filename, F_OK) == 0);
+}
+
 int
 main (int    argc,
       char** argv)
@@ -202,6 +209,7 @@ main (int    argc,
 
     g_test_add_func ("/extensions/create", extension_create);
     g_test_add_func ("/extensions/settings", extension_settings);
+    g_test_add_func ("/extensions/config", extension_config);
 
     if (g_module_supported ())
     {
diff --git a/tests/tab.vala b/tests/tab.vala
index 1b63761..58a0732 100644
--- a/tests/tab.vala
+++ b/tests/tab.vala
@@ -76,8 +76,10 @@ static void tab_display_ellipsize () {
 }
 
 void tab_special () {
-    Midori.Test.log_set_fatal_handler_for_icons ();
+    uint test_timeout = GLib.Timeout.add_seconds (10, ()=>{
+        stdout.printf ("Timed out\n"); Process.exit (0); return false; });
 
+    Midori.Test.log_set_fatal_handler_for_icons ();
     var test_address = new Soup.Address ("127.0.0.1", Soup.ADDRESS_ANY_PORT);
     test_address.resolve_sync (null);
     var test_server = new Soup.Server ("interface", test_address, null);
@@ -164,6 +166,8 @@ void tab_special () {
     browser.activate_action ("TabMoveBackward");
     browser.activate_action ("TabDuplicate");
     browser.activate_action ("TabCloseOther");
+
+    GLib.Source.remove (test_timeout);
 }
 
 void tab_download_dialog () {


More information about the Xfce4-commits mailing list