Fixed a problem that remember popup does not disappear
[framework/web/webkit-efl.git] / TC / unit_test / webkit2 / utc_webkit2_ewk_main_shutdown_func.c
1 /*
2  * Webkit EFL
3  *
4  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your option)
9  * any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21
22 /**
23  * @file utc_webkit_ewk_main_shutdown_func.c
24  * @author Lukasz Gajowy <l.gajowy@samsung.com>
25  * @date 2013-03-25
26  * @brief Tests EWK function ewk_shutdown()
27  */
28
29 #define TESTED_FUN_NAME ewk_shutdown
30 #define POSITIVE_TEST_FUN_NUM 2
31 #define NEGATIVE_TEST_FUN_NUM 1
32
33 #include "utc_webkit2_ewk.h"
34
35 static void startup(void)
36 {
37     utc_webkit2_ewk_test_init();
38 }
39
40 static void cleanup(void)
41 {
42     utc_webkit2_ewk_test_end();
43 }
44
45 /**
46  * @brief Checks, whether ewk_shutdown() returns int value equal to 0.
47  */
48 POS_TEST_FUN(1)
49 {
50     ewk_init();
51     int refCount = ewk_shutdown();
52     utc_check_eq(refCount, 0);
53 }
54
55 /**
56  * @brief Checks the behaviour of the method after multiple invocations of it.
57  */
58 POS_TEST_FUN(2)
59 {
60     int refCountsSize = 2;
61     int refCounts[refCountsSize];
62     int i;
63
64     for(i = 0; i < refCountsSize; i++) {
65         ewk_init();
66     }
67
68     for(i = refCountsSize - 1; i >= 0; i--) {
69         refCounts[i] = ewk_shutdown();
70         utc_message("REF_COUNTS_SHUTDOWN: %d, ITERATOR = %d", refCounts[i], i);
71     }
72
73     for(i = 0; i < refCountsSize; i++) {
74         if(refCounts[i] != i){
75             utc_fail();
76         }
77     }
78     utc_pass();
79 }
80
81 /**
82  * @brief Checks, whether the method doesn't cause errors.
83  */
84 NEG_TEST_FUN(1)
85 {
86     ewk_shutdown();
87     utc_pass();
88 }