diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c')
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c b/Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c deleted file mode 100644 index b806aa111..000000000 --- a/Tools/TestWebKitAPI/Tests/WebKitGtk/testnetworkresponse.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2009 Gustavo Noronha Silva - * Copyright (C) 2009 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include <errno.h> -#include <unistd.h> -#include <glib.h> -#include <glib/gstdio.h> -#include <gtk/gtk.h> -#include <stdlib.h> -#include <webkit/webkit.h> - -static void test_network_response_create_destroy() -{ - WebKitNetworkResponse* response; - SoupMessage* message; - - /* Test creation with URI */ - response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "uri", "http://debian.org/", NULL)); - g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); - message = webkit_network_response_get_message(response); - g_assert(!message); - g_object_unref(response); - - /* Test creation with SoupMessage */ - message = soup_message_new("GET", "http://debian.org/"); - response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, NULL)); - g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); - g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 2); - g_object_unref(response); - g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 1); - g_object_unref(message); - - /* Test creation with both SoupMessage and URI */ - message = soup_message_new("GET", "http://debian.org/"); - response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, "uri", "http://gnome.org/", NULL)); - g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); - g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 2); - g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://gnome.org/"); - g_object_unref(response); - g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 1); - g_object_unref(message); -} - -static void test_network_response_properties() -{ - WebKitNetworkResponse* response; - SoupMessage* message; - gchar* soupURI; - - /* Test URI is set correctly when creating with URI */ - response = webkit_network_response_new("http://debian.org/"); - g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); - g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://debian.org/"); - g_object_unref(response); - - /* Test URI is set correctly when creating with Message */ - message = soup_message_new("GET", "http://debian.org/"); - response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, NULL)); - g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); - g_object_unref(message); - - message = webkit_network_response_get_message(response); - soupURI = soup_uri_to_string(soup_message_get_uri(message), FALSE); - g_assert_cmpstr(soupURI, ==, "http://debian.org/"); - g_free(soupURI); - - g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://debian.org/"); - g_object_unref(response); -} - -int main(int argc, char** argv) -{ - gtk_test_init(&argc, &argv, NULL); - - g_test_bug_base("https://bugs.webkit.org/"); - g_test_add_func("/webkit/networkresponse/createdestroy", test_network_response_create_destroy); - g_test_add_func("/webkit/networkresponse/properties", test_network_response_properties); - return g_test_run (); -} |