| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/console-test.js"></script> |
| <script> |
| function test() |
| { |
| // It is essential that we calculate timezone for this particular moment of time |
| // otherwise the time zone offset could be different because of DST. |
| var baseDate = Date.parse("2014-05-13T16:53:20.123Z"); |
| var tzOffset = new Date(baseDate).getTimezoneOffset() * 60 * 1000; |
| var baseTimestamp = 1400000000000 + tzOffset; |
| |
| function addMessageWithFixedTimestamp(messageText, timestamp) |
| { |
| var message = new ConsoleModel.ConsoleMessage( |
| InspectorTest.runtimeModel, |
| ConsoleModel.ConsoleMessage.MessageSource.Other, // source |
| ConsoleModel.ConsoleMessage.MessageLevel.Info, // level |
| messageText, |
| undefined, // type |
| undefined, // url |
| undefined, // line |
| undefined, // column |
| undefined, // requestId |
| undefined, // parameters |
| undefined, // stackTrace |
| timestamp || baseTimestamp + 123); // timestamp: 2014-05-13T16:53:20.123Z |
| InspectorTest.consoleModel.addMessage(message, true); // allowGrouping |
| } |
| |
| InspectorTest.addResult("Console messages with timestamps disabled:"); |
| addMessageWithFixedTimestamp("<Before>"); |
| addMessageWithFixedTimestamp("<Before>", baseTimestamp + 456); |
| addMessageWithFixedTimestamp("<Before>"); |
| |
| InspectorTest.dumpConsoleMessages(); |
| |
| InspectorTest.addResult("Console messages with timestamps enabled:"); |
| Common.settingForTest("consoleTimestampsEnabled").set(true); |
| |
| addMessageWithFixedTimestamp("<After>", baseTimestamp + 1000); |
| addMessageWithFixedTimestamp("<After>", baseTimestamp + 1000); |
| addMessageWithFixedTimestamp("<After>", baseTimestamp + 1456); |
| |
| Common.settingForTest("consoleTimestampsEnabled").set(false); |
| Common.settingForTest("consoleTimestampsEnabled").set(true); |
| |
| InspectorTest.dumpConsoleMessages(); |
| InspectorTest.completeTest(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p> |
| Tests the console timestamp setting. |
| </p> |
| </body> |
| </html> |