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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js

Issue 2644753002: DevTools: untruncate links on copy (Closed)
Patch Set: ac Created 3 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
Index: third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
index c4ac59cd0c26e0e9c7e82724e1a77649bcad6b86..4e050859238f87843c9755cac46f2796d5910cae 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
@@ -425,4 +425,29 @@ InspectorTest.waitForConsoleMessages = function(expectedCount, callback)
}
}
+InspectorTest.selectConsoleMessages = function(fromMessage, fromTextOffset, toMessage, toTextOffset)
+{
+ var consoleView = Console.ConsoleView.instance();
+ var from = selectionContainerAndOffset(consoleView.itemElement(fromMessage).element(), fromTextOffset);
+ var to = selectionContainerAndOffset(consoleView.itemElement(toMessage).element(), toTextOffset);
+ window.getSelection().setBaseAndExtent(from.container, from.offset, to.container, to.offset);
+
+ function selectionContainerAndOffset(container, offset)
+ {
+ var charCount = 0;
+ var node = container;
+ while (node = node.traverseNextTextNode(true)) {
+ var length = node.textContent.length;
+ if (charCount + length >= offset) {
+ return {
+ container: node,
+ offset: offset - charCount
+ };
+ }
+ charCount += length;
+ }
+ return null;
+ }
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698