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

Side by Side Diff: LayoutTests/inspector-protocol/console/console-timestamp.html

Issue 185713007: DevTools: Add timestamp support in the console (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed apavlov's comments Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script> 4 <script>
5 5
6 function test() 6 function test()
7 { 7 {
8 InspectorTest.assert = function(result, message) 8 InspectorTest.assert = function(result, message)
9 { 9 {
10 if (!result) { 10 if (!result) {
11 InspectorTest.log("FAIL: " + message); 11 InspectorTest.log("FAIL: " + message);
12 InspectorTest.completeTest(); 12 InspectorTest.completeTest();
13 } 13 }
14 }; 14 };
15 15
16 var messages = []; 16 var messages = [];
17 17
18 function messageAdded(data) 18 function messageAdded(data)
19 { 19 {
20 var payload = data.params.message; 20 var payload = data.params.message;
21 21
22 if (messages.length > 0) 22 if (messages.length > 0)
23 InspectorTest.assert(payload.timestamp >= messages[messages.length - 1].timestamp, "Timestamp shouldn't decrease over time."); 23 InspectorTest.assert(payload.timestamp >= messages[messages.length - 1].timestamp, "Timestamp shouldn't decrease over time.");
24 24
25 messages.push(payload); 25 messages.push(payload);
26 InspectorTest.assert(payload.timestamp, "No timestamp found in message." ); 26 InspectorTest.assert(payload.timestamp, "No timestamp found in message." );
27 27
28 InspectorTest.assert(Math.abs(new Date().getTime() / 1000 - payload.time stamp) < 60, "Timestamp shouldn't differ very much from current time (one minute interval)."); 28 InspectorTest.assert(Math.abs(new Date().getTime() - payload.timestamp) < 60000, "Timestamp shouldn't differ very much from current time (one minute int erval).");
29 }
30
31 function messageRepeatCountUpdated(data)
32 {
33 InspectorTest.assert(data.params.timestamp, "No timestamp found on repea t count update.");
34
35 var updatedTimestamp = data.params.timestamp;
36
37 InspectorTest.assert(updatedTimestamp >= messages[messages.length - 1].t imestamp, "Timestamp shouldn't decrease over time.");
38
39 InspectorTest.completeTest();
40 } 29 }
41 30
42 InspectorTest.eventHandler["Console.messageAdded"] = messageAdded; 31 InspectorTest.eventHandler["Console.messageAdded"] = messageAdded;
43 InspectorTest.eventHandler["Console.messageRepeatCountUpdated"] = messageRep eatCountUpdated;
44 InspectorTest.sendCommand("Console.enable", {}); 32 InspectorTest.sendCommand("Console.enable", {});
45 33
46 InspectorTest.sendCommand("Runtime.evaluate", { expression: "console.log('te stUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" }); 34 InspectorTest.sendCommand("Runtime.evaluate", { expression: "console.log('te stUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" });
47 } 35 }
48 36
49 </script> 37 </script>
50 </head> 38 </head>
51 <body onload="runTest()"> 39 <body onload="runTest()">
52 </body> 40 </body>
53 </html> 41 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/console/console-timestamp.html » ('j') | Source/core/inspector/InspectorConsoleAgent.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698