| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| div { |
| width: 100vw; |
| height: 100vh; |
| } |
| iframe { |
| position: fixed; |
| margin-left: 25vw; |
| width: 50vw; |
| height: 100vh; |
| border: 0px; |
| } |
| p { |
| position: fixed; |
| } |
| div.bottom { |
| position: absolute; |
| top: 10000px; |
| left: 0px; |
| width: 1px; |
| height: 1px; |
| } |
| </style> |
| |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../resources/overlay-interstitial-ad-testharness.js"></script> |
| </head> |
| <body marginwidth="0" marginheight="0"> |
| |
| <!-- To trigger the first contentful paint at the very start --> |
| <p>some content</p> |
| |
| <!-- To contain the overlay popup iframe --> |
| <div></div> |
| |
| <!-- To be positioned further down in the main page to make the page scrollable --> |
| <div class="bottom"></div> |
| |
| <script> |
| promise_test(async function(t) { |
| // After 1500ms, force a layout update so that the interstitial detector |
| // is aware of the first meaningful paint, and future overlay candidates |
| // will be considered for pop-ups rather than for prestitials. |
| await timeout(1500); |
| await forceLayoutUpdate(); |
| |
| // Create the overlay pop-up ad. |
| appendAdFrameTo(document.getElementsByTagName('div')[0]); |
| |
| // Force a layout update, so that the interstitial detector is aware of |
| // the overlay candidate. |
| await forceLayoutUpdate(); |
| |
| // Hide the pop-up. |
| document.getElementsByTagName('iframe')[0].style.display = 'none'; |
| |
| // Force a layout update, so that the interstitial detector is aware of |
| // the overlay candidate's dismissal. |
| await forceLayoutUpdate(); |
| |
| // Expect the OverlayPopupAd UseCounter. |
| assert_true(internals.isUseCounted(document, kOverlayPopupAd)); |
| }, "Test UseCounter for overlay-popup-ad when the frame itself has a fixed position."); |
| |
| </script> |
| </body> |
| </html> |