1 // Copyright 2014-2016 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 #include "utc_blink_ewk_base.h"
7 class utc_blink_ewk_context_did_start_download_callback_set
8 : public utc_blink_ewk_base {
10 static const char* download_address;
12 static void did_start_download_cb(const char* download_url, void* user_data) {
15 static_cast<utc_blink_ewk_context_did_start_download_callback_set*>(user_data);
16 owner->EventLoopStop(download_url ? Success : Failure);
21 const char* utc_blink_ewk_context_did_start_download_callback_set::download_address =
22 "http://download.thinkbroadband.com/5MB.zip";
25 * @brief Checking whether callback function for started download is called.
27 TEST_F(utc_blink_ewk_context_did_start_download_callback_set,
28 POS_DOWNLOAD_CALLBACK_CALL) {
29 ewk_context_did_start_download_callback_set(
30 ewk_view_context_get(GetEwkWebView()), did_start_download_cb, this);
32 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), download_address));
33 ASSERT_EQ(Success, EventLoopStart());
37 * @brief Checking whether function works properly in case of NULL of a context.
39 TEST_F(utc_blink_ewk_context_did_start_download_callback_set,
40 NEG_EWK_CONTEXT_NULL) {
41 ewk_context_did_start_download_callback_set(NULL, did_start_download_cb, this);
45 * @brief Checking whether function works properly in case of NULL of a callback
46 * for started download.
48 TEST_F(utc_blink_ewk_context_did_start_download_callback_set,
49 NEG_DOWNLOAD_CALLBACK_NULL) {
50 ewk_context_did_start_download_callback_set(
51 ewk_view_context_get(GetEwkWebView()), NULL, this);
53 ASSERT_TRUE(ewk_view_url_set(GetEwkWebView(), download_address));
54 ASSERT_EQ(Timeout, EventLoopStart(10));