Chromium Code Reviews| Index: LayoutTests/inspector/console/console-timestamp.html |
| diff --git a/LayoutTests/inspector/console/console-timestamp.html b/LayoutTests/inspector/console/console-timestamp.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9d94b34728ff908dd2bc6e34ef60e2058f3169b7 |
| --- /dev/null |
| +++ b/LayoutTests/inspector/console/console-timestamp.html |
| @@ -0,0 +1,66 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/console-test.js"></script> |
| +<script> |
| +function test() |
| +{ |
| + function addMessageWithFixedTimestamp() |
| + { |
| + var message = new WebInspector.ConsoleMessage( |
| + WebInspector.ConsoleMessage.MessageSource.Other, |
| + WebInspector.ConsoleMessage.MessageLevel.Log, |
| + "PASS", |
|
apavlov
2014/03/06 09:56:20
It is desirable to have some text different from t
|
| + undefined, |
| + undefined, |
| + undefined, |
| + undefined, |
| + undefined, |
| + undefined, |
| + undefined, |
| + undefined, |
| + 1400000000123 / 1000); // 2014-05-13T16:53:20.123Z |
| + WebInspector.console.addMessage(message, true); // allow testing repeat. |
| + } |
| + |
| + function getConsoleLine(lineNo) |
| + { |
| + var lineElement = WebInspector.consoleView.topGroup.element.childNodes[0].childNodes; |
| + return lineElement[lineNo].textContent; |
| + } |
| + |
| + // 1. Ensure no timestamp, just message. |
| + addMessageWithFixedTimestamp(); |
| + |
| + InspectorTest.assertEquals("PASS", getConsoleLine(0)); |
|
apavlov
2014/03/06 09:56:20
Inspector tests normally do not run assertions but
|
| + |
| + // 2. Ensure message prefixed with timestamp from 2014-05-13T16:53:20.123Z. |
| + WebInspector.settings.consoleTimestampsEnabled.set(true); |
|
apavlov
2014/03/06 09:56:20
Didn't we agree to have the timestamps toggled in
|
| + addMessageWithFixedTimestamp(); |
| + |
| + var line = getConsoleLine(1); |
| + var date = new Date(line.slice(0, line.search("PASS"))); |
| + InspectorTest.assertEquals("2014-05-13T16:53:20.123Z", date.toISOString()); |
|
apavlov
2014/03/06 09:56:20
InspectorTest.addResult(date.toISOString());
|
| + |
| + // 3. Ensure just one message when repeated 10 times. |
| + // Original timestamp .123Z is updated with .123Z. |
|
apavlov
2014/03/06 09:56:20
The latter should be ".321Z" instead. Or, use "456
|
| + addMessageWithFixedTimestamp(); |
| + WebInspector.console._messageRepeatCountUpdated(10, 1400000000321 / 1000); |
| + |
| + var line = getConsoleLine(2); |
| + InspectorTest.assertEquals(0, line.indexOf("10")); // Prefixed with repeat count. |
|
apavlov
2014/03/06 09:56:20
This can be dumped as well
|
| + |
| + var date = new Date(line.slice(2, line.search("PASS"))); |
| + InspectorTest.assertEquals("2014-05-13T16:53:20.321Z", date.toISOString()); |
|
apavlov
2014/03/06 09:56:20
ditto
|
| + |
| + InspectorTest.addResult("PASS"); |
| + InspectorTest.completeTest(); |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p> |
| +Tests the console timestamp setting |
| +</p> |
| +</body> |
| +</html> |