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

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: 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 var callback;
10 var promise = new Promise((fulfill) => callback = fulfill);
caseq 2016/08/05 17:56:42 promise => scriptLoadedPromise
kozy 2016/08/10 01:21:14 Done.
9 function onImageLoad() 11 function onImageLoad()
10 { 12 {
11 window._imageLoaded = true; 13 window._imageLoaded = true;
caseq 2016/08/05 17:56:42 drop this and _window.scriptEvaluated, convert onI
kozy 2016/08/10 01:21:14 Done.
12 if (window._scriptEvaluated) 14 if (window._scriptEvaluated)
13 callback(); 15 callback();
14 } 16 }
15 17
16 function scriptEvaluated() 18 function scriptEvaluated()
17 { 19 {
18 window._scriptEvaluated = true; 20 window._scriptEvaluated = true;
19 if (window._imageLoaded) 21 if (window._imageLoaded)
20 callback(); 22 callback();
21 } 23 }
22 24
23 var image = new Image(); 25 var image = new Image();
24 image.onload = onImageLoad; 26 image.onload = onImageLoad;
25 image.src = "../resources/anImage.png"; 27 image.src = "../resources/anImage.png";
26 var script = document.createElement("script"); 28 var script = document.createElement("script");
27 script.src = "timeline-network-resource.js"; 29 script.src = "timeline-network-resource.js";
28 document.body.appendChild(script); 30 document.body.appendChild(script);
29 31
30 window.timelineNetworkResourceEvaluated = scriptEvaluated; 32 window.timelineNetworkResourceEvaluated = scriptEvaluated;
33 return promise;
31 } 34 }
32 35
33 function test() 36 function test()
34 { 37 {
35 InspectorTest.invokeAsyncWithTimeline("performActions", done); 38 InspectorTest.invokeAsyncWithTimeline("performActions", done);
36 39
37 function done() 40 function done()
38 { 41 {
39 InspectorTest.addResult("Script evaluated."); 42 InspectorTest.addResult("Script evaluated.");
40 var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData "); 43 var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData ");
41 if (record) { 44 if (record) {
42 var data = record.traceEvent().args["data"]; 45 var data = record.traceEvent().args["data"];
43 if (data && typeof data.encodedDataLength === "number") 46 if (data && typeof data.encodedDataLength === "number")
44 InspectorTest.addResult("Resource received data has length, test passed."); 47 InspectorTest.addResult("Resource received data has length, test passed.");
45 } 48 }
46 InspectorTest.completeTest(); 49 InspectorTest.completeTest();
47 } 50 }
48 } 51 }
49 52
50 </script> 53 </script>
51 </head> 54 </head>
52 55
53 <body onload="runTest()"> 56 <body onload="runTest()">
54 <p> 57 <p>
55 Tests the Timeline API instrumentation of a network resource received data 58 Tests the Timeline API instrumentation of a network resource received data
56 </p> 59 </p>
57 </body> 60 </body>
58 </html> 61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698