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 #include "utc_blink_ewk_base.h"
6 class utc_blink_ewk_history_item_uri_get : public utc_blink_ewk_base
9 void LoadFinished(Evas_Object*) override { EventLoopStop(Success); }
12 static const char* const TEST_URL1;
13 static const char* const TEST_URL2;
14 static const char* const TEST_URL3;
17 const char* const utc_blink_ewk_history_item_uri_get::TEST_URL1 = "ewk_history/page1.html";
18 const char* const utc_blink_ewk_history_item_uri_get::TEST_URL2 = "ewk_history/page2.html";
19 const char* const utc_blink_ewk_history_item_uri_get::TEST_URL3 = "ewk_history/page3.html";
21 TEST_F(utc_blink_ewk_history_item_uri_get, EXISTING_HISTORY)
23 // load 3 pages to get some interesting history
24 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL1).c_str()));
25 ASSERT_EQ(Success, EventLoopStart());
26 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL2).c_str()));
27 ASSERT_EQ(Success, EventLoopStart());
28 ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(TEST_URL3).c_str()));
29 ASSERT_EQ(Success, EventLoopStart());
32 ASSERT_EQ(EINA_TRUE, ewk_view_back(GetEwkWebView()));
34 Ewk_History *history = ewk_view_history_get(GetEwkWebView());
38 Ewk_History_Item *item = ewk_history_nth_item_get(history, 0);
41 ASSERT_STREQ(GetResourceUrl(TEST_URL2).c_str(), ewk_history_item_uri_get(item));
44 item = ewk_history_nth_item_get(history, -1);
47 ASSERT_STREQ(GetResourceUrl(TEST_URL1).c_str(), ewk_history_item_uri_get(item));
50 item = ewk_history_nth_item_get(history, 1);
53 ASSERT_STREQ(GetResourceUrl(TEST_URL3).c_str(), ewk_history_item_uri_get(item));
55 ewk_history_free(history);
58 TEST_F(utc_blink_ewk_history_item_uri_get, NULL_ITEM)
60 ASSERT_FALSE(ewk_history_item_uri_get(NULL));