Diff
Modified: trunk/LayoutTests/ChangeLog (125660 => 125661)
--- trunk/LayoutTests/ChangeLog 2012-08-15 09:51:56 UTC (rev 125660)
+++ trunk/LayoutTests/ChangeLog 2012-08-15 10:10:11 UTC (rev 125661)
@@ -1,3 +1,17 @@
+2012-08-14 Pavel Feldman <[email protected]>
+
+ Web Inspector: split standalone test runner, test scanner and test stub.
+ https://bugs.webkit.org/show_bug.cgi?id=94001
+
+ Reviewed by Vsevolod Vlasov.
+
+ This change allows opening a) test runner, b) layout tests and c) inspector front-end off different
+ hosts. It is one more step towards extension-driven runner.
+
+ * http/tests/inspector/inspector-test.js:
+ * http/tests/inspector/resources/test-runner.html: Removed.
+ * http/tests/inspector/resources/test-scanner.html: Added.
+
2012-08-15 Shinya Kawanaka <[email protected]>
AuthorShadowDOM for meter element
Modified: trunk/LayoutTests/http/tests/inspector/inspector-test.js (125660 => 125661)
--- trunk/LayoutTests/http/tests/inspector/inspector-test.js 2012-08-15 09:51:56 UTC (rev 125660)
+++ trunk/LayoutTests/http/tests/inspector/inspector-test.js 2012-08-15 10:10:11 UTC (rev 125661)
@@ -516,5 +516,37 @@
}
}
+function StandaloneTestRunnerStub()
+{
+}
+
+StandaloneTestRunnerStub.prototype = {
+ dumpAsText: function()
+ {
+ },
+
+ waitUntilDone: function()
+ {
+ },
+
+ closeWebInspector: function()
+ {
+ window.opener.postMessage(["closeWebInspector"], "*");
+ },
+
+ notifyDone: function()
+ {
+ var actual = document.body.innerText + "\n";
+ window.opener.postMessage(["notifyDone", actual], "*");
+ },
+
+ evaluateInWebInspector: function(callId, script)
+ {
+ window.opener.postMessage(["evaluateInWebInspector", callId, script], "*");
+ },
+
+ display: function() { }
+}
+
if (!window.testRunner && window.opener)
- window.testRunner = window.opener.testRunner;
+ window.testRunner = new StandaloneTestRunnerStub();
Deleted: trunk/LayoutTests/http/tests/inspector/resources/test-runner.html (125660 => 125661)
--- trunk/LayoutTests/http/tests/inspector/resources/test-runner.html 2012-08-15 09:51:56 UTC (rev 125660)
+++ trunk/LayoutTests/http/tests/inspector/resources/test-runner.html 2012-08-15 10:10:11 UTC (rev 125661)
@@ -1,233 +0,0 @@
-<html>
-<script src=""
-<script src=""
-<script src=""
-<script src=""
-
-<link rel="stylesheet" type="text/css" href=""
-<style>
-:focus {
- outline: none;
-}
-
-.failed {
- color: red;
-}
-
-.timeout {
- color: brown;
-}
-</style>
-
-<script>
-
-var tests = [];
-var skipList = ["console-api-on-call-frame.html", "debugger/"];
-var treeOutline = null;
-
-function start()
-{
- scanFolder("inspector/console");
- scanFolder("inspector/debugger");
- scanFolder("inspector/editor");
- scanFolder("inspector/elements");
- scanFolder("inspector/profiler");
- scanFolder("inspector/styles");
- scanFolder("inspector/timeline");
- scanFolder("inspector");
-
- document.getElementById("outline").removeChildren();
- treeOutline = new TreeOutline(document.getElementById("outline"));
-
- runNextTest();
-}
-
-function stop()
-{
- tests = [];
-}
-
-function scanFolder(folder)
-{
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "/LayoutTests/" + folder + "/", false);
- xhr.send(null);
- var text = xhr.responseText;
- var element = document.createElement("div");
- element.innerHTML = text;
- var links = element.querySelectorAll("a");
- for (var i = 0; i < links.length; ++i) {
- var link = links[i].href;
- var match = link.match(/[^\/]*\/([^\/]+\.html)$/);
- if (match)
- tests.push(folder + "/" + match[1]);
- }
-}
-
-function runNextTest(lastResult)
-{
- if (lastResult) {
- var element = document.getElementById(lastResult);
- element.textContent = parseInt(element.textContent) + 1;
- }
- var testPath = tests.shift();
- if (testPath)
- new StandaloneTestRunner("http://localhost:8000/LayoutTests/" + testPath, runNextTest);
-}
-
-function StandaloneTestRunner(testPath, next)
-{
- this._testPath = testPath;
- this._next = next;
-
- this._treeElement = new TreeElement(testPath);
- treeOutline.appendChild(this._treeElement);
-
- for (var i = 0; i < skipList.length; ++i) {
- if (testPath.indexOf(skipList[i]) !== -1) {
- this._treeElement.title = testPath + ": SKIPPED";
- this._next("skip");
- return;
- }
- }
-
- this._testPage = window.open("about:blank", "inspected", "width=800,height=600");
-
- window.remoteDebuggingHandshake = this._remoteDebuggingHandshake.bind(this);
- var script = document.createElement("script");
- script.src = ""
- document.head.appendChild(script);
-}
-
-StandaloneTestRunner.FrontendLocation = "http://localhost:8000/Source/WebCore/inspector/front-end/";
-
-StandaloneTestRunner.prototype = {
- _remoteDebuggingHandshake: function(data)
- {
- for (var i = 0; i < data.length; ++i) {
- if (data[i].url !== "about:blank")
- continue;
- var debuggerURL = data[i].webSocketDebuggerUrl.replace("://", "=");
- this._inspectorWindow = window.open(StandaloneTestRunner.FrontendLocation + "inspector.html?" + debuggerURL, "inspector", "width=600,height=400");
- this._inspectorWindow._onload_ = this._inspectorWindowLoaded.bind(this);
- }
- },
-
- _inspectorWindowLoaded: function()
- {
- window.testRunner = this;
- this._testPage.location.href = ""
- this._watchDog = setTimeout(this._timeout.bind(this), 10000);
- },
-
- dumpAsText: function()
- {
- },
-
- waitUntilDone: function()
- {
- },
-
- closeWebInspector: function()
- {
- this._inspectorWindow.close();
- },
-
- notifyDone: function(timeout)
- {
- if (this._done)
- return;
- this._done = true;
-
- var actual = this._testPage.document.body.innerText + "\n";
- this._testPage.close();
- this._inspectorWindow.close();
- clearTimeout(this._watchDog);
-
- var xhr = new XMLHttpRequest();
- var ext = this._testPath.lastIndexOf(".");
- xhr.open("GET", this._testPath.substring(0, ext) + "-expected.txt", false);
- xhr.send(null);
- var expected = xhr.responseText;
- if (actual === expected) {
- this._treeElement.title = this._testPath + ": SUCCESS";
- this._next("pass");
- return;
- }
-
- this._treeElement.title = this._testPath + ": FAILED";
- this._treeElement.listItemElement.addStyleClass("failed");
-
- var baseLines = difflib.stringAsLines(expected);
- var newLines = difflib.stringAsLines(actual);
- var sm = new difflib.SequenceMatcher(baseLines, newLines);
- var opcodes = sm.get_opcodes();
- var lastWasSeparator = false;
-
- for (var idx = 0; idx < opcodes.length; idx++) {
- var code = opcodes[idx];
- var change = code[0];
- var b = code[1];
- var be = code[2];
- var n = code[3];
- var ne = code[4];
- var rowCount = Math.max(be - b, ne - n);
- var topRows = [];
- var bottomRows = [];
- for (var i = 0; i < rowCount; i++) {
- if (change === "delete" || (change === "replace" && b < be)) {
- var lineNumber = b++;
- this._treeElement.appendChild(new TreeElement("- [" + lineNumber + "] " + baseLines[lineNumber]));
- }
-
- if (change === "insert" || (change === "replace" && n < ne)) {
- var lineNumber = n++;
- this._treeElement.appendChild(new TreeElement("+ [" + lineNumber + "] " + newLines[lineNumber]));
- }
-
- if (change === "equal") {
- b++;
- n++;
- }
- }
- }
-
- this._next("fail");
- },
-
- evaluateInWebInspector: function(callId, script)
- {
- this._inspectorWindow.postMessage(["evaluateForTest", callId, script], "*");
- },
-
- _timeout: function()
- {
- this._treeElement.title = this._testPath + ": TIMEOUT";
- this._treeElement.listItemElement.addStyleClass("timeout");
- this._done = true;
- this._testPage.close();
- this._inspectorWindow.close();
- this._next("timeout");
- }
-}
-
-</script>
-<body>
-This is a standalone test suite for inspector front-end. Here is how you run it:<br>
-1) Start serving WebKit folder off port 8000 so that this page would have following address:
-<a href=""
->http://localhost:8000/LayoutTests/http/tests/inspector/resources/test-runner.html</a><br>
-2) Run Chrome Canary (ToT Chromium) with following flags:
- --remote-debugging-port=9222 --user-data-dir=testProfile http://localhost:8000/LayoutTests/http/tests/inspector/resources/test-runner.html<br><br>
-
-<button _onclick_="start()">Start</button>
-<button _onclick_="stop()">Stop</button>
-
-<span>Pass: <span id="pass">0</span></span>
-<span>Fail: <span id="fail">0</span></span>
-<span>Timeout: <span id="timeout">0</span></span>
-<span>Skip: <span id="skip">0</span></span>
-
-<ol id="outline" style="font-size: 12px !important" class="source-code outline-disclosure"></ol>
-</body>
-</html>
Added: trunk/LayoutTests/http/tests/inspector/resources/test-scanner.html (0 => 125661)
--- trunk/LayoutTests/http/tests/inspector/resources/test-scanner.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resources/test-scanner.html 2012-08-15 10:10:11 UTC (rev 125661)
@@ -0,0 +1,68 @@
+<html>
+<script>
+var tests = [];
+
+scanFolder("inspector/console");
+// scanFolder("inspector/debugger");
+scanFolder("inspector/editor");
+scanFolder("inspector/elements");
+scanFolder("inspector/profiler");
+scanFolder("inspector/styles");
+scanFolder("inspector/timeline");
+scanFolder("inspector");
+
+function scanFolder(folder)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "/LayoutTests/" + folder + "/", false);
+ xhr.send(null);
+ var text = xhr.responseText;
+ var element = document.createElement("div");
+ element.innerHTML = text;
+ var links = element.querySelectorAll("a");
+ for (var i = 0; i < links.length; ++i) {
+ var link = links[i].href;
+ var match = link.match(/[^\/]*\/([^\/]+\.html)$/);
+ if (!match)
+ continue;
+ var path = "/LayoutTests/" + folder + "/" + match[1];
+ var expected = fetchExpectations(path);
+ tests.push([path, expected]);
+ }
+}
+
+function fetchExpectations(path)
+{
+ var ext = path.lastIndexOf(".");
+ path = path.substring(0, ext) + "-expected.txt";
+ var chromiumPath = path.replace("/LayoutTests/", "/LayoutTests/platform/chromium/");
+
+ var expectations = fetch(chromiumPath) || fetch(path) || "";
+
+ var expectationLines = expectations.split("\n");
+ var filtered = [];
+ for (var i = 0; i < expectationLines.length; ++i) {
+ if (!expectationLines[i].indexOf("ALERT: ") ||
+ !expectationLines[i].indexOf("CONSOLE MESSAGE: ")) {
+ filtered = [];
+ continue;
+ }
+ filtered.push(expectationLines[i]);
+ }
+ return filtered.join("\n");
+}
+
+function fetch(path)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", path, false);
+ xhr.send(null);
+ return xhr.status !== 404 ? xhr.responseText : "";
+}
+
+window.parent.postMessage(["tests", tests], "*");
+
+</script>
+<body>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/resources/test-scanner.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (125660 => 125661)
--- trunk/Source/WebCore/ChangeLog 2012-08-15 09:51:56 UTC (rev 125660)
+++ trunk/Source/WebCore/ChangeLog 2012-08-15 10:10:11 UTC (rev 125661)
@@ -1,3 +1,16 @@
+2012-08-14 Pavel Feldman <[email protected]>
+
+ Web Inspector: split standalone test runner, test scanner and test stub.
+ https://bugs.webkit.org/show_bug.cgi?id=94001
+
+ Reviewed by Vsevolod Vlasov.
+
+ This change starts sending loacCompleted message to the embedder.
+
+ * inspector/front-end/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.loadCompleted):
+ * inspector/front-end/test-runner.html: Added.
+
2012-08-15 Shinya Kawanaka <[email protected]>
[Refactoring] The debug version and release version of toHTMLSelectElement can be merged without any penalty
Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js (125660 => 125661)
--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js 2012-08-15 09:51:56 UTC (rev 125660)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js 2012-08-15 10:10:11 UTC (rev 125661)
@@ -140,6 +140,8 @@
for (var i = 0; i < InspectorFrontendAPI._pendingCommands.length; ++i)
InspectorFrontendAPI.dispatch(InspectorFrontendAPI._pendingCommands[i]);
InspectorFrontendAPI._pendingCommands = [];
+ if (window.opener)
+ window.opener.postMessage(["loadCompleted"], "*");
}
}
Added: trunk/Source/WebCore/inspector/front-end/test-runner.html (0 => 125661)
--- trunk/Source/WebCore/inspector/front-end/test-runner.html (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/test-runner.html 2012-08-15 10:10:11 UTC (rev 125661)
@@ -0,0 +1,300 @@
+<html>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+
+<link rel="stylesheet" type="text/css" href=""
+<style>
+:focus {
+ outline: none;
+}
+
+.failed {
+ color: red;
+}
+
+.timeout {
+ color: brown;
+}
+
+iframe {
+ width: 0;
+ height: 0;
+ opacity: 0;
+}
+
+</style>
+
+<script>
+
+var tests = [];
+var skipList = [
+ // HALT
+ "inspector/console/console-api-on-call-frame.html",
+
+ // FAILED
+ "inspector/console/console-dir-global.html",
+ "inspector/console/console-log-toString-object.html",
+ "inspector/console/console-uncaught-exception-in-eval.html",
+ "inspector/elements/edit-dom-actions.html",
+ "inspector/elements/highlight-node-scaled.html",
+ "inspector/elements/highlight-node-scroll.html",
+ "inspector/elements/highlight-node.html",
+ "inspector/elements/highlight-svg-root.html",
+ "inspector/network-status-non-http.html",
+ "inspector/storage-panel-dom-storage-update.html",
+ "inspector/styles/inject-stylesheet.html",
+ "inspector/styles/protocol-css-regions-commands.html",
+ "inspector/styles/region-style-crash.html",
+ "inspector/styles/styles-disable-then-enable-overriden-ua.html",
+ "inspector/styles/styles-url-linkify.html",
+ "inspector/styles/vendor-prefixes.html",
+ "inspector/timeline/timeline-event-dispatch.html",
+ "inspector/timeline/timeline-frames.html",
+ "inspector/timeline/timeline-network-resource.html",
+ "inspector/timeline/timeline-paint.html",
+ "inspector/timeline/timeline-receive-response-event.html",
+
+ // TIMEOUT
+ "inspector/profiler/cpu-profiler-profiling-without-inspector.html",
+ "inspector/profiler/heap-snapshot-inspect-dom-wrapper.html",
+ "inspector/timeline/timeline-network-received-data.html",
+];
+var treeOutline = null;
+
+function run(debug)
+{
+ var iframe = document.createElement("iframe");
+ iframe.src = ""
+ document.body.appendChild(iframe);
+ window.debug = debug;
+}
+
+function runTests()
+{
+ document.getElementById("outline").removeChildren();
+ treeOutline = new TreeOutline(document.getElementById("outline"));
+
+ document.getElementById("pass").textContent = 0;
+ document.getElementById("skip").textContent = 0;
+ document.getElementById("fail").textContent = 0;
+ document.getElementById("timeout").textContent = 0;
+ document.getElementById("remaining").textContent = tests.length;
+
+ runNextTest();
+}
+
+function interrupt()
+{
+ tests = [];
+}
+
+function runNextTest(lastResult)
+{
+ if (lastResult) {
+ var element = document.getElementById(lastResult);
+ element.textContent = parseInt(element.textContent) + 1;
+
+ element = document.getElementById("remaining");
+ element.textContent = parseInt(element.textContent) - 1;
+ if (window.debug)
+ return;
+ }
+
+ var test;
+ var filter = document.getElementById("filter").value;
+ while (test = tests.shift()) {
+ if (!filter || test[0].match(filter)) {
+ new StandaloneTestRunner("http://localhost:8001" + test[0], test[1], runNextTest.bind(null));
+ return;
+ }
+ }
+}
+
+function StandaloneTestRunner(testPath, expected, next)
+{
+ this._testPath = testPath;
+ this._next = next;
+ this._expected = expected;
+ this._pendingMessages = [];
+
+ this._treeElement = new TreeElement(testPath);
+ treeOutline.appendChild(this._treeElement);
+
+ for (var i = 0; !window.debug && i < skipList.length; ++i) {
+ if (testPath.indexOf(skipList[i]) !== -1) {
+ this._treeElement.title = testPath + ": SKIPPED";
+ this._next("skip");
+ return;
+ }
+ }
+
+ this._testPage = window.open("about:blank", "inspected", "width=800,height=600");
+
+ window.remoteDebuggingHandshake = this._remoteDebuggingHandshake.bind(this);
+ var script = document.createElement("script");
+ script.src = ""
+ document.head.appendChild(script);
+}
+
+StandaloneTestRunner.FrontendLocation = "inspector.html";
+
+StandaloneTestRunner.prototype = {
+ _remoteDebuggingHandshake: function(data)
+ {
+ for (var i = 0; i < data.length; ++i) {
+ if (data[i].url !== "about:blank")
+ continue;
+ this._debuggerURL = data[i].webSocketDebuggerUrl.replace("://", "=");
+ this._openTestPage();
+ break;
+ }
+ },
+
+ _openTestPage: function()
+ {
+ window.runner = this;
+ this._testPage.location.href = ""
+ this._inspectorWindowLoading = window.open(StandaloneTestRunner.FrontendLocation + "?" + this._debuggerURL, "inspector", "width=600,height=400");
+ this._watchDog = setTimeout(this._timeout.bind(this), 10000);
+ },
+
+ loadCompleted: function()
+ {
+ this._inspectorWindow = this._inspectorWindowLoading;
+ for (var i = 0; i < this._pendingMessages.length; ++i)
+ this._inspectorWindow.postMessage(this._pendingMessages[i], "*");
+ this._pendingMessages = [];
+ },
+
+ closeWebInspector: function()
+ {
+ if (!window.debug)
+ this._inspectorWindow.close();
+ },
+
+ notifyDone: function(actual)
+ {
+ if (this._done)
+ return;
+ this._done = true;
+ delete window.runner;
+
+ if (!window.debug) {
+ this._testPage.close();
+ this._inspectorWindow.close();
+ }
+ clearTimeout(this._watchDog);
+
+ if (actual === this._expected) {
+ this._treeElement.title = this._testPath + ": SUCCESS";
+ this._next("pass");
+ return;
+ }
+
+ this._treeElement.title = this._testPath + ": FAILED";
+ this._treeElement.listItemElement.addStyleClass("failed");
+
+ var baseLines = difflib.stringAsLines(this._expected);
+ var newLines = difflib.stringAsLines(actual);
+ var sm = new difflib.SequenceMatcher(baseLines, newLines);
+ var opcodes = sm.get_opcodes();
+ var lastWasSeparator = false;
+
+ for (var idx = 0; idx < opcodes.length; idx++) {
+ var code = opcodes[idx];
+ var change = code[0];
+ var b = code[1];
+ var be = code[2];
+ var n = code[3];
+ var ne = code[4];
+ var rowCount = Math.max(be - b, ne - n);
+ var topRows = [];
+ var bottomRows = [];
+ for (var i = 0; i < rowCount; i++) {
+ if (change === "delete" || (change === "replace" && b < be)) {
+ var lineNumber = b++;
+ this._treeElement.appendChild(new TreeElement("- [" + lineNumber + "] " + baseLines[lineNumber]));
+ }
+
+ if (change === "insert" || (change === "replace" && n < ne)) {
+ var lineNumber = n++;
+ this._treeElement.appendChild(new TreeElement("+ [" + lineNumber + "] " + newLines[lineNumber]));
+ }
+
+ if (change === "equal") {
+ b++;
+ n++;
+ }
+ }
+ }
+
+ this._next("fail");
+ },
+
+ evaluateInWebInspector: function(callId, script)
+ {
+ if (this._inspectorWindow)
+ this._inspectorWindow.postMessage(["evaluateForTest", callId, script], "*");
+ else
+ this._pendingMessages.push(["evaluateForTest", callId, script]);
+ },
+
+ _timeout: function()
+ {
+ this._treeElement.title = this._testPath + ": TIMEOUT";
+ this._treeElement.listItemElement.addStyleClass("timeout");
+ this._done = true;
+ if (!window.debug) {
+ this._testPage.close();
+ this._inspectorWindow.close();
+ }
+ this._next("timeout");
+ },
+
+ display: function() { }
+}
+
+function onMessageFromTestPage(event)
+{
+ var signature = event.data;
+ var method = signature.shift();
+ if (method === "tests") {
+ tests = signature[0];
+ runTests();
+ return;
+ }
+
+ if (runner)
+ runner[method].apply(runner, signature);
+}
+
+window.addEventListener("message", onMessageFromTestPage, true);
+
+</script>
+<body>
+This is a standalone test suite for inspector front-end. Here is how you run it:
+<ul>
+<li>Check out WebKit source tree: git clone http://git.chromium.org/external/Webkit.git</li>
+<li>Run "Tools/Scripts/new-run-webkit-httpd --root=. --port=8002 --server=start"</li>
+<li>Visit <a href=""
+>http://localhost:8002/Source/WebCore/inspector/front-end/test-runner.html</a></li>
+<li>Run Chrome Canary (ToT Chromium) with following flags: "--remote-debugging-port=9222 --user-data-dir=testProfile http://localhost:8002/Source/WebCore/inspector/front-end/test-runner.html</li>
+</ul>
+
+<button _onclick_="run()">Run</button>
+<button _onclick_="run(true)">Debug</button>
+<button _onclick_="interrupt()">Interrupt</button>
+Filter: <input id="filter" type="text"></input><br>
+
+<span>Passed: <span id="pass">0</span></span>
+<span>Failed: <span id="fail">0</span></span>
+<span>Timeout: <span id="timeout">0</span></span>
+<span>Skipped: <span id="skip">0</span></span>
+<span>Remaining: <span id="remaining">0</span><br>
+
+<ol id="outline" style="font-size: 12px !important" class="source-code outline-disclosure"></ol>
+
+</body>
+</html>
Property changes on: trunk/Source/WebCore/inspector/front-end/test-runner.html
___________________________________________________________________
Added: svn:eol-style