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

Unified Diff: LayoutTests/inspector/timeline/timeline-decode-resize.html

Issue 399043002: DevTools: switch Timeline frontend into buffered mode and remove the corresponding experiment. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: timeline-decode-resize was fixed? Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/timeline/timeline-decode-resize.html
diff --git a/LayoutTests/inspector/timeline/timeline-decode-resize.html b/LayoutTests/inspector/timeline/timeline-decode-resize.html
index 4ea6b68857162a72f817643e311ecdf1a90a7e22..899d3ae70d59f8a955d20ffd2f6a7ed7241ccca4 100644
--- a/LayoutTests/inspector/timeline/timeline-decode-resize.html
+++ b/LayoutTests/inspector/timeline/timeline-decode-resize.html
@@ -12,65 +12,49 @@ div#img-container {
<script src="../../http/tests/inspector/timeline-test.js"></script>
<script>
-function display()
-{
- if (window.testRunner)
- testRunner.displayAsync();
-}
+var images = [
+ {src: "resources/test.bmp", width: "25", height: "25"},
+ {src: "resources/test.gif", width: "25", height: "25"},
+ {src: "resources/test.ico", width: "25", height: "25"},
+ {src: "resources/test.jpg", width: "25", heigth: "25"},
+ {src: "resources/test.png", width: "25", height: "25"},
+ {src: "resources/test.webp", width: "25", height: "25"},
+ {src: "resources/big.png", width: "150", heigth: "150"}
+];
-function addImage(src, width, height)
+function performActions(callback)
{
- var img = document.getElementById("img-container").firstElementChild;
- img.width = width;
- img.height = height;
- img.src = src;
-}
+ var imageIndex = 0;
-function test()
-{
- var images = [
- ["resources/test.bmp", "25", "25"],
- ["resources/test.gif", "25", "25"],
- ["resources/test.ico", "25", "25"],
- ["resources/test.jpg", "25", "25"],
- ["resources/test.png", "25", "25"],
- ["resources/test.webp", "25", "25"],
- ["resources/big.png", "150", "150"]
- ];
- var imageCount = 0;
- WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, recordSniffer);
- InspectorTest.startTimeline(showImage);
+ addImage();
- function showImage()
+ function addImage()
{
- if (imageCount >= images.length) {
- allImagesShown();
+ if (window.testRunner)
+ testRunner.displayAsync();
+
+ if (imageIndex === images.length) {
+ callback();
return;
}
- InspectorTest.evaluateInPage('addImage("' + images[imageCount].join('", "') + '");');
- imageCount++;
- }
-
- function recordSniffer(event)
- {
- processRecord(event.data);
- }
-
- function processRecord(record)
- {
- if (record.type === WebInspector.TimelineModel.RecordType.DecodeImage) {
- showImage();
+ var img = document.getElementById("img-container").firstElementChild;
+ img.width = images[imageIndex].width;
+ img.height = images[imageIndex].height;
+ img.src = images[imageIndex].src;
+ ++imageIndex;
+ img.onload = function() {
+ window.requestAnimationFrame(addImage);
}
- (record.children || []).forEach(processRecord);
}
+}
- function allImagesShown()
- {
- WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, recordSniffer);
- InspectorTest.stopTimeline(dumpRecords);
- }
+function test()
+{
+ InspectorTest.startDumpingProtocolMessages();
- function dumpRecords(records)
+ InspectorTest.invokeAsyncWithTimeline("performActions", finish);
+
+ function finish(records)
{
for (var i = 0; i < records.length; ++i) {
var record = records[i];
@@ -84,13 +68,21 @@ function test()
}
}
+function manualRunTest()
+{
+ if (window.testRunner)
+ runTest();
+ else
+ performActions();
+}
+
</script>
</head>
-<body onload="runTest()">
+<body onload="manualRunTest()">
<p>
Tests the Timeline API instrumentation of a DecodeImage and ResizeImage events
</p>
-<div id="img-container"><img onload="display()"></div>
+<div id="img-container"><img></div>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698