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

Side by Side Diff: LayoutTests/inspector/timeline/tracing/decode-resize.html

Issue 477153005: DevTools: adopt existing Timeline tests for tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <style>
4 div#img-container {
5 position: relative;
6 width: 99px;
7 height: 99px;
8 overflow: clip;
9 }
10 </style>
11 <script src="../../../http/tests/inspector/inspector-test.js"></script>
12 <script src="../../../http/tests/inspector/timeline-test.js"></script>
13 <script src="../../tracing-test.js"></script>
14 <script>
15
16 var images = [
17 ["../resources/test.bmp", "25", "25"],
18 ["../resources/test.gif", "25", "25"],
19 ["../resources/test.ico", "25", "25"],
20 ["../resources/test.jpg", "25", "25"],
21 ["../resources/test.png", "25", "25"],
22 ["../resources/test.webp", "25", "25"],
23 ["../resources/big.png", "150", "150"]
24 ];
25
26 function showImages(callback)
27 {
28 var nextImageIndex = 0;
29 var imgElement = document.getElementById("img-container").firstElementChild;
30
31 imgElement.addEventListener("load", imageLoaded);
32 addImages();
33
34 function addImages()
35 {
36 if (nextImageIndex >= images.length) {
37 imgElement.removeEventListener("load", imageLoaded);
38 callback();
39 return;
40 }
41
42 var image = images[nextImageIndex++];
43
44 imgElement.width = image[1];
45 imgElement.height = image[2];
46 imgElement.src = image[0];
47 }
48
49 function imageLoaded()
50 {
51 testRunner.displayAsyncThen(addImages);
52 }
53 }
54
55
56 function test()
57 {
58 var imageCount = 0;
59
60 InspectorTest.invokeWithTracing("showImages", onTracingComplete);
61 function onTracingComplete()
62 {
63 var events = InspectorTest.tracingTimelineModel.inspectedTargetEvents();
64 for (var i = 0; i < events.length; ++i) {
65 var event = events[i];
66 if (events[i].name !== WebInspector.TracingTimelineModel.RecordType. DecodeImage)
67 continue;
68 InspectorTest.addResult("event: " + event.name);
69 InspectorTest.addResult("imageURL: " + InspectorTest.formatters.form atAsURL(event.imageURL));
70 InspectorTest.addResult("backendNodeId: " + (event.backendNodeId > 0 ? "present" : "absent"));
71 }
72 InspectorTest.completeTest();
73 }
74 }
75
76 </script>
77 </head>
78
79 <body onload="runTest()">
80 <p>
81 Tests the instrumentation of a DecodeImage and ResizeImage events
82 </p>
83 <div id="img-container"><img></div>
84 </body>
85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698