[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_view_command_execute_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_command_execute : public utc_blink_ewk_base
8 {
9 protected:
10   /* Callback for load finished */
11  void LoadFinished(Evas_Object* webview) override { EventLoopStop(Success); }
12 };
13
14 /**
15 * @brief Positive test case of ewk_view_command_execute(). Page is loaded and command "SelectAll" is executed.
16 */
17 TEST_F(utc_blink_ewk_view_command_execute, POS_TEST)
18 {
19   if(!ewk_view_url_set(GetEwkWebView(), GetResourceUrl("common/sample.html").c_str()))
20     utc_fail();
21   if(Success!=EventLoopStart())
22     utc_fail();
23
24   Eina_Bool result = ewk_view_command_execute(GetEwkWebView(), "SelectAll", NULL);
25   utc_check_eq(result, EINA_TRUE);
26 }
27
28 /**
29 * @brief Checking whether function works properly in case of NULL of a webview.
30 */
31 TEST_F(utc_blink_ewk_view_command_execute, NEG_TEST1)
32 {
33   Eina_Bool result = ewk_view_command_execute(NULL, "SelectAll", NULL);
34   utc_check_eq(result, EINA_FALSE);
35 }
36
37 /**
38 * @brief Checking whether function works properly in case of NULL of command.
39 */
40 TEST_F(utc_blink_ewk_view_command_execute, NEG_TEST2)
41 {
42   Eina_Bool result = ewk_view_command_execute(GetEwkWebView(), NULL, NULL);
43   utc_check_eq(result, EINA_FALSE);
44 }