[M120 Migration][MM] Support W3C EME
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / unittest / utc_blink_ewk_view_forward_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
8 class utc_blink_ewk_view_forward : public utc_blink_ewk_base {
9 protected:
10  void LoadFinished(Evas_Object* webview) override {
11    EventLoopStop(utc_blink_ewk_base::Success);
12   }
13
14 protected:
15   static const char * const SAMPLE_HTML_FILE;
16   static const char * const SAMPLE_1_HTML_FILE;
17 };
18
19 const char * const utc_blink_ewk_view_forward::SAMPLE_HTML_FILE = "/common/sample.html";
20 const char * const utc_blink_ewk_view_forward::SAMPLE_1_HTML_FILE = "/common/sample_1.html";
21
22 /**
23 * @brief Check whether it is possible to go forward when two pages are loaded and back is done
24 */
25 TEST_F(utc_blink_ewk_view_forward, POS_TEST)
26 {
27   if (!ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str())) {
28     FAIL();
29   }
30   if (utc_blink_ewk_base::Success != EventLoopStart()) {
31     FAIL();
32   }
33
34   if (!ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_1_HTML_FILE).c_str())) {
35     FAIL();
36   }
37   if (utc_blink_ewk_base::Success != EventLoopStart()) {
38     FAIL();
39   }
40
41   Eina_Bool backResult = ewk_view_back(GetEwkWebView());
42   if (utc_blink_ewk_base::Success != EventLoopStart()) {
43     FAIL();
44   }
45
46   const char* currentUrl = ewk_view_url_get(GetEwkWebView());
47   EXPECT_STREQ(currentUrl, GetResourceUrl(SAMPLE_HTML_FILE).c_str());
48
49   Eina_Bool forwardResult = ewk_view_forward(GetEwkWebView());
50   if (utc_blink_ewk_base::Success != EventLoopStart()) {
51     FAIL();
52   }
53
54   EXPECT_EQ(forwardResult, EINA_TRUE);
55 }
56
57 /**
58 * @brief Checking whether function works properly in case of NULL of a webview.
59 */
60 TEST_F(utc_blink_ewk_view_forward, NEG_TEST)
61 {
62   Eina_Bool result = ewk_view_forward(NULL);
63   EXPECT_EQ(result, EINA_FALSE);
64 }