chromium/third_party/blink/web_tests/fast/dom/promise-rejection-events-console.html

<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
'use strict';
async_test(function(t) {
  var e = new Error('e');
  var p = Promise.reject(e);

  window.onunhandledrejection = function(evt) {
    t.step(function() {
      assert_true(evt.cancelable);
      assert_equals(evt.promise, p);
      assert_equals(evt.reason, e);
    });
    setTimeout(function() {
      var unreached = t.unreached_func('promise should not be fulfilled');
      p.then(unreached, function(reason) {
        t.step(function() {
          assert_equals(reason, e);
        });
      });
    }, 10);
    evt.preventDefault();
  };

  window.onrejectionhandled = function(evt) {
    t.step(function() {
      assert_false(evt.cancelable);
      assert_equals(evt.promise, p);
      assert_equals(evt.reason, e);
    });
    setTimeout(function() {
      t.done();
    }, 10);
  };
}, 'evt.preventDefault() should suppress console output.');
</script>