testing/web-platform/tests/feature-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html
author Ehsan Karamad <ekaramad@chromium.org>
Mon, 19 Nov 2018 18:46:33 +0000
changeset 506787 8fa2886ddcf1dae2fa951ad3a7bf9d51a3317709
parent 506532 a96795d1de3f259153af0a66f2c00b1ac684f905
child 517846 78e6e39102363dbe3560e7e5b7fdc5dbcce9a1ff
permissions -rw-r--r--
Bug 1505638 [wpt PR 13972] - Violation reports for 'layout-animations', a=testonly Automatic update from web-platform-testsViolation reports for 'layout-animations' This CL adds support for generating violation reports for 'layout-animations' feature policy. The new implementation triggers a report when: 1- CSS Parser finds usage of @keyframes for one of the banned styles. 2- element.animate() changes a banned style. Bug: 902836,867471 Change-Id: I79900603eb0166514d7986dc189ec914bd95f899 Reviewed-on: https://chromium-review.googlesource.com/c/1324138 Commit-Queue: Ehsan Karamad <ekaramad@chromium.org> Reviewed-by: Alan Cutter <alancutter@chromium.org> Cr-Commit-Position: refs/heads/master@{#608984} -- wpt-commits: b8ac03b76dc36f29c66bef25bc69c322b85dc57c wpt-pr: 13972

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/experimental-features/resources/common.js"></script>
<title> 'layout-animations' Policy : violation reports from javascript
</title>
<body>
<script>
  test(() => {
    document.policy.allowedFeatures().forEach((enabled_feature) => {
      assert_not_equals(enabled_feature, "layout-animations");
    });
  },
  "Verify 'layout-animations' is not in document's feature list.");

  promise_test(async () => {
    let promise = wait_for_violation_in_file(
      "layout-animations",
      "animation-property-height.js");
    let script = document.createElement("script");
    script.src = "/feature-policy/experimental-features/resources/" +
                 "animation-property-height.js";
    document.body.appendChild(script);
    await promise;
  },
  "Verify that when 'layout-animations' is disabled, an 'element.animate' " +
  "API including a keyframe that uses a blocked property generates violation " +
  "report (linked scripts).");

  promise_test(async () => {
    let promise = wait_for_violation_in_file(
      "layout-animations",
      "layout-animations-disabled-violation-report-js-tentative.html");
    let div = document.createElement("div");
    document.body.appendChild(div);
    div.animate([{width: "100px"}, {width: "200px"}]);
    await promise;
  },
  "Verify that when 'layout-animations' is disabled, an 'element.animate' " +
  "API including a keyframe that uses a blocked property generates violation " +
  "report (inline scripts).");
</script>
</body>