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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-event-causes.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 function test() 6 function test()
7 { 7 {
8 function checkStringContains(string, contains) 8 function checkStringContains(string, contains)
9 { 9 {
10 var doesContain = string.indexOf(contains) >= 0; 10 var doesContain = string.indexOf(contains) >= 0;
11 InspectorTest.check(doesContain, contains + " should be present in " + s tring); 11 InspectorTest.check(doesContain, contains + " should be present in " + s tring);
12 InspectorTest.addResult("PASS - record contained " + contains); 12 InspectorTest.addResult("PASS - record contained " + contains);
13 } 13 }
14 14
15 InspectorTest.runTestSuite([ 15 InspectorTest.runTestSuite([
16 function testTimerInstall(next) 16 function testTimerInstall(next)
17 { 17 {
18 function setTimeoutFunction(callback) 18 function setTimeoutFunction()
19 { 19 {
20 setTimeout(callback, 0); 20 return new Promise((fulfill) => setTimeout(fulfill, 0));
21 } 21 }
22 22
23 var source = setTimeoutFunction.toString(); 23 var source = setTimeoutFunction.toString();
24 source += "\n//# sourceURL=setTimeoutFunction.js"; 24 source += "\n//# sourceURL=setTimeoutFunction.js";
25 InspectorTest.evaluateInPage(source); 25 InspectorTest.evaluateInPage(source);
26 26
27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn dRunNextTest); 27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn dRunNextTest);
28 function finishAndRunNextTest() 28 function finishAndRunNextTest()
29 { 29 {
30 var linkifier = new WebInspector.Linkifier(); 30 var linkifier = new WebInspector.Linkifier();
31 var record = InspectorTest.findFirstTimelineRecord("TimerFire"); 31 var record = InspectorTest.findFirstTimelineRecord("TimerFire");
32 InspectorTest.check(record, "Should receive a TimerFire record." ); 32 InspectorTest.check(record, "Should receive a TimerFire record." );
33 var event = record.traceEvent(); 33 var event = record.traceEvent();
34 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); 34 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true);
35 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper); 35 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper);
36 var causes = contentHelper.element.deepTextContent(); 36 var causes = contentHelper.element.deepTextContent();
37 InspectorTest.check(causes, "Should generate causes"); 37 InspectorTest.check(causes, "Should generate causes");
38 checkStringContains(causes, "Timer InstalledsetTimeoutFunction @ setTimeoutFunction.js:"); 38 checkStringContains(causes, "Timer InstalledPromise @ setTimeout Function.js:");
39 next(); 39 next();
40 } 40 }
41 }, 41 },
42 42
43 function testRequestAnimationFrame(next) 43 function testRequestAnimationFrame(next)
44 { 44 {
45 function requestAnimationFrameFunction(callback) 45 function requestAnimationFrameFunction(callback)
46 { 46 {
47 requestAnimationFrame(callback); 47 return new Promise((fulfill) => requestAnimationFrame(fulfill));
48 } 48 }
49 49
50 var source = requestAnimationFrameFunction.toString(); 50 var source = requestAnimationFrameFunction.toString();
51 source += "\n//# sourceURL=requestAnimationFrameFunction.js"; 51 source += "\n//# sourceURL=requestAnimationFrameFunction.js";
52 InspectorTest.evaluateInPage(source); 52 InspectorTest.evaluateInPage(source);
53 53
54 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction ", finishAndRunNextTest); 54 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction ", finishAndRunNextTest);
55 function finishAndRunNextTest() 55 function finishAndRunNextTest()
56 { 56 {
57 var linkifier = new WebInspector.Linkifier(); 57 var linkifier = new WebInspector.Linkifier();
58 var record = InspectorTest.findFirstTimelineRecord("FireAnimatio nFrame"); 58 var record = InspectorTest.findFirstTimelineRecord("FireAnimatio nFrame");
59 InspectorTest.check(record, "Should receive a FireAnimationFrame record."); 59 InspectorTest.check(record, "Should receive a FireAnimationFrame record.");
60 var event = record.traceEvent(); 60 var event = record.traceEvent();
61 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); 61 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true);
62 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper); 62 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper);
63 var causes = contentHelper.element.deepTextContent(); 63 var causes = contentHelper.element.deepTextContent();
64 InspectorTest.check(causes, "Should generate causes"); 64 InspectorTest.check(causes, "Should generate causes");
65 checkStringContains(causes, "Animation Frame RequestedrequestAni mationFrameFunction @ requestAnimationFrameFunction.js:"); 65 checkStringContains(causes, "Animation Frame RequestedPromise @ requestAnimationFrameFunction.js:");
66 next(); 66 next();
67 } 67 }
68 }, 68 },
69 69
70 function testStyleRecalc(next) 70 function testStyleRecalc(next)
71 { 71 {
72 function styleRecalcFunction() 72 function styleRecalcFunction()
73 { 73 {
74 var element = document.getElementById("testElement"); 74 var element = document.getElementById("testElement");
75 element.style.backgroundColor = "papayawhip"; 75 element.style.backgroundColor = "papayawhip";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 </script> 130 </script>
131 </head> 131 </head>
132 132
133 <body onload="runTest()"> 133 <body onload="runTest()">
134 <p> 134 <p>
135 Test that causes are correctly generated for various types of events. 135 Test that causes are correctly generated for various types of events.
136 </p> 136 </p>
137 <div id="testElement"></div> 137 <div id="testElement"></div>
138 </body> 138 </body>
139 </html> 139 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698