| Index: content/test/layouttest_support.cc
|
| diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc
|
| index 387d75a385221ab0bf3dac888faf3d0e3056f7f7..eb218ab1e8a509cbaec4a95c48003887e7684c51 100644
|
| --- a/content/test/layouttest_support.cc
|
| +++ b/content/test/layouttest_support.cc
|
| @@ -9,6 +9,7 @@
|
| #include "content/browser/renderer_host/render_widget_host_impl.h"
|
| #include "content/common/gpu/image_transport_surface.h"
|
| #include "content/public/common/page_state.h"
|
| +#include "content/renderer/history_entry.h"
|
| #include "content/renderer/history_serialization.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| #include "content/renderer/render_view_impl.h"
|
| @@ -169,21 +170,22 @@ struct ToLower {
|
| base::char16 operator()(base::char16 c) { return tolower(c); }
|
| };
|
|
|
| -// Returns True if item1 < item2.
|
| -bool HistoryItemCompareLess(const blink::WebHistoryItem& item1,
|
| - const blink::WebHistoryItem& item2) {
|
| - base::string16 target1 = item1.target();
|
| - base::string16 target2 = item2.target();
|
| +// Returns True if node1 < node2.
|
| +bool HistoryEntryCompareLess(HistoryEntry::HistoryNode* node1,
|
| + HistoryEntry::HistoryNode* node2) {
|
| + base::string16 target1 = node1->item().target();
|
| + base::string16 target2 = node2->item().target();
|
| std::transform(target1.begin(), target1.end(), target1.begin(), ToLower());
|
| std::transform(target2.begin(), target2.end(), target2.begin(), ToLower());
|
| return target1 < target2;
|
| }
|
|
|
| -std::string DumpHistoryItem(const blink::WebHistoryItem& item,
|
| +std::string DumpHistoryItem(HistoryEntry::HistoryNode* node,
|
| int indent,
|
| bool is_current_index) {
|
| std::string result;
|
|
|
| + const blink::WebHistoryItem& item = node->item();
|
| if (is_current_index) {
|
| result.append("curr->");
|
| result.append(indent - 6, ' '); // 6 == "curr->".length()
|
| @@ -201,19 +203,11 @@ std::string DumpHistoryItem(const blink::WebHistoryItem& item,
|
| }
|
| result.append("\n");
|
|
|
| - const blink::WebVector<blink::WebHistoryItem>& children = item.children();
|
| - if (!children.isEmpty()) {
|
| - // Must sort to eliminate arbitrary result ordering which defeats
|
| - // reproducible testing.
|
| - // FIXME: WebVector should probably just be a std::vector!!
|
| - std::vector<blink::WebHistoryItem> sortedChildren;
|
| + std::vector<HistoryEntry::HistoryNode*> children = node->children();
|
| + if (!children.empty()) {
|
| + std::sort(children.begin(), children.end(), HistoryEntryCompareLess);
|
| for (size_t i = 0; i < children.size(); ++i)
|
| - sortedChildren.push_back(children[i]);
|
| - std::sort(sortedChildren.begin(),
|
| - sortedChildren.end(),
|
| - HistoryItemCompareLess);
|
| - for (size_t i = 0; i < sortedChildren.size(); ++i)
|
| - result += DumpHistoryItem(sortedChildren[i], indent + 4, false);
|
| + result += DumpHistoryItem(children[i], indent + 4, false);
|
| }
|
|
|
| return result;
|
| @@ -224,8 +218,12 @@ std::string DumpBackForwardList(std::vector<PageState>& page_state,
|
| std::string result;
|
| result.append("\n============== Back Forward List ==============\n");
|
| for (size_t index = 0; index < page_state.size(); ++index) {
|
| - result.append(DumpHistoryItem(
|
| - PageStateToHistoryItem(page_state[index]), 8, index == current_index));
|
| + scoped_ptr<HistoryEntry> entry(
|
| + PageStateToHistoryEntry(page_state[index]));
|
| + result.append(
|
| + DumpHistoryItem(entry->root_history_node(),
|
| + 8,
|
| + index == current_index));
|
| }
|
| result.append("===============================================\n");
|
| return result;
|
|
|