static void dumpBackForwardList(const TestNavigationController& navigationController, string& result) { result.append("\n============== Back Forward List ==============\n"); for (int index = 0; index < navigationController.entryCount(); ++index) { int currentIndex = navigationController.lastCommittedEntryIndex(); WebHistoryItem historyItem = navigationController.entryAtIndex(index)->contentState(); if (historyItem.isNull()) { historyItem.initialize(); historyItem.setURLString(navigationController.entryAtIndex(index)->URL().spec().utf16()); } result.append(dumpHistoryItem(historyItem, 8, index == currentIndex)); } result.append("===============================================\n"); }
void TestShell::captureHistoryForWindow(size_t windowIndex, WebVector<WebHistoryItem>* history, size_t* currentEntryIndex) { ASSERT(history); ASSERT(currentEntryIndex); if (windowIndex >= m_windowList.size()) return; TestNavigationController& navigationController = *m_windowList[windowIndex]->navigationController(); size_t entryCount = navigationController.entryCount(); WebVector<WebHistoryItem> result(entryCount); *currentEntryIndex = navigationController.lastCommittedEntryIndex(); for (size_t index = 0; index < entryCount; ++index) { WebHistoryItem historyItem = navigationController.entryAtIndex(index)->contentState(); if (historyItem.isNull()) { historyItem.initialize(); historyItem.setURLString(navigationController.entryAtIndex(index)->URL().spec().utf16()); } result[index] = historyItem; } history->swap(result); }