1 | /* |
2 | * Copyright (C) 2015 Igalia S.L. |
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 "config.h" |
21 | |
22 | #include "WebViewTest.h" |
23 | #include <webkit2/webkit2.h> |
24 | |
25 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC |
26 | |
27 | static void testUIProcessAutocleanups(WebViewTest* test, gconstpointer) |
28 | { |
29 | // Sanity-check a couple UI process API autocleanups that are easy to test.... |
30 | g_autoptr(WebKitWebContext) context = webkit_web_context_new(); |
31 | g_assert_true(WEBKIT_IS_WEB_CONTEXT(context)); |
32 | test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(context)); |
33 | |
34 | g_autoptr(WebKitWebsiteDataManager) manager = webkit_website_data_manager_new(nullptr); |
35 | g_assert_true(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager)); |
36 | test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(context)); |
37 | |
38 | g_autoptr(WebKitUserScript) userScript = webkit_user_script_new("" , |
39 | WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START, |
40 | nullptr, nullptr); |
41 | g_assert_nonnull(userScript); |
42 | // Not a GObject, so just checking that this doesn't crash.... |
43 | } |
44 | |
45 | static void testWebProcessAutocleanups(WebViewTest* test, gconstpointer) |
46 | { |
47 | g_assert_true(test->runWebProcessTest("Autocleanups" , "web-process-autocleanups" )); |
48 | } |
49 | |
50 | void beforeAll() |
51 | { |
52 | WebViewTest::add("Autocleanups" , "ui-process-autocleanups" , testUIProcessAutocleanups); |
53 | WebViewTest::add("Autocleanups" , "web-process-autocleanups" , testWebProcessAutocleanups); |
54 | } |
55 | |
56 | #else |
57 | |
58 | void beforeAll() |
59 | { |
60 | } |
61 | |
62 | #endif // G_DEFINE_AUTOPTR_CLEANUP_FUNC |
63 | |
64 | void afterAll() |
65 | { |
66 | } |
67 | |