2 * Copyright (C) 2010 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #include <libsoup/soup.h>
22 #include <webkit/webkit.h>
24 #if GTK_CHECK_VERSION(2, 14, 0)
26 // Make sure the session is initialized properly when webkit_get_default_session() is called.
27 static void test_globals_default_session()
31 SoupSession* session = webkit_get_default_session();
32 soup_session_remove_feature_by_type(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG);
34 // This makes sure our initialization ran.
35 g_assert(soup_session_get_feature(session, SOUP_TYPE_CONTENT_DECODER) != NULL);
37 // Creating a WebView should make sure the session is
38 // initialized, and not mess with our changes.
39 WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
40 g_object_ref_sink(web_view);
41 g_object_unref(web_view);
43 // These makes sure our modification was kept.
44 g_assert(soup_session_get_feature(session, SOUP_TYPE_CONTENT_DECODER) != NULL);
45 g_assert(soup_session_get_feature(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG) == NULL);
48 int main(int argc, char** argv)
51 gtk_test_init(&argc, &argv, NULL);
53 g_test_bug_base("https://bugs.webkit.org/");
54 g_test_add_func("/webkit/globals/default_session",
55 test_globals_default_session);
60 int main(int argc, char** argv)
62 g_critical("You will need gtk-2.14.0 to run the unit tests. Doing nothing now.");