Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load.html

Issue 1755123003: Timeline: quit using Progress, introduce TimelineLifecycleDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 src="../tracing-test.js"></script> 5 <script src="../tracing-test.js"></script>
6 <script> 6 <script>
7 7
8 function test() 8 function test()
9 { 9 {
10 InspectorTest.TestTimelineLifecycleDelegate = function() {}
11
12 InspectorTest.TestTimelineLifecycleDelegate.prototype = {
13 loadingStarted: function()
14 {
15 InspectorTest.addResult("TimelineLifecycleDelegate.loadingStarted()" );
16 },
17
18 loadingProgress: function()
19 {
20 InspectorTest.addResult("TimelineLifecycleDelegate.loadingProgress() ");
21 },
22
23 loadingComplete: function(success)
24 {
25 InspectorTest.addResult(`TimelineLifecycleDelegate.loadingComplete($ {success})`);
26 },
27 }
28
10 function runTestWithDataAndCheck(input, expectedOutput, callback) 29 function runTestWithDataAndCheck(input, expectedOutput, callback)
11 { 30 {
12 InspectorTest.tracingModel().reset(); 31 var model = InspectorTest.tracingModel();
13 var model = InspectorTest.tracingTimelineModel();
14 model.reset(); 32 model.reset();
15 var timeline = WebInspector.panels.timeline; 33 var timeline = WebInspector.panels.timeline;
16 34
17 function createFileReader(file, delegate) 35 function createFileReader(file, delegate)
18 { 36 {
19 return new InspectorTest.FakeFileReader(input, delegate, () => {}); 37 return new InspectorTest.FakeFileReader(input, delegate, () => {});
20 } 38 }
21 39
22 function checkSaveData(output) 40 function checkSaveData(output)
23 { 41 {
24 var saveData = JSON.parse(output); 42 var saveData = JSON.parse(output);
25 InspectorTest.addResult("Saved data is equal to restored data: " + ( JSON.stringify(expectedOutput) === JSON.stringify(saveData))); 43 InspectorTest.addResult("Saved data is equal to restored data: " + ( JSON.stringify(expectedOutput) === JSON.stringify(saveData)));
26 callback(); 44 callback();
27 } 45 }
28 46
29 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader); 47 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader);
30 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress()); 48 WebInspector.TimelineLoader.loadFromFile(model, {}, new InspectorTest.Te stTimelineLifecycleDelegate());
49 model.tracingComplete();
31 50
51 var saver = new WebInspector.TracingTimelineSaver();
32 var stream = new InspectorTest.StringOutputStream(InspectorTest.safeWrap (checkSaveData)); 52 var stream = new InspectorTest.StringOutputStream(InspectorTest.safeWrap (checkSaveData));
33 var saver = new WebInspector.TracingTimelineSaver(stream);
34 var storage = timeline._tracingModelBackingStorage; 53 var storage = timeline._tracingModelBackingStorage;
35 stream.open("", storage.writeToStream.bind(storage, stream, saver)); 54 stream.open("", storage.writeToStream.bind(storage, stream, saver));
36 } 55 }
37 56
38 function runTestOnMalformedInput(input, callback) 57 function runTestOnMalformedInput(input, callback)
39 { 58 {
40 InspectorTest.tracingModel().reset(); 59 var model = InspectorTest.tracingModel();
41 var model = InspectorTest.tracingTimelineModel(); 60 var timeline = WebInspector.panels.timeline;
61
42 model.reset(); 62 model.reset();
43 63
44 function createFileReader(file, delegate) 64 function createFileReader(file, delegate)
45 { 65 {
46 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data); 66 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data);
47 } 67 }
48 68
49 function checkLoadedData(data) 69 function checkLoadedData(data)
50 { 70 {
51 InspectorTest.addResult("Model is empty: " + model.isEmpty()); 71 InspectorTest.addResult("Model is empty: " + (!model.minimumRecordTi me() && !model.maximumRecordTime()));
52 callback(); 72 callback();
53 } 73 }
54 74
55 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader); 75 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader);
56 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress()); 76 WebInspector.TimelineLoader.loadFromFile(model, {}, new InspectorTest.Te stTimelineLifecycleDelegate());
57 } 77 }
58 78
59 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0}, 79 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0},
60 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32127,"tid":12,"ts":0}, 80 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32127,"tid":12,"ts":0},
61 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32127,"tid":12,"ts":0}, 81 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32127,"tid":12,"ts":0},
62 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0}, 82 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0},
63 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841}, 83 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841},
64 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0}, 84 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0},
65 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32120,"tid":10,"ts":0}, 85 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32120,"tid":10,"ts":0},
66 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32120,"tid":10,"ts":0}, 86 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32120,"tid":10,"ts":0},
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 144
125 </script> 145 </script>
126 </head> 146 </head>
127 147
128 <body onload="runTest()"> 148 <body onload="runTest()">
129 <p> 149 <p>
130 Tests tracing based Timeline save/load functionality. 150 Tests tracing based Timeline save/load functionality.
131 </p> 151 </p>
132 </body> 152 </body>
133 </html> 153 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698