| Index: third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html b/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
|
| index 6cd952915862ac061ae2c0ee964995b3c587da23..55f0fe6d02e7eb294c2fa1515d107b1b3cc4ca05 100644
|
| --- a/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
|
| +++ b/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
|
| @@ -12,6 +12,7 @@ function test()
|
| var shortUrlWithHashes = "www." + "0123456789".repeat(2) + "zfoobarz" + "0123456789".repeat(2);
|
| var urlWithHashes = "www." + "0123456789".repeat(2) + "z".repeat(150) + "0123456789".repeat(2);
|
| var highlightedUrl = "www." + "z".repeat(200) + ".com";
|
| + var longUrlInMessageWithNonTextNodePrefix = "www." + "z123456789".repeat(15) + ".com";
|
| var prepareCode = `
|
| // Keep this as the first url logged to record the max truncated length.
|
| console.log("${longUrl}");
|
| @@ -22,9 +23,10 @@ function test()
|
| console.log("${shortUrlWithHashes}");
|
| console.log("${urlWithHashes}");
|
| console.log("${highlightedUrl}");
|
| + console.log("${longUrlInMessageWithNonTextNodePrefix}");
|
| `;
|
|
|
| - var expectedMessageCount = 8;
|
| + var expectedMessageCount = 9;
|
| var consoleView = Console.ConsoleView.instance();
|
| var viewport = Console.ConsoleView.instance()._viewport;
|
| var maxLength;
|
| @@ -120,6 +122,25 @@ function test()
|
|
|
| function testSelectWithinHighlightedUrlEnd(next) {
|
| testHighlightedUrlWithSearchQuery(".com", next);
|
| + },
|
| +
|
| + function testSelectionStartingInNonTextNode(next) {
|
| + var messageElement = consoleView.itemElement(8).element();
|
| +
|
| + // Artificially insert an empty non-text node element in the beginning.
|
| + var artificialEmptyPrefixElement = createElementWithClass('div', 'artificialEmptyPrefixElement');
|
| + messageElement.insertBefore(artificialEmptyPrefixElement, messageElement.firstChild);
|
| +
|
| + // Use .childNodes to ensure we get all nodes.
|
| + InspectorTest.addResult("\nMaking selection from empty prefix to end");
|
| + window.getSelection().setBaseAndExtent(artificialEmptyPrefixElement, 0, messageElement.lastChild, messageElement.childNodes.length - 1);
|
| +
|
| + var selectedText = viewport._selectedText();
|
| + if (selectedText)
|
| + InspectorTest.addResult("Selection length: " + selectedText.length + ", " + "text: " + selectedText.replace(/\bVM:\d+/g, "VM"));
|
| + else
|
| + InspectorTest.addResult("No selection");
|
| + next();
|
| }
|
| ];
|
|
|
|
|