Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: LayoutTests/fast/dom/promise-rejection-events-console.html

Issue 1179113007: Implement onunhandledrejection / onrejectionhandled events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/promise-rejection-events-console.html
diff --git a/LayoutTests/fast/dom/promise-rejection-events-console.html b/LayoutTests/fast/dom/promise-rejection-events-console.html
new file mode 100644
index 0000000000000000000000000000000000000000..9098980b1d9e26eabd4655598ea04541375f3571
--- /dev/null
+++ b/LayoutTests/fast/dom/promise-rejection-events-console.html
@@ -0,0 +1,44 @@
+<!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() {
+ if (window.internals) {
+ t.step(function() {
+ assert_equals(internals.consoleMessageArgumentCounts(document).length, 0);
+ });
+ }
+ t.done();
+ }, 10);
+ };
+}, 'evt.preventDefault() should suppress console output.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698