Commit bf0af0be authored by beidson's avatar beidson

Reviewed by Anders

        Add the ability to dump the back/forward history of all windows open at the end of a test

        * DumpRenderTree/DumpRenderTree.m:
        (dumpBackForwardListForWebView): Dump B/F list for the given WebView
        (dump): Call dumpBackForwardListForWebView for each WebView open after the test



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a9fd077f
2007-04-13 Brady Eidson <beidson@apple.com>
Reviewed by Anders
Add the ability to dump the back/forward history of all windows open at the end of a test
* DumpRenderTree/DumpRenderTree.m:
(dumpBackForwardListForWebView): Dump B/F list for the given WebView
(dump): Call dumpBackForwardListForWebView for each WebView open after the test
2007-04-13 Anders Carlsson <andersca@apple.com>
Reviewed by Brady.
......
......@@ -705,6 +705,39 @@ static void normalizeWebResourceResponse(NSMutableDictionary *propertyList, NSSt
return [[[NSMutableString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease];
}
static void dumpBackForwardListForWebView(WebView *view)
{
printf("\n============== Back Forward List ==============\n");
WebBackForwardList *bfList = [view backForwardList];
// Print out all items in the list after prevTestBFItem, which was from the previous test
// Gather items from the end of the list, the print them out from oldest to newest
NSMutableArray *itemsToPrint = [[NSMutableArray alloc] init];
for (int i = [bfList forwardListCount]; i > 0; i--) {
WebHistoryItem *item = [bfList itemAtIndex:i];
// something is wrong if the item from the last test is in the forward part of the b/f list
assert(item != prevTestBFItem);
[itemsToPrint addObject:item];
}
assert([bfList currentItem] != prevTestBFItem);
[itemsToPrint addObject:[bfList currentItem]];
int currentItemIndex = [itemsToPrint count] - 1;
for (int i = -1; i >= -[bfList backListCount]; i--) {
WebHistoryItem *item = [bfList itemAtIndex:i];
if (item == prevTestBFItem)
break;
[itemsToPrint addObject:item];
}
for (int i = [itemsToPrint count]-1; i >= 0; i--) {
dumpHistoryItem([itemsToPrint objectAtIndex:i], 8, i == currentItemIndex);
}
[itemsToPrint release];
printf("===============================================\n");
}
static void dump(void)
{
if (dumpTree) {
......@@ -747,35 +780,12 @@ static void dump(void)
}
if (dumpBackForwardList) {
printf("\n============== Back Forward List ==============\n");
WebBackForwardList *bfList = [[frame webView] backForwardList];
// Print out all items in the list after prevTestBFItem, which was from the previous test
// Gather items from the end of the list, the print them out from oldest to newest
NSMutableArray *itemsToPrint = [[NSMutableArray alloc] init];
for (int i = [bfList forwardListCount]; i > 0; i--) {
WebHistoryItem *item = [bfList itemAtIndex:i];
// something is wrong if the item from the last test is in the forward part of the b/f list
assert(item != prevTestBFItem);
[itemsToPrint addObject:item];
}
assert([bfList currentItem] != prevTestBFItem);
[itemsToPrint addObject:[bfList currentItem]];
int currentItemIndex = [itemsToPrint count] - 1;
for (int i = -1; i >= -[bfList backListCount]; i--) {
WebHistoryItem *item = [bfList itemAtIndex:i];
if (item == prevTestBFItem)
break;
[itemsToPrint addObject:item];
}
for (int i = [itemsToPrint count]-1; i >= 0; i--) {
dumpHistoryItem([itemsToPrint objectAtIndex:i], 8, i == currentItemIndex);
unsigned count = [(NSArray *)allWindowsRef count];
for (unsigned i = 0; i < count; i++) {
NSWindow *window = [(NSArray *)allWindowsRef objectAtIndex:i];
WebView *webView = [[[window contentView] subviews] objectAtIndex:0];
dumpBackForwardListForWebView(webView);
}
[itemsToPrint release];
printf("===============================================\n");
}
if (printSeparators)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment