Piotr Caban : wininet: Fixed Cache-Content: no-cache tests.

Alexandre Julliard julliard at winehq.org
Mon Apr 15 13:09:41 CDT 2013


Module: wine
Branch: master
Commit: 0d50e86f6abb27e5de643b2de4ece28489374000
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0d50e86f6abb27e5de643b2de4ece28489374000

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Apr 15 14:58:25 2013 +0200

wininet: Fixed Cache-Content: no-cache tests.

---

 dlls/wininet/tests/http.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 968f9e4..031efb1 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1826,6 +1826,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
     int last_request = 0;
     char host_header[22];
     static int test_b = 0;
+    static int test_no_cache = 0;
 
     WSAStartup(MAKEWORD(1,1), &wsaData);
 
@@ -2018,7 +2019,10 @@ static DWORD CALLBACK server_thread(LPVOID param)
         if (strstr(buffer, "GET /test_cache_control_no_cache"))
         {
             static const char no_cache_response[] = "HTTP/1.1 200 OK\r\nCache-Control: no-cache\r\n\r\nsome content";
-            send(c, no_cache_response, sizeof(no_cache_response)-1, 0);
+            if(!test_no_cache++)
+                send(c, no_cache_response, sizeof(no_cache_response)-1, 0);
+            else
+                send(c, okmsg, sizeof(okmsg)-1, 0);
         }
         if (strstr(buffer, "GET /test_cache_control_no_store"))
         {
@@ -2517,8 +2521,17 @@ static void test_no_cache(int port)
     ok(size == 12, "read %d bytes of data\n", size);
     InternetCloseHandle(req);
 
-    ret = DeleteUrlCacheEntry(cache_url);
-    ok(!ret && GetLastError()==ERROR_FILE_NOT_FOUND, "cache entry should not exist\n");
+    req = HttpOpenRequest(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
+    ok(req != NULL, "HttpOpenRequest failed\n");
+
+    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    size = 0;
+    while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
+        size += read;
+    ok(size == 0, "read %d bytes of data\n", size);
+    InternetCloseHandle(req);
+    DeleteUrlCacheEntry(cache_url);
 
     req = HttpOpenRequest(con, NULL, cache_control_no_store, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");




More information about the wine-cvs mailing list