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

Unified Diff: LayoutTests/inspector/console/console-timestamp.html

Issue 185713007: DevTools: Add timestamp support in the console (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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: 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>
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-timestamp-expected.txt » ('j') | Source/devtools/front_end/ConsoleModel.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698