Commit 4914e4fe authored by Yoav Weiss's avatar Yoav Weiss Committed by moz-wptsync-bot
Browse files

Bug 1716555 [wpt PR 29382] - [resource-timing] Simplify the clearResourceTimings test, a=testonly

Automatic update from web-platform-tests
[resource-timing] Simplify the clearResourceTimings test

Bug: 1171767
Change-Id: Ic10b67c2bea3e23c628dcab1485bfa15834e7838
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2963852


Reviewed-by: default avatarTom McKee <tommckee@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#892579}

--

wpt-commits: b3d034d8dfac88c65436f85caf71393cdfbd1021
wpt-pr: 29382
parent 63d0b158
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -2,25 +2,21 @@
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the functionality of clearResourceTimings method in resource timing.</title>
<title>This test validates the functionality of clearResourceTimings method
in resource timing.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<link rel="help"
 href="https://www.w3.org/TR/resource-timing-2/#dom-performance-clearresourcetimings">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
    setup({ explicit_done: true });
    const context = new PerformanceContext(performance);
    function onload_test()
    {
        test_equals(context.getEntriesByType('resource').length, 4, 4 + ' resource timing entries should be stored in this page.');
        context.clearResourceTimings();
        test_equals(context.getEntriesByType('resource').length, 0, 'No resource timing entries should be stored after clearResourceTimings.');
        done();
    }
test(() => {
  assert_equals(performance.getEntriesByType("resource").length, 2,
                "Resource timing entries exist");
  performance.clearResourceTimings();
  assert_equals(performance.getEntriesByType("resource").length, 0,
                "Resource timing entries are cleared");
}, "Test that clearResourceTimings() clears the performance timeline buffer");
</script>
</head>
<body onload=onload_test()>
</body>
</html>