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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/stylesheet-tracking-restart.html

Issue 2950713002: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: addressed comments, 4 tests Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/stylesheet-tracking-restart.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/stylesheet-tracking-restart.html b/third_party/WebKit/LayoutTests/inspector-protocol/stylesheet-tracking-restart.html
deleted file mode 100644
index 51d1950a85c3c9070f7ecb263318c6dc13df8488..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/stylesheet-tracking-restart.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<html>
-<head>
-<script type="text/javascript" src="../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-var styleElement1;
-var styleElement2;
-
-function createStyleSheet(textContent)
-{
- var styleElement = document.createElement("style");
- styleElement.textContent = textContent;
- document.head.appendChild(styleElement);
- return styleElement;
-}
-
-function reopenWebInspector()
-{
- setTimeout(deferredReopening, 0);
-
- function deferredReopening()
- {
- log("Closing inspector.\n");
- closeInspector();
- window.didReopen = 1;
- log("Removing style sheet.\n");
- document.head.removeChild(styleElement1);
- log("Reopening inspector.");
- openInspector();
- }
-}
-
-function openWebInspector()
-{
- delete window.didReopen;
- styleElement1 = createStyleSheet("body.class1 { color: red; } \n /*# sourceURL=foo.css */");
- styleElement2 = createStyleSheet("body.class2 { color: green; } \n /*# sourceURL=bar.css */");
- runTest();
-}
-
-function test()
-{
- InspectorTest.log("Running test");
- InspectorTest.sendCommand("Runtime.evaluate", {"expression": "window.didReopen"}, dispatch);
-
- function dispatch(response)
- {
- var result = response.result.result;
- if (result.type !== "number") {
- InspectorTest.log("Opening front-end for the first time");
- runTests(reopenInspector);
- } else {
- InspectorTest.log("Opening front-end second time");
- runTests(InspectorTest.completeTest.bind(InspectorTest));
- }
- }
-
- function reopenInspector()
- {
- InspectorTest.sendCommand("Runtime.evaluate", {"expression": "reopenWebInspector()"});
- }
-
- function runTests(callback)
- {
- InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
- InspectorTest.eventHandler["CSS.styleSheetRemoved"] = styleSheetRemoved;
- var headersAdded = [];
- var headersRemoved = [];
-
- function styleSheetAdded(response)
- {
- headersAdded.push(response.params.header);
- }
-
- function styleSheetRemoved(response)
- {
- headersRemoved.push(response.params.styleSheetId);
- }
-
- InspectorTest.log("Enabling CSS domain.");
- InspectorTest.sendCommandOrDie("DOM.enable", {});
- InspectorTest.sendCommand("CSS.enable", {}, wasEnabled);
-
- function wasEnabled()
- {
- function compareFunction(a, b)
- {
- return a.styleSheetId - b.styleSheetId;
- }
-
- var headers = {};
- headersAdded.sort(compareFunction);
- for (var i = 0; i < headersAdded.length; ++i) {
- var header = headersAdded[i];
- headers[header.styleSheetId] = header.sourceURL;
- InspectorTest.log(" - style sheet added: " + header.sourceURL);
- }
-
- headersRemoved.sort();
- for (var i = 0; i < headersRemoved.length; ++i)
- InspectorTest.log(" - style sheet removed: " + headers[headersRemoved[i]]);
-
- callback();
- }
- }
-}
-</script>
-</head>
-<body onload="openWebInspector()">
-<p>This test checks that if style sheet is removed between two inspector launches it is not reported to frontend.</p>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698