Chromium Code Reviews| Index: LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html |
| diff --git a/LayoutTests/inspector/console/console-uncaught-promise.html b/LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html |
| similarity index 58% |
| copy from LayoutTests/inspector/console/console-uncaught-promise.html |
| copy to LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html |
| index 5f3af25880706a28e5f177bfb58470771d8aa4df..6ce213e318013cd242e55de6ec4dfde4b66631f6 100644 |
| --- a/LayoutTests/inspector/console/console-uncaught-promise.html |
| +++ b/LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html |
| @@ -4,31 +4,14 @@ |
| <script src="../../http/tests/inspector/console-test.js"></script> |
| <script> |
| -var tested = 0; |
| -function runNextPromiseTest() |
| -{ |
| - ++tested; |
| - var name = "promiseTest" + tested; |
| - if (typeof window[name] !== "function") |
| - return false; |
| - // setTimeout to cut off VM call frames from the stack trace. |
| - setTimeout(function timeout() { |
| - window[name].call(window); |
| - }, 0); |
| - return true; |
| -} |
| - |
| -function promiseTest1() |
| +function createRejectedPromises() |
| { |
| Promise.reject(new Error("err1")) |
| .then() |
| .then() |
| .then(); // Last is unhandled. |
| -} |
| -function promiseTest2() |
| -{ |
| - var reject |
| + var reject; |
| var m0 = new Promise(function(res, rej) { reject = rej; }); |
| var m1 = m0.then(function() {}); |
| var m2 = m0.then(function() {}); |
| @@ -38,13 +21,14 @@ function promiseTest2() |
| m2.catch(function() { |
| m1.catch(function() { |
| m4 = m3.then(function() {}); // Unhandled. |
| + setTimeout(rejectWithDOMException, 0); |
| }); |
| }); |
| }); |
| reject(new Error("err2")); |
| } |
| -function promiseTest3() |
| +function rejectWithDOMException() |
| { |
| var reject; |
| var p = new Promise(function(res, rej) { |
| @@ -57,31 +41,34 @@ function promiseTest3() |
| function throwDOMException() |
| { |
| + setTimeout(showWebInspector, 0); |
| var a = document.createElement("div"); |
| var b = document.createElement("div"); |
| a.removeChild(b); |
| } |
| } |
| -function test() |
| +function onload() |
| { |
| - InspectorTest.addConsoleViewSniffer(checkConsoleMessages, true); |
| - WebInspector.console.showPromise().done(); |
| - |
| - checkConsoleMessages(); |
| + if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| + } |
| + createRejectedPromises(); |
| +} |
| - function checkConsoleMessages() |
| - { |
| - InspectorTest.evaluateInPage("runNextPromiseTest()", callback); |
| +function showWebInspector() |
| +{ |
| + if (window.testRunner) |
| + testRunner.showWebInspector(); |
| + runTest(); |
| +} |
| - function callback(result) |
| - { |
| - if (!result.value) |
| - InspectorTest.expandConsoleMessages(dump); |
| - } |
| - } |
| +function test() |
| +{ |
| + InspectorTest.expandConsoleMessages(onExpanded); |
|
vsevik
2014/11/12 15:46:12
They should be useful even before expanding.
|
| - function dump() |
| + function onExpanded() |
| { |
| InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks); |
| InspectorTest.completeTest(); |
| @@ -91,9 +78,9 @@ function test() |
| </script> |
| </head> |
| -<body onload="runTest()"> |
| +<body onload="onload()"> |
| <p> |
| -Tests that uncaught promise rejections are logged into console. |
| +Tests that uncaught promise rejection messages have line numbers when the inspector is closed and stack traces are not collected. |
| </p> |
| </body> |