| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../canvas-profiler-test.js"></script> | 4 <script src="../canvas-profiler-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 var canvas; | 7 var canvas; |
| 8 var context; | 8 var context; |
| 9 var round = 0; | 9 var round = 0; |
| 10 var colors = ["red", "green", "blue", "yellow", "black"]; | 10 var colors = ["red", "green", "blue", "yellow", "black"]; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 function test() | 36 function test() |
| 37 { | 37 { |
| 38 // FIXME: Remove once taken out of experiments. Also a hack below should be
removed. | 38 // FIXME: Remove once taken out of experiments. Also a hack below should be
removed. |
| 39 WebInspector.experimentsSettings.canvasInspection = {}; | 39 WebInspector.experimentsSettings.canvasInspection = {}; |
| 40 WebInspector.experimentsSettings.canvasInspection.isEnabled = function() { r
eturn true; }; | 40 WebInspector.experimentsSettings.canvasInspection.isEnabled = function() { r
eturn true; }; |
| 41 | 41 |
| 42 WebInspector.showPanel("profiles"); | 42 WebInspector.showPanel("profiles"); |
| 43 var profilesPanel = WebInspector.panels.profiles; | 43 var profilesPanel = WebInspector.panels.profiles; |
| 44 var profileType = profilesPanel.getProfileType(WebInspector.CanvasProfileTyp
e.TypeId); | 44 var typeRegistry = WebInspector.ProfileTypeRegistry.instance; |
| 45 var profileType = typeRegistry.canvasProfileType; |
| 45 | 46 |
| 46 // FIXME: This hack is added because ProfilesPanel might have been already c
reated before experiment was enabled. | 47 // FIXME: This hack is added because ProfilesPanel might have been already c
reated before experiment was enabled. |
| 47 // This could be removed once canvas inspection is out of experiments. | 48 // This could be removed once canvas inspection is out of experiments. |
| 48 if (!profileType) { | 49 if (!profileType) { |
| 49 profilesPanel._registerProfileType(new WebInspector.CanvasProfileType())
; | 50 profileType = new WebInspector.CanvasProfileType(); |
| 50 profileType = profilesPanel.getProfileType(WebInspector.CanvasProfileTyp
e.TypeId); | 51 typeRegistry.canvasProfileType = profileType; |
| 52 typeRegistry._addProfileType(profileType); |
| 53 profilesPanel._registerProfileType(profileType); |
| 51 } | 54 } |
| 52 | 55 |
| 53 profilesPanel._onProfileTypeSelected({data: profileType}); | 56 profilesPanel._onProfileTypeSelected({data: profileType}); |
| 54 | 57 |
| 55 InspectorTest.override(profileType, "_isSingleFrameMode", function() { retur
n false; }, true /*sticky*/); | 58 InspectorTest.override(profileType, "_isSingleFrameMode", function() { retur
n false; }, true /*sticky*/); |
| 56 InspectorTest.addSniffer(profileType, "_didStartCapturingFrame", didStartCap
turingFrame); | 59 InspectorTest.addSniffer(profileType, "_didStartCapturingFrame", didStartCap
turingFrame); |
| 57 | 60 |
| 58 profileType._onProfilerEnableButtonClick(true); | 61 profileType._onProfilerEnableButtonClick(true); |
| 59 InspectorTest.addSniffer(profileType, "_updateDecorationElement", profilesPa
nel.toggleRecordButton.bind(profilesPanel)); | 62 InspectorTest.addSniffer(profileType, "_updateDecorationElement", profilesPa
nel.toggleRecordButton.bind(profilesPanel)); |
| 60 | 63 |
| 61 var profileHeader; | 64 var profileHeader; |
| 62 var profileView; | 65 var profileView; |
| 63 var dataGrid; | 66 var dataGrid; |
| 64 | 67 |
| 65 function didStartCapturingFrame(frameId, error, traceLogId) | 68 function didStartCapturingFrame(frameId, error, traceLogId) |
| 66 { | 69 { |
| 67 profileHeader = profileType.getProfiles()[0] | 70 profileHeader = profileType.getProfiles()[0] |
| 68 profilesPanel._showProfile(profileHeader); | 71 profilesPanel.showProfile(profileHeader); |
| 69 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didRec
eiveFirstFrame); | 72 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didRec
eiveFirstFrame); |
| 70 InspectorTest.evaluateInConsole("doSomeCanvasCalls(2)"); | 73 InspectorTest.evaluateInConsole("doSomeCanvasCalls(2)"); |
| 71 } | 74 } |
| 72 function didReceiveFirstFrame(traceLog) | 75 function didReceiveFirstFrame(traceLog) |
| 73 { | 76 { |
| 74 if (!traceLog || traceLog.calls.length < 2) { | 77 if (!traceLog || traceLog.calls.length < 2) { |
| 75 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", di
dReceiveFirstFrame); | 78 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", di
dReceiveFirstFrame); |
| 76 return; | 79 return; |
| 77 } | 80 } |
| 78 InspectorTest.evaluateInConsole("doSomeCanvasCalls(3)", didSecondFrameCa
lls); | 81 InspectorTest.evaluateInConsole("doSomeCanvasCalls(3)", didSecondFrameCa
lls); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 </script> | 245 </script> |
| 243 </head> | 246 </head> |
| 244 <body onload="runTest()"> | 247 <body onload="runTest()"> |
| 245 <p> | 248 <p> |
| 246 Tests replay log grid. | 249 Tests replay log grid. |
| 247 </p> | 250 </p> |
| 248 <a href="https://bugs.webkit.org/show_bug.cgi?id=109592">Bug 109592</a> | 251 <a href="https://bugs.webkit.org/show_bug.cgi?id=109592">Bug 109592</a> |
| 249 <canvas id="canvas"></canvas> | 252 <canvas id="canvas"></canvas> |
| 250 </body> | 253 </body> |
| 251 </html> | 254 </html> |
| OLD | NEW |