Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../http/tests/inspector-protocol/resources/p rotocol-test.js"></script> | |
| 4 <script> | |
| 5 var styleElement1; | |
| 6 var styleElement2; | |
| 7 | |
| 8 function createStyleSheet(textContent) | |
| 9 { | |
| 10 var styleElement = document.createElement("style"); | |
| 11 styleElement.textContent = textContent; | |
| 12 document.body.appendChild(styleElement); | |
|
lushnikov
2013/12/27 08:20:17
let's add/remove stylesheets to document.head inst
| |
| 13 return styleElement; | |
| 14 } | |
| 15 | |
| 16 function reopenWebInspector() | |
| 17 { | |
| 18 setTimeout(deferredReopening, 0); | |
| 19 | |
| 20 function deferredReopening() | |
| 21 { | |
| 22 log("Closing inspector.\n"); | |
| 23 closeInspector(); | |
| 24 window.didReopen = 1; | |
| 25 log("Removing style sheet.\n"); | |
| 26 document.body.removeChild(styleElement1); | |
| 27 log("Reopening inspector."); | |
| 28 openInspector(); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 function openWebInspector() | |
| 33 { | |
| 34 delete window.didReopen; | |
| 35 styleElement1 = createStyleSheet("body.class1 { color: red; } \n /*# sourceU RL=foo.js */"); | |
|
apavlov
2013/12/27 07:12:30
.css ?
| |
| 36 styleElement2 = createStyleSheet("body.class2 { color: green; } \n /*# sourc eURL=bar.js */"); | |
|
apavlov
2013/12/27 07:12:30
ditto
| |
| 37 runTest(); | |
| 38 } | |
| 39 | |
| 40 function test() | |
| 41 { | |
| 42 InspectorTest.log("Running test"); | |
| 43 InspectorTest.sendCommand("Runtime.evaluate", {"expression": "window.didReop en"}, dispatch); | |
| 44 | |
| 45 function dispatch(response) | |
| 46 { | |
| 47 var result = response.result.result; | |
| 48 if (result.type !== "number") { | |
| 49 InspectorTest.log("Opening front-end for the first time"); | |
| 50 runTests(reopenInspector); | |
| 51 } else { | |
| 52 InspectorTest.log("Opening front-end second time"); | |
| 53 runTests(InspectorTest.completeTest.bind(InspectorTest)); | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 function reopenInspector() | |
| 58 { | |
| 59 InspectorTest.sendCommand("Runtime.evaluate", {"expression": "reopenWebI nspector()"}); | |
| 60 } | |
| 61 | |
| 62 function runTests(callback) | |
| 63 { | |
| 64 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; | |
| 65 InspectorTest.eventHandler["CSS.styleSheetRemoved"] = styleSheetRemoved; | |
| 66 | |
| 67 function styleSheetAdded(response) | |
| 68 { | |
| 69 var header = response.params.header; | |
| 70 InspectorTest.log(" - style sheet added: " + header.styleSheetId + " (sourceURL=" + header.sourceURL + ")"); | |
| 71 } | |
| 72 function styleSheetRemoved(response) | |
| 73 { | |
| 74 InspectorTest.log(" - style sheet removed: " + response.params.style SheetId); | |
| 75 } | |
| 76 | |
| 77 InspectorTest.log("Enabling CSS domain."); | |
| 78 InspectorTest.sendCommand("CSS.enable", {}, wasEnabled); | |
| 79 | |
| 80 function wasEnabled() | |
| 81 { | |
| 82 callback(); | |
| 83 } | |
| 84 } | |
| 85 } | |
| 86 </script> | |
| 87 </head> | |
| 88 <body onload="openWebInspector()"> | |
| 89 <p>This test checks that if style sheet is removed between two inspector launche s it is not reported to frontend.</p> | |
| 90 </body> | |
| 91 </html> | |
| OLD | NEW |