4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
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)
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.
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
23 * @file utc_webkit2_ewk_context_web_database_path_set_func.c
24 * @author SangYong Park <sy302.park@samsung.com>
26 * @brief Tests EWK function ewk_context_web_database_path_set()
29 /* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
30 #define TESTED_FUN_NAME ewk_context_web_database_path_set
31 #define POSITIVE_TEST_FUN_NUM 1
32 #define NEGATIVE_TEST_FUN_NUM 2
34 #include "utc_webkit2_ewk.h"
35 #include "utc_webkit2_ewk_context_web_database.h"
37 static const char* databasePath = "./tempDatabasePath";
40 /* Startup and cleanup functions */
41 static void startup(void)
46 ewk_context_web_database_path_set(ewk_context_default_get(), databasePath);
48 utc_webkit2_ewk_test_init();
53 static void cleanup(void)
55 utc_webkit2_ewk_test_end();
58 void webDatabaseOriginsGet(Eina_List* origins, void* data)
63 ewk_context_origins_free(origins);
65 if (!stat(databasePath, &fileStat) && (fileStat.st_mode & S_IFDIR) == S_IFDIR)
66 existPath = EINA_TRUE;
68 utc_webkit2_main_loop_quit();
71 static void addWebDatabaseFinished()
73 Ewk_Context* context = ewk_view_context_get(test_view.webview);
74 if (!ewk_context_web_database_origins_get(context, webDatabaseOriginsGet, 0))
75 utc_webkit2_main_loop_quit();
78 static void addWebDatabaseError()
80 utc_webkit2_main_loop_quit();
84 * @brief Tests if can set web database path.
88 existPath = EINA_FALSE;
90 if (!addWebDatabase(addWebDatabaseFinished, addWebDatabaseError))
93 utc_webkit2_main_loop_begin();
95 utc_check_eq(existPath, EINA_TRUE);
99 * @brief Tests if returns false which context was null.
103 utc_check_eq(ewk_context_web_database_path_set(0, databasePath), EINA_FALSE);
107 * @brief Tests if returns false which path was null.
111 Ewk_Context* context = ewk_view_context_get(test_view.webview);
112 utc_check_eq(ewk_context_web_database_path_set(context, 0), EINA_FALSE);