test_Heap_03.html (3138B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Test that we show a throbber while computing and fetching dominator trees, 5 but not in other dominator tree states. 6 --> 7 <head> 8 <meta charset="utf-8"> 9 <title>Tree component test</title> 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 11 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> 12 </head> 13 <body> 14 <div id="container"></div> 15 <pre id="test"> 16 <script src="head.js" type="application/javascript"></script> 17 <script type="application/javascript"> 18 "use strict"; 19 window.onload = async function() { 20 try { 21 const container = document.getElementById("container"); 22 23 for (const state of [dominatorTreeState.COMPUTING, dominatorTreeState.FETCHING]) { 24 await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, { 25 view: { state: viewState.DOMINATOR_TREE }, 26 snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, { 27 dominatorTree: immutableUpdate(TEST_HEAP_PROPS.snapshot.dominatorTree, { 28 state, 29 root: null, 30 dominatorTreeId: state === dominatorTreeState.FETCHING ? 1 : null, 31 }), 32 }), 33 })), container); 34 35 ok(container.querySelector(".devtools-throbber"), 36 `Should show a throbber for state = ${state}`); 37 } 38 39 for ( 40 const state of [ 41 dominatorTreeState.LOADED, dominatorTreeState.INCREMENTAL_FETCHING, 42 ]) { 43 await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, { 44 view: { state: viewState.DOMINATOR_TREE }, 45 snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, { 46 dominatorTree: immutableUpdate(TEST_HEAP_PROPS.snapshot.dominatorTree, { 47 state, 48 activeFetchRequestCount: 49 state === dominatorTreeState.INCREMENTAL_FETCHING ? 1 : undefined, 50 }), 51 }), 52 })), container); 53 54 ok(!container.querySelector(".devtools-throbber"), 55 `Should not show a throbber for state = ${state}`); 56 } 57 58 await renderComponent(Heap(immutableUpdate(TEST_HEAP_PROPS, { 59 view: { state: viewState.DOMINATOR_TREE }, 60 snapshot: immutableUpdate(TEST_HEAP_PROPS.snapshot, { 61 dominatorTree: { 62 state: dominatorTreeState.ERROR, 63 error: new Error("example error for testing"), 64 }, 65 }), 66 })), container); 67 68 ok(!container.querySelector(".devtools-throbber"), 69 `Should not show a throbber for ERROR state`); 70 } catch (e) { 71 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); 72 } finally { 73 SimpleTest.finish(); 74 } 75 }; 76 </script> 77 </pre> 78 </body> 79 </html>