[kazehakase-svn] [3714] remote bookmark test.

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
Mon Feb 16 12:18:20 JST 2009


Revision: 3714
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3714
Author:   ikezoe
Date:     2009-02-16 12:18:20 +0900 (Mon, 16 Feb 2009)

Log Message:
-----------
remote bookmark test.

Modified Paths:
--------------
    kazehakase/trunk/test/test-bookmark-file.c

Modified: kazehakase/trunk/test/test-bookmark-file.c
===================================================================
--- kazehakase/trunk/test/test-bookmark-file.c	2009-02-16 02:03:20 UTC (rev 3713)
+++ kazehakase/trunk/test/test-bookmark-file.c	2009-02-16 03:18:20 UTC (rev 3714)
@@ -12,7 +12,8 @@
 void test_xmlrpc_user (void);
 void test_xmlrpc_pass (void);
 void test_load (void);
-void test_load_start (void);
+void data_load_start (void);
+void test_load_start (gconstpointer data);
 
 static KzBookmarkFile *file;
 static KzBookmark *expected;
@@ -161,21 +162,15 @@
 }
 
 static void
-wait_signal (void)
+wait_signal (gint *n_signals)
 {
     gboolean timeout_emitted = FALSE;
-    gboolean idle_emitted = FALSE;
-    guint timeout_id, idle_id;
+    guint timeout_id;
 
-    idle_id = g_idle_add_full(G_PRIORITY_DEFAULT,
-                              cb_check_emitted, &idle_emitted, NULL);
-
     timeout_id = g_timeout_add_seconds(1, cb_check_emitted, &timeout_emitted);
-    while (!timeout_emitted && !idle_emitted) {
+    while (!timeout_emitted && *n_signals == 0)
         g_main_context_iteration(NULL, TRUE);
-    }
 
-    g_source_remove(idle_id);
     g_source_remove(timeout_id);
 
     cut_assert_false(timeout_emitted, "timeout");
@@ -208,20 +203,33 @@
                      G_CALLBACK(cb_load_completed), NULL);
     g_signal_connect(file, "error",
                      G_CALLBACK(cb_load_error), NULL);
+}
 
+void
+data_load_start (void)
+{
+    cut_add_data("local bookmark",
+                 file_path,
+                 NULL,
+                 "remote bookmark",
+                 "http://kazehakase.sourceforge.jp/bookmark-test.xml",
+                 NULL);
 }
 
 void
-test_load_start (void)
+test_load_start (gconstpointer data)
 {
-    cut_trace(test_new());
+    const gchar *uri = data;
 
+    file = kz_bookmark_file_new(uri, "Bookmark file", "XBEL");
+    cut_assert(file);
+
     setup_signals();
     cut_assert_true(kz_bookmark_file_load_start(file));
 
-    wait_signal();
-
+    wait_signal(&n_load_start_received);
     cut_assert_equal_int(1, n_load_start_received);
+    wait_signal(&n_load_completed_received);
     cut_assert_equal_int(1, n_load_completed_received);
     cut_assert_equal_int(0, n_load_error_received);
 }




More information about the Kazehakase-cvs mailing list
アーカイブの一覧に戻る