1/*
2 * Copyright (C) 2011 Lukasz Slachciak
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2,1 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 <glib.h>
21#include <glib/gprintf.h>
22#include <gtk/gtk.h>
23#include <webkit/webkit.h>
24
25#if GTK_CHECK_VERSION(2, 14, 0)
26
27static void test_application_cache_maximum_size()
28{
29    unsigned long long maxSize = 8192;
30    webkit_application_cache_set_maximum_size(maxSize);
31
32    // Creating a WebView - make sure that it didn't change anything
33    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
34    g_object_ref_sink(webView);
35    g_object_unref(webView);
36
37    g_assert(maxSize == webkit_application_cache_get_maximum_size());
38}
39
40int main(int argc, char** argv)
41{
42    g_thread_init(NULL);
43    gtk_test_init(&argc, &argv, NULL);
44
45    g_test_bug_base("https://bugs.webkit.org/");
46    g_test_add_func("/webkit/application_cache/maximum_size",
47                    test_application_cache_maximum_size);
48
49    return g_test_run();
50}
51
52#else
53int main(int argc, char** argv)
54{
55    g_critical("You will need gtk-2.14.0 to run the unit tests. Doing nothing now.");
56    return 0;
57}
58
59#endif
60