| 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 26 matching lines...) Expand all Loading... |
| 37 return blob; | 37 return blob; |
| 38 } | 38 } |
| 39 }; | 39 }; |
| 40 var file = new MockedFile(); | 40 var file = new MockedFile(); |
| 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.profile, "_writeToTempFile", saveP
rofileToFile.bind(this, view)); | 47 InspectorTest.addSniffer(view._profileHeader, "_writeToTempFile"
, saveProfileToFile.bind(this, view._profileHeader)); |
| 48 } | 48 } |
| 49 function saveProfileToFile(view) | 49 function saveProfileToFile(profile) |
| 50 { | 50 { |
| 51 WebInspector.FileOutputStream = function() { } | 51 WebInspector.FileOutputStream = function() { } |
| 52 WebInspector.FileOutputStream.prototype = { | 52 WebInspector.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 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 } | 74 } |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 close: function() | 77 close: function() |
| 78 { | 78 { |
| 79 InspectorTest.addResult("PASS: close was called"); | 79 InspectorTest.addResult("PASS: close was called"); |
| 80 next(); | 80 next(); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 view.profile.saveToFile(); | 84 profile.saveToFile(); |
| 85 } | 85 } |
| 86 InspectorTest.showProfileWhenAdded("manual"); | 86 InspectorTest.showProfileWhenAdded("manual"); |
| 87 InspectorTest.waitUntilProfileViewIsShown("manual", waitForTempFile.
bind(this)); | 87 InspectorTest.waitUntilProfileViewIsShown("manual", waitForTempFile.
bind(this)); |
| 88 InspectorTest.evaluateInConsole("pageFunction()", function done() {}
); | 88 InspectorTest.evaluateInConsole("pageFunction()", function done() {}
); |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 function testLoad(next) | 91 function testLoad(next) |
| 92 { | 92 { |
| 93 var loadedProfileData; | 93 var loadedProfileData; |
| 94 function checkLoadedContent(profileView) | 94 function checkLoadedContent(profileView) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 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 |