[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_view_title_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 #define SAMPLE_HTML_FILE ("/common/sample.html")
8 #define TITLE0 "Test file"
9
10 class utc_blink_ewk_view_title_get_func : public utc_blink_ewk_base
11 {
12 protected:
13  void LoadFinished(Evas_Object*) override {
14    EventLoopStop(utc_blink_ewk_base::Success);  // won't fail the test if
15                                                 // EventLoopStop was already
16                                                 // called
17   }
18 };
19
20 /**
21  * @brief Positive test case of ewk_view_title_get
22  */
23 TEST_F(utc_blink_ewk_view_title_get_func, POS_TEST)
24 {
25     Eina_Bool result = ewk_view_url_set(GetEwkWebView(), GetResourceUrl("common/sample.html").c_str());
26     if (!result)
27         utc_fail();
28     if (EventLoopStart() != utc_blink_ewk_base::Success)
29         utc_fail();
30     char* title = strdup(ewk_view_title_get(GetEwkWebView()));
31     utc_message("Current title: %s", title);
32     utc_check_str_eq(title, TITLE0);
33     free(title);
34 }
35
36 /**
37  * @brief Negative test case of ewk_view_title_get
38  */
39 TEST_F(utc_blink_ewk_view_title_get_func, NEG_TEST)
40 {
41   const char* title = ewk_view_title_get(0);
42   if (title)
43     utc_fail();
44 }