testing/web-platform/tests/reporting/bufferSize.html
author Paul Meyer <paulmeyer@chromium.org>
Wed, 06 Mar 2019 12:31:01 +0000
changeset 522515 a7fb7ac01c01b3dd651e827a2f8e1118f0ade3c2
parent 522236 b871b38ec2b38a9c8afac0842d9f16ccd4792b9c
permissions -rw-r--r--
Bug 1529156 [wpt PR 15305] - Add testdriver support for generate_test_report WebDriver command., a=testonly Automatic update from web-platform-tests Add testdriver support for generate_test_report WebDriver command. Also adds Reporting API tests which utilize this command. -- fix lint errors -- Add comments to tests -- wpt-commits: 5109698f5a9b61797c86fda8000baeb0e701f3f1, 49f474206a2374f3da136f3ddb62cb85ea5c5532, c0a12dae123c560ef835c19e166a253e44275c80 wpt-pr: 15305

<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Reporting: Buffer size</title>
<link rel="author" title="Paul Meyer" href="paulmeyer@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
  // Test the buffer size (100) of ReportingObserver.
  async_test(async function(test) {
    for (i = 0; i != 110; ++i)
      await test_driver.generate_test_report("" + i);

    var observer = new ReportingObserver(function(reports) {
      test.step(function() {
        // Only (the most recent) 100 reports should be observed, even though
        // 110 were buffered.
        assert_equals(reports.length, 100);
        for(i = 0; i != 100; ++i) {
          assert_equals(reports[i].body.message, "" + (i + 10));
        }
      });

      test.done();
    }, {buffered: true});
    observer.observe();
  }, "Buffer size");
</script>