| 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="profiler-test.js"></script> | 4 <script src="profiler-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function pageFunction() { | 7 function pageFunction() { |
| 8 console.profile("manual"); | 8 console.profile("manual"); |
| 9 console.profileEnd("manual"); | 9 console.profileEnd("manual"); |
| 10 } | 10 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 InspectorTest.runProfilerTestSuite([ | 42 InspectorTest.runProfilerTestSuite([ |
| 43 function testSave(next) | 43 function testSave(next) |
| 44 { | 44 { |
| 45 function waitForTempFile(view) | 45 function waitForTempFile(view) |
| 46 { | 46 { |
| 47 InspectorTest.addSniffer(view._profileHeader, "_writeToTempFile"
, saveProfileToFile.bind(this, view._profileHeader)); | 47 InspectorTest.addSniffer(view._profileHeader, "_writeToTempFile"
, saveProfileToFile.bind(this, view._profileHeader)); |
| 48 } | 48 } |
| 49 function saveProfileToFile(profile) | 49 function saveProfileToFile(profile) |
| 50 { | 50 { |
| 51 WebInspector.FileOutputStream = function() { } | 51 Bindings.FileOutputStream = function() { } |
| 52 WebInspector.FileOutputStream.prototype = { | 52 Bindings.FileOutputStream.prototype = { |
| 53 open: function(fileName, callback) | 53 open: function(fileName, callback) |
| 54 { | 54 { |
| 55 file.name = fileName; | 55 file.name = fileName; |
| 56 if (fileName.endsWith(".cpuprofile")) { | 56 if (fileName.endsWith(".cpuprofile")) { |
| 57 InspectorTest.addResult("PASS: open was called with
extension '.cpuprofile'"); | 57 InspectorTest.addResult("PASS: open was called with
extension '.cpuprofile'"); |
| 58 callback(true); | 58 callback(true); |
| 59 } else { | 59 } else { |
| 60 InspectorTest.addResult("FAILED: open was called wit
h wrong extension. fileName: '" + fileName + "'"); | 60 InspectorTest.addResult("FAILED: open was called wit
h wrong extension. fileName: '" + fileName + "'"); |
| 61 next(); | 61 next(); |
| 62 } | 62 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 { | 95 { |
| 96 if (loadedProfileData === file._data()) | 96 if (loadedProfileData === file._data()) |
| 97 InspectorTest.addResult("PASS: the content of loaded profile
matches with the original profile."); | 97 InspectorTest.addResult("PASS: the content of loaded profile
matches with the original profile."); |
| 98 else { | 98 else { |
| 99 InspectorTest.addResult("FAIL: the content of loaded profile
doesn't match with the original profile."); | 99 InspectorTest.addResult("FAIL: the content of loaded profile
doesn't match with the original profile."); |
| 100 InspectorTest.addResult("old: " + file._data()); | 100 InspectorTest.addResult("old: " + file._data()); |
| 101 InspectorTest.addResult("new: " + loadedProfileData); | 101 InspectorTest.addResult("new: " + loadedProfileData); |
| 102 } | 102 } |
| 103 next(); | 103 next(); |
| 104 } | 104 } |
| 105 var profilesPanel = WebInspector.panels.profiles; | 105 var profilesPanel = UI.panels.profiles; |
| 106 var profileName = file.name.substr(0, file.name.length - ".cpuprofil
e".length); | 106 var profileName = file.name.substr(0, file.name.length - ".cpuprofil
e".length); |
| 107 InspectorTest.waitUntilProfileViewIsShown(profileName, checkLoadedCo
ntent); | 107 InspectorTest.waitUntilProfileViewIsShown(profileName, checkLoadedCo
ntent); |
| 108 profilesPanel._loadFromFile(file); | 108 profilesPanel._loadFromFile(file); |
| 109 var onTransferFinished = WebInspector.CPUProfileHeader.prototype.onT
ransferFinished; | 109 var onTransferFinished = Profiler.CPUProfileHeader.prototype.onTrans
ferFinished; |
| 110 WebInspector.CPUProfileHeader.prototype.onTransferFinished = functio
n() | 110 Profiler.CPUProfileHeader.prototype.onTransferFinished = function() |
| 111 { | 111 { |
| 112 loadedProfileData = this._jsonifiedProfile; | 112 loadedProfileData = this._jsonifiedProfile; |
| 113 onTransferFinished.call(this); | 113 onTransferFinished.call(this); |
| 114 WebInspector.panels.profiles.showProfile(this); | 114 UI.panels.profiles.showProfile(this); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 ]); | 118 ]); |
| 119 } | 119 } |
| 120 | 120 |
| 121 </script> | 121 </script> |
| 122 </head> | 122 </head> |
| 123 <body onload="runTest()"> | 123 <body onload="runTest()"> |
| 124 <p> | 124 <p> |
| 125 Tests that CPU profiling is able to save/load. | 125 Tests that CPU profiling is able to save/load. |
| 126 | 126 |
| 127 </p> | 127 </p> |
| 128 </body> | 128 </body> |
| 129 </html> | 129 </html> |
| OLD | NEW |