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.
5 #include "utc_blink_ewk_base.h"
7 class utc_blink_ewk_history_back_list_length_get : public utc_blink_ewk_base
10 void LoadFinished(Evas_Object*) override { EventLoopStop(Success); }
13 static const char* const TEST_URL1;
14 static const char* const TEST_URL2;
15 static const char* const TEST_URL3;
18 const char* const utc_blink_ewk_history_back_list_length_get::TEST_URL1 = "ewk_history/page1.html";
19 const char* const utc_blink_ewk_history_back_list_length_get::TEST_URL2 = "ewk_history/page2.html";
20 const char* const utc_blink_ewk_history_back_list_length_get::TEST_URL3 = "ewk_history/page3.html";
22 TEST_F(utc_blink_ewk_history_back_list_length_get, EMPTY_TEST)
24 Ewk_History *history = ewk_view_history_get(GetEwkWebView());
26 ASSERT_EQ(0, ewk_history_back_list_length_get(history));
29 ewk_history_free(history);
32 TEST_F(utc_blink_ewk_history_back_list_length_get, NOT_EMPTY_TEST)
35 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL1).c_str()));
36 ASSERT_EQ(Success, EventLoopStart());
38 Ewk_History *history = ewk_view_history_get(GetEwkWebView());
40 ASSERT_EQ(0, ewk_history_back_list_length_get(history));
43 ewk_history_free(history);
46 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL2).c_str()));
47 ASSERT_EQ(Success, EventLoopStart());
49 history = ewk_view_history_get(GetEwkWebView());
52 ASSERT_EQ(1, ewk_history_back_list_length_get(history));
55 ewk_history_free(history);
58 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL3).c_str()));
59 ASSERT_EQ(Success, EventLoopStart());
61 history = ewk_view_history_get(GetEwkWebView());
64 ASSERT_EQ(2, ewk_history_back_list_length_get(history));
67 ewk_history_free(history);
70 ASSERT_EQ(EINA_TRUE, ewk_view_back(GetEwkWebView()));
72 history = ewk_view_history_get(GetEwkWebView());
75 ASSERT_EQ(1, ewk_history_back_list_length_get(history));
78 ewk_history_free(history);
81 TEST_F(utc_blink_ewk_history_back_list_length_get, NULL_HISTORY_TEST)
83 ASSERT_EQ(0, ewk_history_back_list_length_get(NULL));