Browse Source

Added HTMLFileUpload unit tests

Pierre-Olivier Latour 11 năm trước cách đây
mục cha
commit
ed709d1476

+ 2 - 0
Run-Tests.sh

@@ -45,6 +45,8 @@ xcodebuild -sdk "$OSX_SDK" -target "$OSX_TARGET" -configuration "$CONFIGURATION"
 # Run tests
 runTests $MRC_PRODUCT "htmlForm" "Tests/HTMLForm"
 runTests $ARC_PRODUCT "htmlForm" "Tests/HTMLForm"
+runTests $MRC_PRODUCT "htmlFileUpload" "Tests/HTMLFileUpload"
+runTests $ARC_PRODUCT "htmlFileUpload" "Tests/HTMLFileUpload"
 runTests $MRC_PRODUCT "webServer" "Tests/WebServer"
 runTests $ARC_PRODUCT "webServer" "Tests/WebServer"
 runTests $MRC_PRODUCT "webDAV" "Tests/WebDAV-Transmit"

+ 9 - 0
Tests/HTMLFileUpload/001-200.response

@@ -0,0 +1,9 @@
+HTTP/1.1 200 OK
+Cache-Control: no-cache
+Content-Length: 299
+Content-Type: text/html; charset=utf-8
+Connection: Close
+Server: GCDWebServer
+Date: Fri, 25 Apr 2014 14:15:11 GMT
+
+<html><body>           <form name="input" action="/" method="post" enctype="multipart/form-data">           <input type="hidden" name="secret" value="42">           <input type="file" name="files" multiple><br/>           <input type="submit" value="Submit">           </form>         </body></html>

+ 10 - 0
Tests/HTMLFileUpload/001-GET.request

@@ -0,0 +1,10 @@
+GET / HTTP/1.1
+Host: localhost:8080
+Connection: keep-alive
+Cache-Control: max-age=0
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
+DNT: 1
+Accept-Encoding: gzip,deflate,sdch
+Accept-Language: en-US,en;q=0.8,fr;q=0.6
+

+ 9 - 0
Tests/HTMLFileUpload/002-200.response

@@ -0,0 +1,9 @@
+HTTP/1.1 200 OK
+Cache-Control: no-cache
+Content-Length: 443
+Content-Type: text/html; charset=utf-8
+Connection: Close
+Server: GCDWebServer
+Date: Fri, 25 Apr 2014 14:15:21 GMT
+
+<html><body><p>secret = 42<br>files = &quot;hero_mba_11.jpg&quot; (image/jpeg | 106 KB)<br>files = &quot;Test File.txt&quot; (text/plain | 0 KB)<br></p><hr>           <form name="input" action="/" method="post" enctype="multipart/form-data">           <input type="hidden" name="secret" value="42">           <input type="file" name="files" multiple><br/>           <input type="submit" value="Submit">           </form>         </body></html>

BIN
Tests/HTMLFileUpload/002-POST.request