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_view_load_progress_get : public utc_blink_ewk_base {
12 void LoadProgress(Evas_Object* webview, double progress)
14 EventLoopStop(utc_blink_ewk_base::Success);
18 static const char * const SAMPLE_HTML_FILE;
19 static const double cProgressComplete;
20 static const double cInvlaidLoad;
23 const char * const utc_blink_ewk_view_load_progress_get::SAMPLE_HTML_FILE = "/common/sample.html";
24 const double utc_blink_ewk_view_load_progress_get::cProgressComplete = 1.0;
25 const double utc_blink_ewk_view_load_progress_get::cInvlaidLoad = -1.0;
28 * @brief Tests if returns TRUE when initiated with a correct context without a page load.
30 TEST_F(utc_blink_ewk_view_load_progress_get, POS_TEST1)
32 Eina_Bool result = EINA_FALSE;
33 double value = ewk_view_load_progress_get(GetEwkWebView());
37 evas_object_show(GetEwkWebView());
38 evas_object_show(GetEwkWebView());
39 EXPECT_EQ(result, EINA_TRUE);
43 * @brief Tests if returns TRUE when not initiated with correct context with a valid page load.
45 TEST_F(utc_blink_ewk_view_load_progress_get, POS_TEST2)
47 ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str());
49 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
50 if (main_result != utc_blink_ewk_base::Success) {
54 Eina_Bool result = EINA_FALSE;
55 double value = ewk_view_load_progress_get(GetEwkWebView());
56 if (value <= cProgressComplete) {
59 evas_object_show(GetEwkWebView());
60 evas_object_show(GetEwkWebView());
61 EXPECT_EQ(result, EINA_TRUE);
65 * @brief Tests if returns FALSE when not initiated with NULL context.
67 TEST_F(utc_blink_ewk_view_load_progress_get, NEG_TEST)
69 Eina_Bool result = EINA_FALSE;
70 double value = ewk_view_load_progress_get(NULL);
71 if (value == cInvlaidLoad) {
74 evas_object_show(GetEwkWebView());
75 evas_object_show(GetEwkWebView());
76 EXPECT_EQ(result, EINA_TRUE);