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) | |
9 { | |
10 if (!result) { | |
11 InspectorTest.log("FAIL: " + message); | |
12 InspectorTest.completeTest(); | |
13 } | |
14 }; | |
15 | 8 |
16 var messages = []; | 9 var messages = []; |
17 | 10 |
18 function messageAdded(data) | 11 function messageAdded(data) |
19 { | 12 { |
20 var payload = data.params.message; | 13 var payload = data.params.message; |
21 | 14 |
22 if (messages.length > 0) | 15 if (messages.length > 0) |
23 InspectorTest.assert(payload.timestamp >= messages[messages.length -
1].timestamp, "Timestamp shouldn't decrease over time."); | 16 InspectorTest.assert(payload.timestamp >= messages[messages.length -
1].timestamp, "Timestamp shouldn't decrease over time."); |
24 | 17 |
25 messages.push(payload); | 18 messages.push(payload); |
26 InspectorTest.assert(payload.timestamp, "No timestamp found in message."
); | 19 InspectorTest.assert(payload.timestamp, "No timestamp found in message."
); |
27 | 20 |
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)."); | 21 InspectorTest.assert(Math.abs(new Date().getTime() / 1000 - payload.time
stamp) < 60, "Timestamp shouldn't differ very much from current time (one minute
interval)."); |
29 } | 22 if (messages.length === 3) |
30 | 23 InspectorTest.completeTest(); |
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 } | 24 } |
41 | 25 |
42 InspectorTest.eventHandler["Console.messageAdded"] = messageAdded; | 26 InspectorTest.eventHandler["Console.messageAdded"] = messageAdded; |
43 InspectorTest.eventHandler["Console.messageRepeatCountUpdated"] = messageRep
eatCountUpdated; | |
44 InspectorTest.sendCommand("Console.enable", {}); | 27 InspectorTest.sendCommand("Console.enable", {}); |
45 | 28 |
46 InspectorTest.sendCommand("Runtime.evaluate", { expression: "console.log('te
stUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" }); | 29 InspectorTest.sendCommand("Runtime.evaluate", { expression: "console.log('te
stUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" }); |
47 } | 30 } |
48 | 31 |
49 </script> | 32 </script> |
50 </head> | 33 </head> |
51 <body onload="runTest()"> | 34 <body onload="runTest()"> |
52 </body> | 35 </body> |
53 </html> | 36 </html> |
OLD | NEW |