Changeset 41340 in webkit
- Timestamp:
- Mar 1, 2009 11:21:48 AM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r41336 r41340 1 2009-03-01 Jan Michael Alonzo <jmalonzo@webkit.org> 2 3 Reviewed by Holger Freyther. 4 5 [Gtk] get the HTTP layout tests going 6 https://bugs.webkit.org/show_bug.cgi?id=24259 7 8 Implement dumping of WebKitWebBackForwardList and its history 9 items. 10 11 * DumpRenderTree/gtk/DumpRenderTree.cpp: 12 (compareHistoryItems): 13 (dumpHistoryItem): 14 (dumpBackForwardListForWebView): 15 (dump): 16 (runTest): 17 * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: 18 (LayoutTestController::clearBackForwardList): 19 * DumpRenderTree/gtk/WorkQueueItemGtk.cpp: 20 (BackForwardItem::invoke): 21 1 22 2009-02-28 Zan Dobersek <zandobersek@gmail.com> 2 23 -
trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
r41336 r41340 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 3 * Copyright (C) 2008 Alp Toker <alp@nuanti.com> 4 * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com> 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 50 51 extern "C" { 51 52 // This API is not yet public. 53 extern G_CONST_RETURN gchar* webkit_web_history_item_get_target(WebKitWebHistoryItem*); 54 extern gboolean webkit_web_history_item_is_target_item(WebKitWebHistoryItem*); 55 extern GList* webkit_web_history_item_get_children(WebKitWebHistoryItem*); 52 56 extern GSList* webkit_web_frame_get_children(WebKitWebFrame* frame); 53 57 extern gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame); … … 67 71 guint waitToDumpWatchdog = 0; 68 72 73 // current b/f item at the end of the previous test 74 static WebKitWebHistoryItem* prevTestBFItem = NULL; 75 69 76 const unsigned maxViewHeight = 600; 70 77 const unsigned maxViewWidth = 800; 78 const unsigned historyItemIndent = 8; 71 79 72 80 static gchar* autocorrectURL(const gchar* url) … … 127 135 128 136 return result; 137 } 138 139 static gint compareHistoryItems(gpointer* item1, gpointer* item2) 140 { 141 return g_ascii_strcasecmp(webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item1)), 142 webkit_web_history_item_get_target(WEBKIT_WEB_HISTORY_ITEM(item2))); 143 } 144 145 static void dumpHistoryItem(WebKitWebHistoryItem* item, int indent, bool current) 146 { 147 ASSERT(item != NULL); 148 int start = 0; 149 g_object_ref(item); 150 if (current) { 151 printf("curr->"); 152 start = 6; 153 } 154 for (int i = start; i < indent; i++) 155 putchar(' '); 156 printf("%s", webkit_web_history_item_get_uri(item)); 157 const gchar* target = webkit_web_history_item_get_target(item); 158 if (target && g_utf8_strlen(target, 0) > 0) 159 printf(" (in frame \"%s\")", target); 160 if (webkit_web_history_item_is_target_item(item)) 161 printf(" **nav target**"); 162 putchar('\n'); 163 GList* kids = webkit_web_history_item_get_children(item); 164 if (kids) { 165 // must sort to eliminate arbitrary result ordering which defeats reproducible testing 166 kids = g_list_sort(kids, (GCompareFunc) compareHistoryItems); 167 for (unsigned i = 0; i < g_list_length(kids); i++) 168 dumpHistoryItem(WEBKIT_WEB_HISTORY_ITEM(g_list_nth_data(kids, i)), indent+4, FALSE); 169 } 170 g_object_unref(item); 171 } 172 173 static void dumpBackForwardListForWebView(WebKitWebView* view) 174 { 175 printf("\n============== Back Forward List ==============\n"); 176 WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(view); 177 178 // Print out all items in the list after prevTestBFItem, which was from the previous test 179 // Gather items from the end of the list, the print them out from oldest to newest 180 GList* itemsToPrint = NULL; 181 gint forwardListCount = webkit_web_back_forward_list_get_forward_length(bfList); 182 for (int i = forwardListCount; i > 0; i--) { 183 WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i); 184 // something is wrong if the item from the last test is in the forward part of the b/f list 185 ASSERT(item != prevTestBFItem); 186 g_object_ref(item); 187 itemsToPrint = g_list_append(itemsToPrint, item); 188 } 189 190 WebKitWebHistoryItem* currentItem = webkit_web_back_forward_list_get_current_item(bfList); 191 192 g_object_ref(currentItem); 193 itemsToPrint = g_list_append(itemsToPrint, currentItem); 194 195 gint backListCount = webkit_web_back_forward_list_get_back_length(bfList); 196 for (int i = -1; i >= -(backListCount); i--) { 197 WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(bfList, i); 198 if (item == prevTestBFItem) 199 break; 200 g_object_ref(item); 201 itemsToPrint = g_list_append(itemsToPrint, item); 202 } 203 204 gint currentItemIndex = g_list_length(itemsToPrint) - 1; 205 for (int i = currentItemIndex; i >= 0; i--) { 206 WebKitWebHistoryItem* item = WEBKIT_WEB_HISTORY_ITEM(g_list_nth_data(itemsToPrint, i)); 207 dumpHistoryItem(item, historyItemIndent, i == currentItemIndex); 208 g_object_unref(item); 209 } 210 g_list_free(itemsToPrint); 211 printf("===============================================\n"); 129 212 } 130 213 … … 167 250 if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive()) 168 251 dumpFrameScrollPosition(mainFrame); 169 } 170 171 if (gLayoutTestController->dumpBackForwardList()) { 172 // FIXME: not implemented 252 253 if (gLayoutTestController->dumpBackForwardList()) { 254 // FIXME: multiple windows support 255 dumpBackForwardListForWebView(webView); 256 257 } 173 258 } 174 259 … … 250 335 gtk_widget_size_allocate(GTK_WIDGET(webView), &size); 251 336 337 if (prevTestBFItem) 338 g_object_unref(prevTestBFItem); 339 WebKitWebBackForwardList* bfList = webkit_web_view_get_back_forward_list(webView); 340 prevTestBFItem = webkit_web_back_forward_list_get_current_item(bfList); 341 if (prevTestBFItem) 342 g_object_ref(prevTestBFItem); 343 344 252 345 webkit_web_view_open(webView, url); 253 346 -
trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
r41283 r41340 70 70 webkit_web_back_forward_list_set_limit(list, 0); 71 71 webkit_web_back_forward_list_set_limit(list, limit); 72 // FIXME: implement add_item() 73 //webkit_web_back_forward_list_add_item(list, item); 72 webkit_web_back_forward_list_add_item(list, item); 74 73 webkit_web_back_forward_list_go_to_item(list, item); 75 74 g_object_unref(item); -
trunk/WebKitTools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp
r37587 r41340 71 71 { 72 72 WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); 73 webkit_web_view_go_back_or_forward(webView, m_howFar); 73 if (m_howFar == 1) 74 webkit_web_view_go_forward(webView); 75 else if (m_howFar == -1) 76 webkit_web_view_go_back(webView); 77 else { 78 WebKitWebBackForwardList* webBackForwardList = webkit_web_view_get_back_forward_list(webView); 79 WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item(webBackForwardList, m_howFar); 80 webkit_web_view_go_to_back_forward_item(webView, item); 81 } 74 82 }
Note: See TracChangeset
for help on using the changeset viewer.