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_application_cache.h
24 * @author SangYong Park <sy302.park@samsung.com>
26 * @brief A header file to be used by ewk_context_application_cache unit test cases
29 #define APP_CACHE_PROTOCOL "http"
30 #define APP_CACHE_HOST "html5demos.com"
31 #define APP_CACHE_PORT 0
33 const char* appCacheURL = APP_CACHE_PROTOCOL "://" APP_CACHE_HOST "/offlineapp";
34 const char* checkStatusScript = "window.applicationCache.status";
36 typedef void (*App_Cache_Callback)();
38 App_Cache_Callback finishedCallback;
39 App_Cache_Callback errorCallback;
41 static void scriptExecuted(Evas_Object* o, const char* result, void* data)
43 int status = atoi(result);
45 if (!ewk_view_script_execute(test_view.webview, checkStatusScript, scriptExecuted, 0))
53 static void loadFinished(void* data, Evas_Object* webview, void* info)
55 if (!ewk_view_script_execute(test_view.webview, checkStatusScript, scriptExecuted, 0))
59 static void loadError(void* data, Evas_Object* webview, void* event)
64 static Eina_Bool addApplicationCache(App_Cache_Callback finished, App_Cache_Callback error)
66 finishedCallback = finished;
67 errorCallback = error;
69 evas_object_smart_callback_add(test_view.webview, "load,finished", loadFinished, 0);
70 evas_object_smart_callback_add(test_view.webview, "load,error", loadError, 0);
72 return ewk_view_url_set(test_view.webview, appCacheURL);