Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-pause / debugger-pause-on-promise-rejection.html
blob972709851dcf901934927c9e9b57182dc35698ed
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script>
7 function createPromise()
9 var result = {};
10 var p = new Promise(function(resolve, reject) {
11 result.resolve = resolve;
12 result.reject = reject;
13 });
14 result.promise = p;
15 return result;
18 function testFunction()
20 var resolved = createPromise();
21 var caught = createPromise();
22 var uncaught = createPromise();
24 caught.promise
25 .then(function c1() {})
26 .then(function c2() {})
27 .catch(function c3() {});
28 uncaught.promise
29 .then(function f1() {})
30 .then(function f2() {})
31 .then(function f3() {}); // Last is uncaught.
33 resolved.resolve(42); // Should not pause.
34 caught.reject(new Error("caught"));
35 uncaught.reject(new Error("uncaught"));
38 var test = function()
40 InspectorTest.setQuiet(true);
41 InspectorTest.startDebuggerTest(step1);
43 function waitUntilPausedNTimes(count, callback)
45 function inner()
47 if (count--)
48 InspectorTest.waitUntilPausedAndDumpStackAndResume(inner);
49 else
50 callback();
52 inner();
55 function step1()
57 InspectorTest.DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
58 InspectorTest.showScriptSource("debugger-pause-on-promise-rejection.html", step2);
61 function step2()
63 InspectorTest.addResult("=== Pausing only on uncaught exceptions ===");
64 InspectorTest.runTestFunction();
65 waitUntilPausedNTimes(1, step3);
68 function step3()
70 InspectorTest.DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions);
71 InspectorTest.addResult("\n=== Pausing on all exceptions ===");
72 InspectorTest.runTestFunction();
73 waitUntilPausedNTimes(2, step4);
76 function step4()
78 InspectorTest.DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions);
79 InspectorTest.completeDebuggerTest();
83 </script>
84 </head>
86 <body onload="runTest()">
87 <p>
88 Tests that pause on promise rejection works.
89 </p>
91 </body>
92 </html>