| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <style> | 3 <style> |
| 4 body { | 4 body { |
| 5 color: green; | 5 color: green; |
| 6 } | 6 } |
| 7 </style> | 7 </style> |
| 8 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/protocol-test.js"></script> | 8 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/protocol-test.js"></script> |
| 9 <script> | 9 <script> |
| 10 function test() | 10 function test() |
| 11 { | 11 { |
| 12 InspectorTest.sendCommand("CSS.getAllStyleSheets", {}, onGotStyleSheets); | 12 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; |
| 13 InspectorTest.sendCommand("CSS.enable", {}, null); |
| 14 |
| 13 var styleId; | 15 var styleId; |
| 14 | 16 function styleSheetAdded(msg) |
| 15 function onGotStyleSheets(msg) { | 17 { |
| 16 if (msg.error) { | 18 var header = msg.params.header; |
| 17 InspectorTest.log(msg.error.message); | 19 if (header.origin !== "regular") |
| 18 InspectorTest.completeTest(); | |
| 19 return; | 20 return; |
| 20 } | 21 delete InspectorTest.eventHandler["CSS.styleSheetAdded"]; |
| 21 var headers = msg.result.headers; | 22 styleId = { "styleSheetId": header.styleSheetId, "ordinal": 0 }; |
| 22 for (var i = 0; i < headers.length; ++i) { | 23 InspectorTest.sendCommand("CSS.setStyleText", { "styleId": styleId, "tex
t": "color: red;" }, onTextSet); |
| 23 if (headers[i].origin === "regular") { | |
| 24 styleId = { "styleSheetId": headers[i].styleSheetId, "ordinal":
0 }; | |
| 25 InspectorTest.sendCommand("CSS.setStyleText", { "styleId": style
Id, "text": "color: red;" }, onTextSet); | |
| 26 return; | |
| 27 } | |
| 28 } | |
| 29 InspectorTest.log("Regular stylesheet not found"); | |
| 30 InspectorTest.completeTest(); | |
| 31 } | 24 } |
| 32 | 25 |
| 33 function onTextSet(msg) { | 26 function onTextSet(msg) { |
| 34 if (msg.error) { | 27 if (msg.error) { |
| 35 InspectorTest.log(JSON.stringify(msg.error)); | 28 InspectorTest.log(JSON.stringify(msg.error)); |
| 36 InspectorTest.completeTest(); | 29 InspectorTest.completeTest(); |
| 37 return; | 30 return; |
| 38 } | 31 } |
| 39 InspectorTest.log("New cssText:"); | 32 InspectorTest.log("New cssText:"); |
| 40 InspectorTest.log(msg.result.style.cssText); | 33 InspectorTest.log(msg.result.style.cssText); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 InspectorTest.log(msg.result.text); | 62 InspectorTest.log(msg.result.text); |
| 70 InspectorTest.completeTest(); | 63 InspectorTest.completeTest(); |
| 71 } | 64 } |
| 72 } | 65 } |
| 73 } | 66 } |
| 74 </script> | 67 </script> |
| 75 </head> | 68 </head> |
| 76 <body onLoad="runTest();"> | 69 <body onLoad="runTest();"> |
| 77 </body> | 70 </body> |
| 78 </html> | 71 </html> |
| OLD | NEW |