1 /* 2 * Copyright (C) 2010 Collabora Ltd. 3 * 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. 8 * 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. 13 * 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. 18 */ 19 20 #include <gtk/gtk.h> 21 #include <libsoup/soup.h> 22 #include <webkit/webkit.h> 23 24 #if GTK_CHECK_VERSION(2, 14, 0) 25 26 // Make sure the session is initialized properly when webkit_get_default_session() is called. 27 static void test_globals_default_session() 28 { 29 g_test_bug("36754"); 30 31 SoupSession* session = webkit_get_default_session(); 32 soup_session_remove_feature_by_type(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG); 33 34 // This makes sure our initialization ran. 35 g_assert(soup_session_get_feature(session, SOUP_TYPE_CONTENT_DECODER) != NULL); 36 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); 42 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); 46 } 47 48 int main(int argc, char** argv) 49 { 50 g_thread_init(NULL); 51 gtk_test_init(&argc, &argv, NULL); 52 53 g_test_bug_base("https://bugs.webkit.org/"); 54 g_test_add_func("/webkit/globals/default_session", 55 test_globals_default_session); 56 return g_test_run(); 57 } 58 59 #else 60 int main(int argc, char** argv) 61 { 62 g_critical("You will need gtk-2.14.0 to run the unit tests. Doing nothing now."); 63 return 0; 64 } 65 66 #endif 67