Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: LayoutTests/inspector/styles/stylesheet-tracking.html

Issue 14821010: DevTools: Do not unbind stylesheets in multiframe documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script> 4 <script src="../../http/tests/inspector/elements-test.js"></script>
5 <script src="../../http/tests/inspector/debugger-test.js"></script> 5 <script src="../../http/tests/inspector/debugger-test.js"></script>
6 <link rel="stylesheet" href="resources/stylesheet-tracking.css" /> 6 <link rel="stylesheet" href="resources/stylesheet-tracking.css" />
7 7
8 <style> 8 <style>
9 html { 9 html {
10 font-size: 12px; 10 font-size: 12px;
(...skipping 14 matching lines...) Expand all
25 function removeImport() 25 function removeImport()
26 { 26 {
27 document.getElementById("style").sheet.deleteRule(0); 27 document.getElementById("style").sheet.deleteRule(0);
28 } 28 }
29 29
30 function removeStyleSheet() 30 function removeStyleSheet()
31 { 31 {
32 document.head.removeChild(document.getElementById("style")); 32 document.head.removeChild(document.getElementById("style"));
33 } 33 }
34 34
35 function loadIframe()
36 {
37 var iframe = document.createElement("iframe");
38 iframe.src = "resources/stylesheet-tracking-iframe.html";
39 document.body.appendChild(iframe);
40 }
41
35 function test() 42 function test()
36 { 43 {
37 var inspectorResource; 44 var inspectorResource;
38 45
39 WebInspector.showPanel("elements"); 46 WebInspector.showPanel("elements");
40 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetAdded, styleSheetAdded, null); 47 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetAdded, styleSheetAdded, null);
41 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, styleSheetRemoved, null); 48 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, styleSheetRemoved, null);
42 var headers = WebInspector.cssModel.styleSheetHeaders(); 49 var headers = WebInspector.cssModel.styleSheetHeaders();
43 InspectorTest.addResult(headers.length + " headers known:"); 50 InspectorTest.addResult(headers.length + " headers known:");
44 sortAndDumpData(headers); 51 sortAndDumpData(headers);
(...skipping 24 matching lines...) Expand all
69 } 76 }
70 77
71 function step4() 78 function step4()
72 { 79 {
73 InspectorTest.addResult("=== Adding rule... ==="); 80 InspectorTest.addResult("=== Adding rule... ===");
74 WebInspector.cssModel.addRule(inspectedNode.id, "#inspected", successCal lback, failureCallback); 81 WebInspector.cssModel.addRule(inspectedNode.id, "#inspected", successCal lback, failureCallback);
75 82
76 function successCallback() 83 function successCallback()
77 { 84 {
78 InspectorTest.addResult("Rule added"); 85 InspectorTest.addResult("Rule added");
79 InspectorTest.completeTest(); 86 InspectorTest.evaluateInPage("loadIframe()");
vsevik 2013/05/07 08:11:47 I would also test iframe removing as well.
87 waitStyleSheetAdded(1, step5);
80 } 88 }
81 function failureCallback() 89 function failureCallback()
82 { 90 {
83 InspectorTest.addResult("Failed to add rule."); 91 InspectorTest.addResult("Failed to add rule.");
84 InspectorTest.completeTest(); 92 InspectorTest.completeTest();
85 } 93 }
86 } 94 }
87 95
96 function step5()
97 {
98 InspectorTest.completeTest();
99 }
100
88 var addedCallback; 101 var addedCallback;
89 var addedSheetCount; 102 var addedSheetCount;
90 var addedSheets = []; 103 var addedSheets = [];
91 104
92 function waitStyleSheetAdded(count, next) 105 function waitStyleSheetAdded(count, next)
93 { 106 {
94 addedSheetCount = count; 107 addedSheetCount = count;
95 addedCallback = next; 108 addedCallback = next;
96 } 109 }
97 110
98 function styleSheetAdded(event) 111 function styleSheetAdded(event)
99 { 112 {
113 InspectorTest.addResult("styleSheetAdded");
vsevik 2013/05/07 08:11:47 Let's replace this with an "Unexpected ..." messag
100 var header = event.data; 114 var header = event.data;
101 addedSheets.push(header); 115 addedSheets.push(header);
102 --addedSheetCount; 116 --addedSheetCount;
103 if (addedSheetCount > 0) 117 if (addedSheetCount > 0)
104 return; 118 return;
105 InspectorTest.addResult("Stylesheets added:"); 119 InspectorTest.addResult("Stylesheets added:");
106 sortAndDumpData(addedSheets); 120 sortAndDumpData(addedSheets);
107 addedSheets = []; 121 addedSheets = [];
108 if (addedCallback) { 122 if (addedCallback) {
109 var callback = addedCallback; 123 var callback = addedCallback;
110 addedCallback = null; 124 addedCallback = null;
111 callback(); 125 callback();
112 } 126 }
113 } 127 }
114 128
115 var removedCallback; 129 var removedCallback;
116 var removedSheetCount; 130 var removedSheetCount;
117 var removedSheets = []; 131 var removedSheets = [];
118 132
119 function waitStyleSheetRemoved(count, next) 133 function waitStyleSheetRemoved(count, next)
120 { 134 {
121 removedSheetCount = count; 135 removedSheetCount = count;
122 removedCallback = next; 136 removedCallback = next;
123 } 137 }
124 138
125 function styleSheetRemoved(event) 139 function styleSheetRemoved(event)
126 { 140 {
141 InspectorTest.addResult("styleSheetRemoved");
127 var header = event.data; 142 var header = event.data;
128 removedSheets.push(header); 143 removedSheets.push(header);
129 --removedSheetCount; 144 --removedSheetCount;
130 if (removedSheetCount > 0) 145 if (removedSheetCount > 0)
131 return; 146 return;
132 InspectorTest.addResult("Stylesheets removed:"); 147 InspectorTest.addResult("Stylesheets removed:");
133 sortAndDumpData(removedSheets); 148 sortAndDumpData(removedSheets);
134 removedSheets = []; 149 removedSheets = [];
135 if (removedCallback) { 150 if (removedCallback) {
136 var callback = removedCallback; 151 var callback = removedCallback;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 185
171 <body onload="runTest()"> 186 <body onload="runTest()">
172 <p> 187 <p>
173 Tests that the styleSheetAdded and styleSheetRemoved events are reported into th e frontend. <a href="https://bugs.webkit.org/show_bug.cgi?id=105828">Bug 105828< /a>. 188 Tests that the styleSheetAdded and styleSheetRemoved events are reported into th e frontend. <a href="https://bugs.webkit.org/show_bug.cgi?id=105828">Bug 105828< /a>.
174 </p> 189 </p>
175 190
176 <div id="inspected">Text</div> 191 <div id="inspected">Text</div>
177 192
178 </body> 193 </body>
179 </html> 194 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698