|
1 |
| -const image_delay = 1000; |
2 |
| -const delay_pipe_value = image_delay / 1000; |
3 |
| - |
4 | 1 | // Receives an image LargestContentfulPaint |entry| and checks |entry|'s attribute values.
|
5 | 2 | // The |timeLowerBound| parameter is a lower bound on the loadTime value of the entry.
|
6 | 3 | // The |options| parameter may contain some string values specifying the following:
|
@@ -36,33 +33,4 @@ function checkImage(entry, expectedUrl, expectedID, expectedSize, timeLowerBound
|
36 | 33 | } else {
|
37 | 34 | assert_equals(entry.size, expectedSize);
|
38 | 35 | }
|
39 |
| - if (options.includes('animated')) { |
40 |
| - assert_greater_than(entry.loadTime, entry.firstAnimatedFrameTime, |
41 |
| - 'firstAnimatedFrameTime should be smaller than loadTime'); |
42 |
| - assert_greater_than(entry.renderTime, entry.firstAnimatedFrameTime, |
43 |
| - 'firstAnimatedFrameTime should be smaller than renderTime'); |
44 |
| - assert_less_than(entry.firstAnimatedFrameTime, image_delay, |
45 |
| - 'firstAnimatedFrameTime should be smaller than the delay applied to the second frame'); |
46 |
| - assert_greater_than(entry.firstAnimatedFrameTime, 0, |
47 |
| - 'firstAnimatedFrameTime should be larger than 0'); |
48 |
| - } |
49 |
| - if (options.includes('animated-zero')) { |
50 |
| - assert_equals(entry.firstAnimatedFrameTime, 0, 'firstAnimatedFrameTime should be 0'); |
51 |
| - } |
52 | 36 | }
|
53 |
| - |
54 |
| -const load_and_observe = url => { |
55 |
| - return new Promise(resolve => { |
56 |
| - (new PerformanceObserver(entryList => { |
57 |
| - for (let entry of entryList.getEntries()) { |
58 |
| - if (entry.url == url) { |
59 |
| - resolve(entryList.getEntries()[0]); |
60 |
| - } |
61 |
| - } |
62 |
| - })).observe({type: 'largest-contentful-paint', buffered: true}); |
63 |
| - const img = new Image(); |
64 |
| - img.id = 'image_id'; |
65 |
| - img.src = url; |
66 |
| - document.body.appendChild(img); |
67 |
| - }); |
68 |
| -}; |
0 commit comments