OLD | NEW |
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> |
OLD | NEW |