Index: third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.html b/third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.html |
index c427faa03843fa456b56eb75465f05638f377ad9..5b04b243ae0c375234f09e80df03d37066321c82 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/performance-timing/paint-timing/first-paint-only.html |
@@ -1,34 +1,28 @@ |
<!DOCTYPE html> |
<head> |
-<title>Performance Paint Timing Test</title> |
+<title>Performance Paint Timing Test: FP only</title> |
</head> |
<body> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
- <script> |
+ <div id="main"></div> |
+ <script> |
async_test(function (t) { |
- var observer = new PerformanceObserver( |
- t.step_func(function (entryList) { |
- var entries = entryList.getEntries(); |
- // Nothing contentful to be painted yet. |
- assert_equals(entries.length, 1, |
- "There should be only first paint timing instance."); |
- assert_equals(entries[0].entryType, "paint", |
- "Expected entryType to be: paint."); |
- assert_equals(entries[0].name, "first-paint", |
- "Expected name to be: first-paint."); |
- assert_equals(entries[0].duration, 0, |
- "Expected duration to be: 0."); |
- observer.disconnect(); |
- }) |
- ); |
- observer.observe({entryTypes: ["paint"]}); |
+ const div = document.createElement("div"); |
+ div.style.width = "100px"; |
+ div.style.height = "100px"; |
+ div.style.backgroundColor = "red"; |
+ div.style.color = "blue"; |
+ document.getElementById("main").appendChild(div); |
- t.step_timeout(function() { t.done(); }, 1000); |
- }, "Performance first paint timing entry is observable. No first contentful paint."); |
+ testRunner.capturePixelsAsyncThen(t.step_func_done(function() { |
+ const bufferedEntries = performance.getEntriesByType('paint'); |
+ assert_equals(bufferedEntries.length, 1, "FP only."); |
+ assert_equals(bufferedEntries[0].entryType, "paint"); |
+ assert_equals(bufferedEntries[0].name, "first-paint"); |
+ })); |
+ }, "Performance first paint timing entry exists. No first contentful paint."); |
</script> |
- |
- <div style="background-color:black;color:white;padding:20px;"></div> |
</body> |
</html> |