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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/tracing/timeline-network/timeline-network-received-data.html

Issue 2208963002: [DevTools] Removed InspectorTest.invokeFunctionInPageAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promise-from-other-tests
Patch Set: a Created 4 years, 4 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> 5 <script>
6 6
7 function performActions(callback) 7 function performActions()
8 { 8 {
9 function onImageLoad() 9 var image = new Image();
10 { 10 var imagePromise = new Promise((fulfill) => image.onload = fulfill);
11 window._imageLoaded = true; 11 image.src = "../resources/anImage.png";
12 if (window._scriptEvaluated)
13 callback();
14 }
15 12
16 function scriptEvaluated() 13 var scriptPromise = new Promise((fulfill) => window.timelineNetworkResourceE valuated = fulfill);
17 {
18 window._scriptEvaluated = true;
19 if (window._imageLoaded)
20 callback();
21 }
22
23 var image = new Image();
24 image.onload = onImageLoad;
25 image.src = "../resources/anImage.png";
26 var script = document.createElement("script"); 14 var script = document.createElement("script");
27 script.src = "timeline-network-resource.js"; 15 script.src = "timeline-network-resource.js";
28 document.body.appendChild(script); 16 document.body.appendChild(script);
29 17
30 window.timelineNetworkResourceEvaluated = scriptEvaluated; 18 return Promise.all([imagePromise, scriptPromise]);
31 } 19 }
32 20
33 function test() 21 function test()
34 { 22 {
35 InspectorTest.invokeAsyncWithTimeline("performActions", done); 23 InspectorTest.invokeAsyncWithTimeline("performActions", done);
36 24
37 function done() 25 function done()
38 { 26 {
39 InspectorTest.addResult("Script evaluated."); 27 InspectorTest.addResult("Script evaluated.");
40 var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData "); 28 var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData ");
41 if (record) { 29 if (record) {
42 var data = record.traceEvent().args["data"]; 30 var data = record.traceEvent().args["data"];
43 if (data && typeof data.encodedDataLength === "number") 31 if (data && typeof data.encodedDataLength === "number")
44 InspectorTest.addResult("Resource received data has length, test passed."); 32 InspectorTest.addResult("Resource received data has length, test passed.");
45 } 33 }
46 InspectorTest.completeTest(); 34 InspectorTest.completeTest();
47 } 35 }
48 } 36 }
49 37
50 </script> 38 </script>
51 </head> 39 </head>
52 40
53 <body onload="runTest()"> 41 <body onload="runTest()">
54 <p> 42 <p>
55 Tests the Timeline API instrumentation of a network resource received data 43 Tests the Timeline API instrumentation of a network resource received data
56 </p> 44 </p>
57 </body> 45 </body>
58 </html> 46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698