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

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

Issue 1752453002: Revert 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(WebInspector.TimelineLoader, "_createFileReader", createFileReader); 29 InspectorTest.override(model, "_createFileReader", createFileReader);
30 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress()); 30
31 model.loadFromFile({}, new WebInspector.Progress());
31 } 32 }
32 33
33 function runTestOnMalformedInput(input) 34 function runTestOnMalformedInput(input)
34 { 35 {
35 InspectorTest.tracingModel().reset(); 36 InspectorTest.tracingModel().reset();
36 var model = InspectorTest.tracingTimelineModel(); 37 var model = InspectorTest.tracingTimelineModel();
37 model.reset(); 38 model.reset();
38 function createFileReader(file, delegate) 39 function createFileReader(file, delegate)
39 { 40 {
40 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data); 41 return new InspectorTest.FakeFileReader(input, delegate, checkLoaded Data);
41 } 42 }
42 43
43 function checkLoadedData(data) 44 function checkLoadedData(data)
44 { 45 {
45 InspectorTest.assertTrue(model.isEmpty()); 46 InspectorTest.assertTrue(model.isEmpty());
46 } 47 }
47 48
48 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", createFileReader); 49 InspectorTest.override(model, "_createFileReader", createFileReader);
49 WebInspector.TimelineLoader.loadFromFile(model, {}, new WebInspector.Pro gress()); 50 model.loadFromFile({}, new WebInspector.Progress());
50 } 51 }
51 52
52 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0}, 53 var data = [{"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph": "M","pid":32127,"tid":0,"ts":0},
53 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32127,"tid":12,"ts":0}, 54 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"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}, 55 {"args":{"name":"Renderer"},"cat":"__metadata","name":"process_name","ph ":"M","pid":32127,"tid":12,"ts":0},
55 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0}, 56 {"args":{"sort_index":-1},"cat":"__metadata","name":"thread_sort_index", "ph":"M","pid":32127,"tid":11,"ts":0},
56 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841}, 57 {"args":{},"cat":"disabled-by-default-devtools.timeline","name":"Program ","ph":"B","pid":32120,"tid":9,"ts":95904702436,"tts":1161841},
57 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0}, 58 {"args":{"number":32},"cat":"__metadata","name":"num_cpus","ph":"M","pid ":32120,"tid":0,"ts":0},
58 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"ph":"M","pid":32120,"tid":10,"ts":0}, 59 {"args":{"sort_index":-5},"cat":"__metadata","name":"process_sort_index" ,"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}, 60 {"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
121 122
122 </script> 123 </script>
123 </head> 124 </head>
124 125
125 <body onload="runTest()"> 126 <body onload="runTest()">
126 <p> 127 <p>
127 Tests tracing based Timeline save/load functionality. 128 Tests tracing based Timeline save/load functionality.
128 </p> 129 </p>
129 </body> 130 </body>
130 </html> 131 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698