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 {
11 void LoadProgress(Evas_Object* webview, double progress) override {
12 EventLoopStop(utc_blink_ewk_base::Success);
16 static const char * const SAMPLE_HTML_FILE;
17 static const double cProgressComplete;
18 static const double cInvlaidLoad;
21 const char * const utc_blink_ewk_view_load_progress_get::SAMPLE_HTML_FILE = "/common/sample.html";
22 const double utc_blink_ewk_view_load_progress_get::cProgressComplete = 1.0;
23 const double utc_blink_ewk_view_load_progress_get::cInvlaidLoad = -1.0;
26 * @brief Tests if returns TRUE when initiated with a correct context without a page load.
28 TEST_F(utc_blink_ewk_view_load_progress_get, POS_TEST1)
30 Eina_Bool result = EINA_FALSE;
31 double value = ewk_view_load_progress_get(GetEwkWebView());
35 evas_object_show(GetEwkWebView());
36 evas_object_show(GetEwkWebView());
37 EXPECT_EQ(result, EINA_TRUE);
41 * @brief Tests if returns TRUE when not initiated with correct context with a valid page load.
43 TEST_F(utc_blink_ewk_view_load_progress_get, POS_TEST2)
45 ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str());
47 utc_blink_ewk_base::MainLoopResult main_result = EventLoopStart();
48 if (main_result != utc_blink_ewk_base::Success) {
52 Eina_Bool result = EINA_FALSE;
53 double value = ewk_view_load_progress_get(GetEwkWebView());
54 if (value <= cProgressComplete) {
57 evas_object_show(GetEwkWebView());
58 evas_object_show(GetEwkWebView());
59 EXPECT_EQ(result, EINA_TRUE);
63 * @brief Tests if returns FALSE when not initiated with NULL context.
65 TEST_F(utc_blink_ewk_view_load_progress_get, NEG_TEST)
67 Eina_Bool result = EINA_FALSE;
68 double value = ewk_view_load_progress_get(NULL);
69 if (value == cInvlaidLoad) {
72 evas_object_show(GetEwkWebView());
73 evas_object_show(GetEwkWebView());
74 EXPECT_EQ(result, EINA_TRUE);