| 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="../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 InspectorTest.TestTimelineLifecycleDelegate = function() {} | 9 InspectorTest.TestTimelineLifecycleDelegate = function() {} |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 loadingComplete: function(success) | 22 loadingComplete: function(success) |
| 23 { | 23 { |
| 24 InspectorTest.addResult(`TimelineLifecycleDelegate.loadingComplete($
{success})`); | 24 InspectorTest.addResult(`TimelineLifecycleDelegate.loadingComplete($
{success})`); |
| 25 }, | 25 }, |
| 26 } | 26 } |
| 27 | 27 |
| 28 function runTestWithDataAndCheck(input, expectedOutput, callback) | 28 function runTestWithDataAndCheck(input, expectedOutput, callback) |
| 29 { | 29 { |
| 30 var model = InspectorTest.tracingModel(); | 30 var model = InspectorTest.tracingModel(); |
| 31 model.reset(); | 31 model.reset(); |
| 32 var timeline = WebInspector.panels.timeline; | 32 var timeline = UI.panels.timeline; |
| 33 | 33 |
| 34 function createFileReader(file, delegate) | 34 function createFileReader(file, delegate) |
| 35 { | 35 { |
| 36 return new InspectorTest.FakeFileReader(input, delegate, () => {}); | 36 return new InspectorTest.FakeFileReader(input, delegate, () => {}); |
| 37 } | 37 } |
| 38 | 38 |
| 39 function checkSaveData(output) | 39 function checkSaveData(output) |
| 40 { | 40 { |
| 41 var saveData = JSON.parse(output); | 41 var saveData = JSON.parse(output); |
| 42 InspectorTest.addResult("Saved data is equal to restored data: " + (
JSON.stringify(expectedOutput) === JSON.stringify(saveData))); | 42 InspectorTest.addResult("Saved data is equal to restored data: " + (
JSON.stringify(expectedOutput) === JSON.stringify(saveData))); |
| 43 callback(); | 43 callback(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader",
createFileReader); | 46 InspectorTest.override(Timeline.TimelineLoader, "_createFileReader", cre
ateFileReader); |
| 47 WebInspector.TimelineLoader.loadFromFile(model, {}, new InspectorTest.Te
stTimelineLifecycleDelegate()); | 47 Timeline.TimelineLoader.loadFromFile(model, {}, new InspectorTest.TestTi
melineLifecycleDelegate()); |
| 48 | 48 |
| 49 var saver = new WebInspector.TracingTimelineSaver(); | 49 var saver = new Timeline.TracingTimelineSaver(); |
| 50 var stream = new InspectorTest.StringOutputStream(InspectorTest.safeWrap
(checkSaveData)); | 50 var stream = new InspectorTest.StringOutputStream(InspectorTest.safeWrap
(checkSaveData)); |
| 51 var storage = timeline._tracingModelBackingStorage; | 51 var storage = timeline._tracingModelBackingStorage; |
| 52 stream.open("", storage.writeToStream.bind(storage, stream, saver)); | 52 stream.open("", storage.writeToStream.bind(storage, stream, saver)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 function runTestOnMalformedInput(input, callback) | 55 function runTestOnMalformedInput(input, callback) |
| 56 { | 56 { |
| 57 var model = InspectorTest.tracingModel(); | 57 var model = InspectorTest.tracingModel(); |
| 58 var timeline = WebInspector.panels.timeline; | 58 var timeline = UI.panels.timeline; |
| 59 | 59 |
| 60 model.reset(); | 60 model.reset(); |
| 61 | 61 |
| 62 function createFileReader(file, delegate) | 62 function createFileReader(file, delegate) |
| 63 { | 63 { |
| 64 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded
Data); | 64 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded
Data); |
| 65 } | 65 } |
| 66 | 66 |
| 67 function checkLoadedData(data) | 67 function checkLoadedData(data) |
| 68 { | 68 { |
| 69 InspectorTest.addResult("Model is empty: " + (!model.minimumRecordTi
me() && !model.maximumRecordTime())); | 69 InspectorTest.addResult("Model is empty: " + (!model.minimumRecordTi
me() && !model.maximumRecordTime())); |
| 70 callback(); | 70 callback(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader",
createFileReader); | 73 InspectorTest.override(Timeline.TimelineLoader, "_createFileReader", cre
ateFileReader); |
| 74 WebInspector.TimelineLoader.loadFromFile(model, {}, new InspectorTest.Te
stTimelineLifecycleDelegate()); | 74 Timeline.TimelineLoader.loadFromFile(model, {}, new InspectorTest.TestTi
melineLifecycleDelegate()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":
"M","pid":32127,"tid":0,"ts":0}, | 77 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":
"M","pid":32127,"tid":0,"ts":0}, |
| 78 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index"
,"ph":"M","pid":32127,"tid":12,"ts":0}, | 78 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index"
,"ph":"M","pid":32127,"tid":12,"ts":0}, |
| 79 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph
":"M","pid":32127,"tid":12,"ts":0}, | 79 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph
":"M","pid":32127,"tid":12,"ts":0}, |
| 80 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index",
"ph":"M","pid":32127,"tid":11,"ts":0}, | 80 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index",
"ph":"M","pid":32127,"tid":11,"ts":0}, |
| 81 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program
","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841}, | 81 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program
","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841}, |
| 82 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid
":32120,"tid":0,"ts":0}, | 82 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid
":32120,"tid":0,"ts":0}, |
| 83 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index"
,"ph":"M","pid":32120,"tid":10,"ts":0}, | 83 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index"
,"ph":"M","pid":32120,"tid":10,"ts":0}, |
| 84 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph
":"M","pid":32120,"tid":10,"ts":0}, | 84 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph
":"M","pid":32120,"tid":10,"ts":0}, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 </script> | 150 </script> |
| 151 </head> | 151 </head> |
| 152 | 152 |
| 153 <body onload="runTest()"> | 153 <body onload="runTest()"> |
| 154 <p> | 154 <p> |
| 155 Tests tracing based Timeline save/load functionality. | 155 Tests tracing based Timeline save/load functionality. |
| 156 </p> | 156 </p> |
| 157 </body> | 157 </body> |
| 158 </html> | 158 </html> |
| OLD | NEW |