Title: [102928] trunk/Source/WebKit/chromium
- Revision
- 102928
- Author
- [email protected]
- Date
- 2011-12-15 05:26:06 -0800 (Thu, 15 Dec 2011)
Log Message
Web Inspector: [Chromium] add support to inspector test suite to fetch test execution results from console
https://bugs.webkit.org/show_bug.cgi?id=74208
Reviewed by Yury Semikhatsky.
This adds waitForTestResultsInConsole, a test suite method that monitors console for a message containing
either PASS or FAIL and sets result accordingly. This is used by tests running in the extension context to
communicate test results to the test driver (see devtools_sanity_unittest.cc for an example).
* src/js/Tests.js:
(.TestSuite.prototype.testWaitForResultsInConsole.onConsoleMessage):
(.TestSuite.prototype.testWaitForResultsInConsole):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (102927 => 102928)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-12-15 13:19:31 UTC (rev 102927)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-12-15 13:26:06 UTC (rev 102928)
@@ -1,3 +1,18 @@
+2011-12-15 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: [Chromium] add support to inspector test suite to fetch test execution results from console
+ https://bugs.webkit.org/show_bug.cgi?id=74208
+
+ Reviewed by Yury Semikhatsky.
+
+ This adds waitForTestResultsInConsole, a test suite method that monitors console for a message containing
+ either PASS or FAIL and sets result accordingly. This is used by tests running in the extension context to
+ communicate test results to the test driver (see devtools_sanity_unittest.cc for an example).
+
+ * src/js/Tests.js:
+ (.TestSuite.prototype.testWaitForResultsInConsole.onConsoleMessage):
+ (.TestSuite.prototype.testWaitForResultsInConsole):
+
2011-12-15 Peter Beverloo <[email protected]>
[Chromium] Enable TestNetscapePlugIn to link for Android
Modified: trunk/Source/WebKit/chromium/src/js/Tests.js (102927 => 102928)
--- trunk/Source/WebKit/chromium/src/js/Tests.js 2011-12-15 13:19:31 UTC (rev 102927)
+++ trunk/Source/WebKit/chromium/src/js/Tests.js 2011-12-15 13:26:06 UTC (rev 102928)
@@ -558,6 +558,31 @@
};
+TestSuite.prototype.waitForTestResultsInConsole = function()
+{
+ var messages = WebInspector.console.messages;
+ for (var i = 0; i < messages.length; ++i) {
+ var text = messages[i].text;
+ if (text === "PASS")
+ return;
+ else if (/^FAIL/.test(text))
+ this.fail(text); // This will throw.
+ }
+ // Neitwer PASS nor FAIL, so wait for more messages.
+ function onConsoleMessage(event)
+ {
+ var text = event.data.text;
+ if (text === "PASS")
+ this.releaseControl();
+ else if (/^FAIL/.test(text))
+ this.fail(text);
+ }
+
+ WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
+ this.takeControl();
+};
+
+
/**
* Serializes options collection to string.
* @param {HTMLOptionsCollection} options
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes