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

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

Issue 1754713002: Reland of Timeline: extract and rename TracingModelLoader into a file of its own (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 function runTestWithDataAndCheck(input, expectedOutput) 10 function runTestWithDataAndCheck(input, expectedOutput)
11 { 11 {
12 var model = InspectorTest.tracingTimelineModel(); 12 var model = InspectorTest.tracingTimelineModel();
13 var timeline = WebInspector.panels.timeline; 13 var timeline = WebInspector.panels.timeline;
14 14
15 function createFileReader(file, delegate) 15 function createFileReader(file, delegate)
16 { 16 {
17 var stream = new InspectorTest.StringOutputStream(checkSaveData); 17 var stream = new InspectorTest.StringOutputStream(checkSaveData);
18 var saver = new WebInspector.TracingTimelineSaver(stream); 18 var saver = new WebInspector.TracingTimelineSaver(stream);
19 var storage = timeline._tracingModelBackingStorage; 19 var storage = timeline._tracingModelBackingStorage;
20 return new InspectorTest.FakeFileReader(input, delegate, stream.open .bind(stream, "", storage.writeToStream.bind(storage, stream, saver))); 20 return new InspectorTest.FakeFileReader(input, delegate, stream.open .bind(stream, "", storage.writeToStream.bind(storage, stream, saver)));
21 } 21 }
22 22
23 function checkSaveData(output) 23 function checkSaveData(output)
24 { 24 {
25 var saveData = JSON.parse(output); 25 var saveData = JSON.parse(output);
26 InspectorTest.assertEquals(JSON.stringify(expectedOutput), JSON.stri ngify(saveData), "saved data is not equal to restored"); 26 InspectorTest.assertEquals(JSON.stringify(expectedOutput), JSON.stri ngify(saveData), "saved data is not equal to restored");
27 } 27 }
28 28
29 InspectorTest.override(model, "_createFileReader", createFileReader); 29 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader);
30 30 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress());
31 model.loadFromFile({}, new WebInspector.Progress());
32 } 31 }
33 32
34 function runTestOnMalformedInput(input) 33 function runTestOnMalformedInput(input)
35 { 34 {
36 InspectorTest.tracingModel().reset(); 35 InspectorTest.tracingModel().reset();
37 var model = InspectorTest.tracingTimelineModel(); 36 var model = InspectorTest.tracingTimelineModel();
38 model.reset(); 37 model.reset();
39 function createFileReader(file, delegate) 38 function createFileReader(file, delegate)
40 { 39 {
41 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data); 40 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data);
42 } 41 }
43 42
44 function checkLoadedData(data) 43 function checkLoadedData(data)
45 { 44 {
46 InspectorTest.assertTrue(model.isEmpty()); 45 InspectorTest.assertTrue(model.isEmpty());
47 } 46 }
48 47
49 InspectorTest.override(model, "_createFileReader", createFileReader); 48 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader);
50 model.loadFromFile({}, new WebInspector.Progress()); 49 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress());
51 } 50 }
52 51
53 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0}, 52 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0},
54 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32127,"tid":12,"ts":0}, 53 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32127,"tid":12,"ts":0},
55 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32127,"tid":12,"ts":0}, 54 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32127,"tid":12,"ts":0},
56 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0}, 55 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0},
57 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841}, 56 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841},
58 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0}, 57 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0},
59 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32120,"tid":10,"ts":0}, 58 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32120,"tid":10,"ts":0},
60 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32120,"tid":10,"ts":0}, 59 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32120,"tid":10,"ts":0},
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 121
123 </script> 122 </script>
124 </head> 123 </head>
125 124
126 <body onload="runTest()"> 125 <body onload="runTest()">
127 <p> 126 <p>
128 Tests tracing based Timeline save/load functionality. 127 Tests tracing based Timeline save/load functionality.
129 </p> 128 </p>
130 </body> 129 </body>
131 </html> 130 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698