[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_view_contents_size_get_func.cpp
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.
4
5 #include "utc_blink_ewk_base.h"
6
7 class utc_blink_ewk_view_contents_size_get : public utc_blink_ewk_base
8 {
9   /* Callback for load finished */
10   void LoadFinished(Evas_Object* webview) override {
11     utc_message("[loadFinished] :: \n");
12     EventLoopStop( Success );
13   }
14 };
15
16 /**
17  * @brief Positive test case of ewk_view_contents_size_get(). Page is loaded and API is called to get content size.
18  */
19 TEST_F(utc_blink_ewk_view_contents_size_get, POS_TEST)
20 {
21   if(!ewk_view_url_set(GetEwkWebView(), GetResourceUrl("common/sample.html").c_str()))
22     utc_fail();
23   if(Success!=EventLoopStart())
24     utc_fail();
25
26   Evas_Coord width = 0;
27   Evas_Coord height = 0;
28
29   Eina_Bool result = ewk_view_contents_size_get(GetEwkWebView(), &width, &height);
30
31   if (width == 0 || height == 0)
32     result = EINA_FALSE;
33
34   utc_check_eq(result, EINA_TRUE);
35 }
36
37 /**
38  * @brief Checking whether function works properly in case of NULL of a webview.
39  */
40 TEST_F(utc_blink_ewk_view_contents_size_get, NEG_TEST)
41 {
42   Evas_Coord width = 0;
43   Evas_Coord height = 0;
44
45   Eina_Bool result = ewk_view_contents_size_get(NULL, &width, &height);
46   utc_check_eq(result, EINA_FALSE);
47 }