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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/console/console-format-broken-unicode.html

Issue 2139043002: DevTools: show alternate title onexpand of object in console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script> 4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script> 5 <script>
6 6
7 var str = " \uD835\uDC14\uD835\uDC0D\uD835\uDC08\uD835\uDC02\uD835\uDC0E\uD835\ uDC03\uD835\uDC04"; // " UNICODE" 7 var str = " \uD835\uDC14\uD835\uDC0D\uD835\uDC08\uD835\uDC02\uD835\uDC0E\uD835\ uDC03\uD835\uDC04"; // " UNICODE"
8 var brokenSurrogate = str.substring(0, str.length - 1); 8 var brokenSurrogate = str.substring(0, str.length - 1);
9 var obj = { foo: brokenSurrogate }; 9 var obj = { foo: brokenSurrogate };
10 obj[brokenSurrogate] = "foo"; 10 obj[brokenSurrogate] = "foo";
(...skipping 11 matching lines...) Expand all
22 InspectorTest.waitForRemoteObjectsConsoleMessages(step2); 22 InspectorTest.waitForRemoteObjectsConsoleMessages(step2);
23 } 23 }
24 24
25 function step2() 25 function step2()
26 { 26 {
27 InspectorTest.expandConsoleMessages(step3); 27 InspectorTest.expandConsoleMessages(step3);
28 } 28 }
29 29
30 function step3() 30 function step3()
31 { 31 {
32 InspectorTest.evaluateInPage("obj.foo", step4); 32 InspectorTest.expandConsoleMessages(step4, nestedObjectFilter);
33 } 33 }
34 34
35 function step4(result) 35 function step4()
36 {
37 InspectorTest.evaluateInPage("obj.foo", step5);
38 }
39
40 function step5(result)
36 { 41 {
37 var text = result.description; 42 var text = result.description;
38 InspectorTest.assertEquals(15, text.length, "text length"); 43 InspectorTest.assertEquals(15, text.length, "text length");
39 InspectorTest.assertEquals(7, countTextNodes(text), "nodes count"); 44 InspectorTest.assertEquals(6, countTextNodes(text), "nodes count");
40 InspectorTest.addResult("PASS: Found all nodes with the broken text"); 45 InspectorTest.addResult("PASS: Found all nodes with the broken text");
41 InspectorTest.completeTest(); 46 InspectorTest.completeTest();
42 } 47 }
43 48
49 function nestedObjectFilter(treeElement)
lushnikov 2016/07/30 00:29:49 can you please explain this filter?
luoe 2016/07/30 01:46:37 In the broken unicode test, it evaluates [{ ..inte
50 {
51 var name = treeElement.nameElement && treeElement.nameElement.textConten t;
52 var titleName = treeElement.treeOutline.titleElement && treeElement.tree Outline.titleElement.textContent;
53 return name === "0" || titleName === "Array[1]";
54 }
55
44 function countTextNodes(textContent) 56 function countTextNodes(textContent)
45 { 57 {
46 InspectorTest.disableConsoleViewport(); 58 InspectorTest.disableConsoleViewport();
47 59
48 var count = 0; 60 var count = 0;
49 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa ges; 61 var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessa ges;
50 for (var i = 0; i < viewMessages.length; ++i) { 62 for (var i = 0; i < viewMessages.length; ++i) {
51 var node = viewMessages[i].contentElement(); 63 var node = viewMessages[i].contentElement();
52 var currentNode = node; 64 var currentNode = node;
53 while (currentNode = currentNode.traverseNextNode(node)) { 65 while (currentNode = currentNode.traverseNextNode(node)) {
54 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV alue === textContent) 66 if (currentNode.nodeType === Node.TEXT_NODE && currentNode.nodeV alue === textContent)
55 ++count; 67 ++count;
56 } 68 }
57 } 69 }
58 return count; 70 return count;
59 } 71 }
60 } 72 }
61 73
62 </script> 74 </script>
63 </head> 75 </head>
64 76
65 <body onload="runTest()"> 77 <body onload="runTest()">
66 <p> 78 <p>
67 Tests that console logging dumps proper messages with broken Unicode. 79 Tests that console logging dumps proper messages with broken Unicode.
68 </p> 80 </p>
69 81
70 </body> 82 </body>
71 </html> 83 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698