| OLD | NEW |
| (Empty) |
| 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> | |
| 6 var p1, p2, p3; | |
| 7 | |
| 8 function testFunction() | |
| 9 { | |
| 10 debugger; // <- will turn on async call stacks here. | |
| 11 setTimeout(func1, 0); | |
| 12 } | |
| 13 | |
| 14 function func1() | |
| 15 { | |
| 16 p1 = Promise.reject(new Error("EXPECTED")); | |
| 17 setTimeout(func2, 0); | |
| 18 } | |
| 19 | |
| 20 function func2() | |
| 21 { | |
| 22 var resolve; | |
| 23 var reject; | |
| 24 p2 = new Promise( | |
| 25 function (a, b) | |
| 26 { | |
| 27 resolve = a; | |
| 28 reject = b; | |
| 29 } | |
| 30 ); | |
| 31 setTimeout(func3.bind(null, resolve, reject), 50); | |
| 32 } | |
| 33 | |
| 34 function func3(resolve, reject) | |
| 35 { | |
| 36 p3 = p1.catch(function() {}); | |
| 37 var x = 42; | |
| 38 resolve(x); | |
| 39 setTimeout(func4, 0); | |
| 40 } | |
| 41 | |
| 42 function func4() | |
| 43 { | |
| 44 debugger; // <- will stop the test here. | |
| 45 } | |
| 46 | |
| 47 function test() | |
| 48 { | |
| 49 var maxAsyncCallStackDepth = 4; | |
| 50 var promisePane; | |
| 51 | |
| 52 InspectorTest.addSniffer(WebInspector.TabbedPane.prototype, "changeTabView",
onChangeTabView, true); | |
| 53 WebInspector.inspectorView.showViewInDrawer("promises", true); | |
| 54 | |
| 55 function onChangeTabView(id, view) | |
| 56 { | |
| 57 if (!promisePane && id === "promises") { | |
| 58 promisePane = view; | |
| 59 InspectorTest.assertTrue(promisePane instanceof WebInspector.Promise
Pane); | |
| 60 InspectorTest.startDebuggerTest(step1, true); | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 function dumpPromiseDataGrid(callback) | |
| 65 { | |
| 66 promisePane._dataGrid._update(); | |
| 67 var result = InspectorTest.dumpDataGridIntoString(promisePane._dataGrid)
; | |
| 68 result = result.replace(/\|\s+\d+\s+\w*\s*\|/g, "| <number> ms |"); | |
| 69 InspectorTest.addResult(result); | |
| 70 if (callback) | |
| 71 callback(); | |
| 72 } | |
| 73 | |
| 74 function step1() | |
| 75 { | |
| 76 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); | |
| 77 } | |
| 78 | |
| 79 function step2() | |
| 80 { | |
| 81 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDept
h, step3); | |
| 82 } | |
| 83 | |
| 84 function step3() | |
| 85 { | |
| 86 InspectorTest.addResult("Is drawer visible: " + WebInspector.inspectorVi
ew.drawerVisible()); | |
| 87 InspectorTest.addResult("Selected view in drawer: " + WebInspector.inspe
ctorView.selectedViewInDrawer()); | |
| 88 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(Inspect
orTest, dumpPromiseDataGrid.bind(null, step4))); | |
| 89 } | |
| 90 | |
| 91 var searchValues = [ | |
| 92 "func3", | |
| 93 "func", | |
| 94 "promise-pane.html", | |
| 95 "promise-pane.html:38", | |
| 96 ]; | |
| 97 | |
| 98 function step4() | |
| 99 { | |
| 100 var text = searchValues.shift(); | |
| 101 if (!text) { | |
| 102 InspectorTest.completeDebuggerTest(); | |
| 103 return; | |
| 104 } | |
| 105 InspectorTest.addResult("\nSetting search value: " + text); | |
| 106 promisePane._textFilterUI.setValue(text); | |
| 107 promisePane._refresh(); | |
| 108 dumpPromiseDataGrid(step4); | |
| 109 } | |
| 110 } | |
| 111 | |
| 112 </script> | |
| 113 </head> | |
| 114 | |
| 115 <body onload="runTest()"> | |
| 116 <p> | |
| 117 Tests promise pane view. | |
| 118 </p> | |
| 119 </body> | |
| 120 </html> | |
| OLD | NEW |