chromium/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-large-sticky-ad-use-counter.html

<!DOCTYPE html>
<html>
<head>
<style>
div.content1 {
  z-index: 3;
  position: absolute;
  top: 0px;
  background-color: white;
  width: 100vw;
  height: 100vh;
}
div.empty {
  z-index: 1;
  position: absolute;
  top: 100vh;
  width: 100vw;
  height: 100vh;
}
div.content2 {
  z-index: 3;
  position: absolute;
  top: 200vh;
  background-color: white;
  width: 100vw;
  height: 100vh;
}
iframe {
  z-index: 2;
  position: fixed;
  width: 100vw;
  height: 100vh;
  border: 0px;
  background-color: blue;
}
p {
  position: fixed;
}
</style>

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/large-sticky-ad-testharness.js"></script>
</head>
<body marginwidth="0" marginheight="0">

<!-- To trigger the first contentful paint at the very start -->
<p>some content</p>

<div class="content1">some content</div>
<div class="empty"></div>
<div class="content2">some content</div>

<script>
promise_test(async function(t) {
  // Create the large-sticky-ad.
  appendAdFrameTo(document.body);

  // Scroll down to the position where the parallax-ad is no longer
  // covered by "content1" and becomes visible.
  window.scrollTo(0, window.innerHeight);

  // After 1500ms, force a layout update so that the large-sticky-ad
  // detector is aware of the candidate.
  await timeout(1500);
  await forceLayoutUpdate();
  assert_false(internals.isUseCounted(document, kLargeStickyAd));

  // Scroll further down to the position where the parallax-ad is covered by
  // "content2" and becomes invisible again.
  window.scrollTo(0, window.innerHeight * 2);

  // After 1500ms, force a layout update so that the large-sticky-ad
  // detector is aware of the dismissal of the candidate. We expect no use
  // counter for kLargeStickyAd.
  await timeout(1500);
  await forceLayoutUpdate();

  assert_false(internals.isUseCounted(document, kLargeStickyAd));
}, "Test parallax-ad while scrolling over the page. In this case, we expect no use counter for kLargeStickyAd.");

</script>
</body>
</html>