OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/console-test.js"></script> | |
5 <script> | |
6 function test() | |
7 { | |
8 function addMessageWithFixedTimestamp() | |
9 { | |
10 var message = new WebInspector.ConsoleMessage( | |
11 WebInspector.ConsoleMessage.MessageSource.Other, | |
12 WebInspector.ConsoleMessage.MessageLevel.Log, | |
13 "PASS", | |
apavlov
2014/03/06 09:56:20
It is desirable to have some text different from t
| |
14 undefined, | |
15 undefined, | |
16 undefined, | |
17 undefined, | |
18 undefined, | |
19 undefined, | |
20 undefined, | |
21 undefined, | |
22 1400000000123 / 1000); // 2014-05-13T16:53:20.123Z | |
23 WebInspector.console.addMessage(message, true); // allow testing repeat. | |
24 } | |
25 | |
26 function getConsoleLine(lineNo) | |
27 { | |
28 var lineElement = WebInspector.consoleView.topGroup.element.childNodes[0 ].childNodes; | |
29 return lineElement[lineNo].textContent; | |
30 } | |
31 | |
32 // 1. Ensure no timestamp, just message. | |
33 addMessageWithFixedTimestamp(); | |
34 | |
35 InspectorTest.assertEquals("PASS", getConsoleLine(0)); | |
apavlov
2014/03/06 09:56:20
Inspector tests normally do not run assertions but
| |
36 | |
37 // 2. Ensure message prefixed with timestamp from 2014-05-13T16:53:20.123Z. | |
38 WebInspector.settings.consoleTimestampsEnabled.set(true); | |
apavlov
2014/03/06 09:56:20
Didn't we agree to have the timestamps toggled in
| |
39 addMessageWithFixedTimestamp(); | |
40 | |
41 var line = getConsoleLine(1); | |
42 var date = new Date(line.slice(0, line.search("PASS"))); | |
43 InspectorTest.assertEquals("2014-05-13T16:53:20.123Z", date.toISOString()); | |
apavlov
2014/03/06 09:56:20
InspectorTest.addResult(date.toISOString());
| |
44 | |
45 // 3. Ensure just one message when repeated 10 times. | |
46 // Original timestamp .123Z is updated with .123Z. | |
apavlov
2014/03/06 09:56:20
The latter should be ".321Z" instead. Or, use "456
| |
47 addMessageWithFixedTimestamp(); | |
48 WebInspector.console._messageRepeatCountUpdated(10, 1400000000321 / 1000); | |
49 | |
50 var line = getConsoleLine(2); | |
51 InspectorTest.assertEquals(0, line.indexOf("10")); // Prefixed with repeat c ount. | |
apavlov
2014/03/06 09:56:20
This can be dumped as well
| |
52 | |
53 var date = new Date(line.slice(2, line.search("PASS"))); | |
54 InspectorTest.assertEquals("2014-05-13T16:53:20.321Z", date.toISOString()); | |
apavlov
2014/03/06 09:56:20
ditto
| |
55 | |
56 InspectorTest.addResult("PASS"); | |
57 InspectorTest.completeTest(); | |
58 } | |
59 </script> | |
60 </head> | |
61 <body onload="runTest()"> | |
62 <p> | |
63 Tests the console timestamp setting | |
64 </p> | |
65 </body> | |
66 </html> | |
OLD | NEW |