[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_view_html_string_load_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_html_string_load : public utc_blink_ewk_base
8 {
9   void LoadFinished(Evas_Object*) override { EventLoopStop(Success); }
10 };
11
12 /**
13  * @brief Negative test case of ewk_view_html_string_load()
14  */
15
16 TEST_F(utc_blink_ewk_view_html_string_load, NullAsView)
17 {
18   ASSERT_EQ(EINA_FALSE, ewk_view_html_string_load(NULL, "<html></html>", NULL, NULL));
19 }
20
21 TEST_F(utc_blink_ewk_view_html_string_load, NullAsHtml)
22 {
23   ASSERT_EQ(EINA_FALSE, ewk_view_html_string_load(GetEwkWebView(), NULL, NULL, NULL));
24 }
25
26 /**
27  * @brief Positive test case of ewk_view_html_string_load()
28  */
29 TEST_F(utc_blink_ewk_view_html_string_load, SimplePage)
30 {
31   ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(),
32             "<html><head><title>ewk_view_html_string_load</title></head></html>", NULL, NULL));
33   ASSERT_EQ(Success, EventLoopStart());
34   ASSERT_STREQ("ewk_view_html_string_load", ewk_view_title_get(GetEwkWebView()));
35 }
36
37 /**
38  * @brief Positive test case of ewk_view_html_string_load()
39  */
40 TEST_F(utc_blink_ewk_view_html_string_load, BaseUri)
41 {
42   ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(),
43             "<html><body onload='document.title=document.URL'></body></html>",
44             "http://www.samsung.com/pl/home/", NULL));
45   ASSERT_EQ(Success, EventLoopStart());
46   ASSERT_STREQ("http://www.samsung.com/pl/home/", ewk_view_title_get(GetEwkWebView()));
47 }
48
49 /**
50  * @brief Positive test case of ewk_view_html_string_load()
51  */
52 TEST_F(utc_blink_ewk_view_html_string_load, UnreachableUri)
53 {
54   ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(), "<html><body></body></html>",
55                                                  NULL, "http://www.samsung.com/pl/home/"));
56   ASSERT_EQ(Success, EventLoopStart());
57   ASSERT_STREQ("http://www.samsung.com/pl/home/", ewk_view_url_get(GetEwkWebView()));
58 }