Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1423)

Unified Diff: content/shell/renderer/test_runner/WebTestProxy.cpp

Issue 246163006: Move history serialization from contet/public/renderer/ to content/renderer/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix braces Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/renderer/test_runner/WebTestDelegate.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/WebTestProxy.cpp
diff --git a/content/shell/renderer/test_runner/WebTestProxy.cpp b/content/shell/renderer/test_runner/WebTestProxy.cpp
index 1c4f1b1054ab8c7902229954c35b20c982b945b3..97f782179fc0dbf13ab6546649151d762e7f02a8 100644
--- a/content/shell/renderer/test_runner/WebTestProxy.cpp
+++ b/content/shell/renderer/test_runner/WebTestProxy.cpp
@@ -304,73 +304,12 @@ string dumpFrameScrollPosition(WebFrame* frame, bool recursive)
return result;
}
-struct ToLower {
- base::char16 operator()(base::char16 c) { return tolower(c); }
-};
-
-// Returns True if item1 < item2.
-bool HistoryItemCompareLess(const WebHistoryItem& item1, const WebHistoryItem& item2)
-{
- base::string16 target1 = item1.target();
- base::string16 target2 = item2.target();
- std::transform(target1.begin(), target1.end(), target1.begin(), ToLower());
- std::transform(target2.begin(), target2.end(), target2.begin(), ToLower());
- return target1 < target2;
-}
-
-string dumpHistoryItem(const WebHistoryItem& item, int indent, bool isCurrent)
-{
- string result;
-
- if (isCurrent) {
- result.append("curr->");
- result.append(indent - 6, ' '); // 6 == "curr->".length()
- } else
- result.append(indent, ' ');
-
- string url = normalizeLayoutTestURL(item.urlString().utf8());
- result.append(url);
- if (!item.target().isEmpty()) {
- result.append(" (in frame \"");
- result.append(item.target().utf8());
- result.append("\")");
- }
- result.append("\n");
-
- const WebVector<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<WebHistoryItem> sortedChildren;
- 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);
- }
-
- return result;
-}
-
-void dumpBackForwardList(const WebVector<WebHistoryItem>& history, size_t currentEntryIndex, string& result)
-{
- result.append("\n============== Back Forward List ==============\n");
- for (size_t index = 0; index < history.size(); ++index)
- result.append(dumpHistoryItem(history[index], 8, index == currentEntryIndex));
- result.append("===============================================\n");
-}
-
string dumpAllBackForwardLists(TestInterfaces* interfaces, WebTestDelegate* delegate)
{
string result;
const vector<WebTestProxyBase*>& windowList = interfaces->windowList();
- for (unsigned i = 0; i < windowList.size(); ++i) {
- size_t currentEntryIndex = 0;
- WebVector<WebHistoryItem> history;
- delegate->captureHistoryForWindow(windowList.at(i), &history, &currentEntryIndex);
- dumpBackForwardList(history, currentEntryIndex, result);
- }
+ for (unsigned i = 0; i < windowList.size(); ++i)
+ result.append(delegate->dumpHistoryForWindow(windowList.at(i)));
return result;
}
« no previous file with comments | « content/shell/renderer/test_runner/WebTestDelegate.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698