[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_settings_default_encoding_set_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_settings_default_encoding_set : public utc_blink_ewk_base {
8 public:
9   static const char* SET_DEFAULT_ENCODING;
10 };
11
12 const char* utc_blink_ewk_settings_default_encoding_set::SET_DEFAULT_ENCODING = "utf-8";
13
14
15 /**
16  * @brief Positive test case for ewk_settings_default_encoding_set(). Set the encoding, get the value and then compare.
17  */
18 TEST_F(utc_blink_ewk_settings_default_encoding_set, POS_TEST)
19 {
20   Ewk_Settings* settings = ewk_view_settings_get(GetEwkWebView());
21   if (!settings) {
22     FAIL();
23   }
24
25   Eina_Bool result = ewk_settings_default_encoding_set(settings, SET_DEFAULT_ENCODING);
26   if (!result) {
27     FAIL();
28   }
29   const char* defaultEncoding = ewk_settings_default_encoding_get(settings);
30   if (!defaultEncoding) {
31     FAIL();
32   }
33   EXPECT_STREQ(defaultEncoding, SET_DEFAULT_ENCODING);
34 }
35
36 /**
37  * @brief Negative test case for ewk_settings_default_encoding_set(). Check if it works fine with NULL as settings.
38  */
39 TEST_F(utc_blink_ewk_settings_default_encoding_set, NEG_TEST)
40 {
41   Eina_Bool result = ewk_settings_default_encoding_set(NULL, SET_DEFAULT_ENCODING);
42   EXPECT_EQ(result, EINA_FALSE);
43 }