[libsoup/issue-169] hsts-test: use g_usleep since sleep is not defined on Windows



commit 437c5caebdb5c8e70df92d5440eb7e1d49ac07e4
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Mon Sep 23 11:54:48 2019 +0200

    hsts-test: use g_usleep since sleep is not defined on Windows
    
    Fixes #169

 tests/hsts-test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/tests/hsts-test.c b/tests/hsts-test.c
index 0ea7e289..b01e1f37 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -194,7 +194,7 @@ do_hsts_expire_test (void)
        session_get_uri (session, "https://localhost/two-seconds";, SOUP_STATUS_OK);
        session_get_uri (session, "http://localhost";, SOUP_STATUS_OK);
        /* Wait for the policy to expire. */
-       sleep (3);
+       g_usleep (3 * G_USEC_PER_SEC);
        session_get_uri (session, "http://localhost";, SOUP_STATUS_MOVED_PERMANENTLY);
 
        soup_test_session_abort_unref (session);
@@ -220,7 +220,7 @@ do_hsts_replace_test (void)
        session_get_uri (session, "http://localhost";, SOUP_STATUS_OK);
        session_get_uri (session, "https://localhost/two-seconds";, SOUP_STATUS_OK);
        /* Wait for the policy to expire. */
-       sleep (3);
+       g_usleep (3 * G_USEC_PER_SEC);
        session_get_uri (session, "http://localhost";, SOUP_STATUS_MOVED_PERMANENTLY);
 
        soup_test_session_abort_unref (session);
@@ -231,9 +231,9 @@ do_hsts_update_test (void)
 {
        SoupSession *session = hsts_session_new (NULL);
        session_get_uri (session, "https://localhost/three-seconds";, SOUP_STATUS_OK);
-       sleep (2);
+       g_usleep (2 * G_USEC_PER_SEC);
        session_get_uri (session, "https://localhost/three-seconds";, SOUP_STATUS_OK);
-       sleep (2);
+       g_usleep (2 * G_USEC_PER_SEC);
 
        /* At this point, 4 seconds have elapsed since setting the 3 seconds HSTS
           rule for the first time, and it should have expired by now, but since it
@@ -319,7 +319,7 @@ do_hsts_multiple_headers_test (void)
 {
        SoupSession *session = hsts_session_new (NULL);
        session_get_uri (session, "https://localhost/multiple-headers";, SOUP_STATUS_OK);
-       sleep(2);
+       g_usleep(2 * G_USEC_PER_SEC);
        session_get_uri (session, "http://localhost";, SOUP_STATUS_OK);
        soup_test_session_abort_unref (session);
 }


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