[UTC][http][NON-ACR][TCT reinforcement for coverage] 26/215826/3
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 16 Oct 2019 08:35:21 +0000 (17:35 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 16 Oct 2019 08:47:26 +0000 (17:47 +0900)
Change-Id: I3b9c9a26eb6509615135d4ef02193c9501c04709
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
src/utc/http/tct-http-core_mobile.h
src/utc/http/tct-http-core_tizeniot.h
src/utc/http/tct-http-core_wearable.h
src/utc/http/utc-network-http.c

index 9d6dc8d0c72cf56b2a065b252e61f2f2876b85a2..b45dc4c2a1857af2a11b7b484236cc4f6fc9721a 100755 (executable)
@@ -116,7 +116,8 @@ extern int utc_http_transaction_response_get_version_n(void);
 extern int utc_http_transaction_get_realm_n(void);
 extern int utc_http_deinit_n(void);
 extern int utc_http_deinit_p(void);
-extern int utc_http_transaction_submit_n(void);
+extern int utc_http_transaction_submit_n1(void);
+extern int utc_http_transaction_submit_n2(void);
 extern int utc_http_transaction_submit_p(void);
 extern int utc_http_transaction_set_tcp_fastopen_n(void);
 extern int utc_http_transaction_set_tcp_fastopen_p(void);
@@ -218,7 +219,8 @@ testcase tc_array[] = {
        {"utc_http_transaction_get_realm_n",utc_http_transaction_get_realm_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_n",utc_http_deinit_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_p",utc_http_deinit_p,utc_http_startup,utc_http_cleanup},
-       {"utc_http_transaction_submit_n",utc_http_transaction_submit_n,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n1",utc_http_transaction_submit_n1,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n2",utc_http_transaction_submit_n2,utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_submit_p",utc_http_transaction_submit_p,utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_set_tcp_fastopen_n", utc_http_transaction_set_tcp_fastopen_n, utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_set_tcp_fastopen_p", utc_http_transaction_set_tcp_fastopen_p, utc_http_startup,utc_http_cleanup},
index 8d608dac552cda5184365279a4e1c3088209df43..f833e22611af6b0cc1ecb1fccf7171190b3465ff 100755 (executable)
@@ -116,7 +116,8 @@ extern int utc_http_transaction_response_get_version_n(void);
 extern int utc_http_transaction_get_realm_n(void);
 extern int utc_http_deinit_n(void);
 extern int utc_http_deinit_p(void);
-extern int utc_http_transaction_submit_n(void);
+extern int utc_http_transaction_submit_n1(void);
+extern int utc_http_transaction_submit_n2(void);
 extern int utc_http_transaction_submit_p(void);
 
 testcase tc_array[] = {
@@ -214,7 +215,8 @@ testcase tc_array[] = {
        {"utc_http_transaction_get_realm_n",utc_http_transaction_get_realm_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_n",utc_http_deinit_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_p",utc_http_deinit_p,utc_http_startup,utc_http_cleanup},
-       {"utc_http_transaction_submit_n",utc_http_transaction_submit_n,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n1",utc_http_transaction_submit_n1,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n2",utc_http_transaction_submit_n2,utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_submit_p",utc_http_transaction_submit_p,utc_http_startup,utc_http_cleanup},
        {NULL, NULL}
 };
index 9d6dc8d0c72cf56b2a065b252e61f2f2876b85a2..b45dc4c2a1857af2a11b7b484236cc4f6fc9721a 100755 (executable)
@@ -116,7 +116,8 @@ extern int utc_http_transaction_response_get_version_n(void);
 extern int utc_http_transaction_get_realm_n(void);
 extern int utc_http_deinit_n(void);
 extern int utc_http_deinit_p(void);
-extern int utc_http_transaction_submit_n(void);
+extern int utc_http_transaction_submit_n1(void);
+extern int utc_http_transaction_submit_n2(void);
 extern int utc_http_transaction_submit_p(void);
 extern int utc_http_transaction_set_tcp_fastopen_n(void);
 extern int utc_http_transaction_set_tcp_fastopen_p(void);
@@ -218,7 +219,8 @@ testcase tc_array[] = {
        {"utc_http_transaction_get_realm_n",utc_http_transaction_get_realm_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_n",utc_http_deinit_n,utc_http_startup,utc_http_cleanup},
        {"utc_http_deinit_p",utc_http_deinit_p,utc_http_startup,utc_http_cleanup},
-       {"utc_http_transaction_submit_n",utc_http_transaction_submit_n,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n1",utc_http_transaction_submit_n1,utc_http_startup,utc_http_cleanup},
+       {"utc_http_transaction_submit_n2",utc_http_transaction_submit_n2,utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_submit_p",utc_http_transaction_submit_p,utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_set_tcp_fastopen_n", utc_http_transaction_set_tcp_fastopen_n, utc_http_startup,utc_http_cleanup},
        {"utc_http_transaction_set_tcp_fastopen_p", utc_http_transaction_set_tcp_fastopen_p, utc_http_startup,utc_http_cleanup},
index c6fadd7570c620abfd3a0b2fad5f1e2232c4517a..67ca695e471a17ab1127fc3f0a9f26ff923d7e9e 100755 (executable)
@@ -74,7 +74,7 @@ void __transaction_completed_cb(http_transaction_h transaction, void *user_data)
 
 void __transaction_aborted_cb(http_transaction_h transaction, int reason, void *user_data)
 {
-       g_CallbackRet = HTTP_ERROR_OPERATION_FAILED;
+       g_CallbackRet = reason;
 
        if (g_pMainLoop)
                g_main_loop_quit(g_pMainLoop);
@@ -227,6 +227,15 @@ int utc_http_session_create_p(void)
        ret = http_session_create(HTTP_SESSION_MODE_NORMAL, &session);
        assert_eq(ret, HTTP_ERROR_NONE);
 
+       if (session) {
+               ret = http_session_destroy(session);
+               assert_eq(ret, HTTP_ERROR_NONE);
+               session = NULL;
+       }
+
+       ret = http_session_create(HTTP_SESSION_MODE_PIPELINING, &session);
+       assert_eq(ret, HTTP_ERROR_NONE);
+
        return 0;
 }
 
@@ -1483,6 +1492,8 @@ int utc_http_transaction_header_remove_field_n(void)
        }
 #endif
 
+       ret = http_transaction_header_remove_field(transaction, field);
+       assert_eq(ret, HTTP_ERROR_INVALID_OPERATION);
        ret = http_transaction_header_remove_field(transaction, NULL);
        assert_eq(ret, HTTP_ERROR_INVALID_PARAMETER);
        ret = http_transaction_header_remove_field(NULL, field);
@@ -2749,13 +2760,13 @@ int utc_http_deinit_p(void)
 }
 
 /**
- * @testcase        utc_http_transaction_submit_n
+ * @testcase        utc_http_transaction_submit_n1
  * @since_tizen     3.0
  * @type               Negative
  * @description                Submits the Http request.
  * @scenario           Invoking http_transaction_submit with invalid parameter.
  */
-int utc_http_transaction_submit_n(void)
+int utc_http_transaction_submit_n1(void)
 {
        int ret;
 
@@ -2773,6 +2784,38 @@ int utc_http_transaction_submit_n(void)
        return 0;
 }
 
+/**
+ * @testcase        utc_http_transaction_submit_n2
+ * @since_tizen     3.0
+ * @type               Negative
+ * @description                Submits the Http request.
+ * @scenario           Invoking http_transaction_submit with invalid URL.
+ */
+int utc_http_transaction_submit_n2(void)
+{
+       int ret;
+       const char uri[100] = "http://wwwww.12323.org";
+#ifdef WEARABLE
+       if (g_internet_supported == false) {
+               ret = http_transaction_request_set_uri(transaction, uri);
+               assert_eq(ret, TIZEN_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+#endif
+
+       ret = http_transaction_request_set_uri(transaction, uri);
+       assert_eq(ret, HTTP_ERROR_NONE);
+
+       ret = http_transaction_submit(transaction);
+       g_pMainLoop = g_main_loop_new(NULL, false);
+       g_main_loop_run(g_pMainLoop);
+       g_pMainLoop = NULL;
+
+       assert_eq(g_CallbackRet, HTTP_ERROR_COULDNT_RESOLVE_HOST);
+
+       return 0;
+}
+
 /**
  * @testcase        utc_http_transaction_submit_p
  * @since_tizen     3.0
@@ -2784,6 +2827,9 @@ int utc_http_transaction_submit_p(void)
 {
        int ret;
        const char uri[100] = "http://www.tizen.org";
+       const char field[20] = "User-Agent";
+       const char value[20] = "tizen";
+
 #ifdef WEARABLE
        if (g_internet_supported == false) {
                ret = http_transaction_request_set_uri(transaction, uri);
@@ -2795,6 +2841,9 @@ int utc_http_transaction_submit_p(void)
        ret = http_transaction_request_set_uri(transaction, uri);
        assert_eq(ret, HTTP_ERROR_NONE);
 
+       ret = http_transaction_header_add_field(transaction , field, value);
+       assert_eq(ret, HTTP_ERROR_NONE);
+
        ret = http_transaction_submit(transaction);
        g_pMainLoop = g_main_loop_new(NULL, false);
        g_main_loop_run(g_pMainLoop);