1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /* Define those macros _before_ you include the utc_blink_ewk.h header file. */
7 #include "utc_blink_ewk_base.h"
9 class utc_blink_ewk_cookie_manager_accept_policy_set : public utc_blink_ewk_base
12 Ewk_Cookie_Accept_Policy cookies_policy;
14 static void cookies_policy_get_cb(Ewk_Cookie_Accept_Policy policy, void *event_info)
16 utc_blink_ewk_cookie_manager_accept_policy_set *owner = static_cast<utc_blink_ewk_cookie_manager_accept_policy_set*>(event_info);
17 owner->cookies_policy = policy;
18 owner->EventLoopStop(utc_blink_ewk_base::Success);
23 * @brief Checking whether cookies's policy is returned to EWK_COOKIE_ACCEPT_POLICY_NEVER.
25 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, POS_TEST1)
27 cookies_policy = EWK_COOKIE_ACCEPT_POLICY_ALWAYS;
29 Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_view_context_get(GetEwkWebView()));
30 ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
31 ewk_cookie_manager_accept_policy_async_get(cookieManager, cookies_policy_get_cb, this);
33 // Wait until callback finished.
34 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
35 if (main_result != utc_blink_ewk_base::Success)
38 utc_check_eq(cookies_policy, EWK_COOKIE_ACCEPT_POLICY_NEVER);
42 * @brief Checking whether cookies's policy is returned to EWK_COOKIE_ACCEPT_POLICY_ALWAYS.
44 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, POS_TEST2)
46 cookies_policy = EWK_COOKIE_ACCEPT_POLICY_NEVER;
48 Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_view_context_get(GetEwkWebView()));
49 ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
50 ewk_cookie_manager_accept_policy_async_get(cookieManager, cookies_policy_get_cb, this);
52 // Wait until callback finished.
53 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
54 if (main_result != utc_blink_ewk_base::Success)
57 utc_check_eq(cookies_policy, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
61 * @brief Checking whether cookies's policy is returned to EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY.
63 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, POS_TEST3)
65 cookies_policy = EWK_COOKIE_ACCEPT_POLICY_NEVER;
67 Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_view_context_get(GetEwkWebView()));
68 ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY);
69 ewk_cookie_manager_accept_policy_async_get(cookieManager, cookies_policy_get_cb, this);
71 // Wait until callback finished.
72 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
73 if (main_result != utc_blink_ewk_base::Success)
76 utc_check_eq(cookies_policy, EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY);
80 * @brief Checking whether function works properly in case of NULL of a context.
82 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, NEG_TEST1)
84 ewk_cookie_manager_accept_policy_set(NULL, EWK_COOKIE_ACCEPT_POLICY_NEVER);
85 ewk_cookie_manager_accept_policy_async_get(NULL, NULL, NULL);
89 * @brief Checking whether function works properly in case of NULL of a context.
91 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, NEG_TEST2)
93 ewk_cookie_manager_accept_policy_set(NULL, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
94 ewk_cookie_manager_accept_policy_async_get(NULL, NULL, NULL);
98 * @brief Checking whether function works properly in case of NULL of a context.
100 TEST_F(utc_blink_ewk_cookie_manager_accept_policy_set, NEG_TEST3)
102 ewk_cookie_manager_accept_policy_set(NULL, EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY);
103 ewk_cookie_manager_accept_policy_async_get(NULL, NULL, NULL);