Title: [110391] trunk/Source/WebKit/chromium
Revision
110391
Author
[email protected]
Date
2012-03-11 06:15:48 -0700 (Sun, 11 Mar 2012)

Log Message

Web Inspector: [chromium] add provisional test for the downstream sanity test.
https://bugs.webkit.org/show_bug.cgi?id=80784

Reviewed by Yury Semikhatsky.

* src/js/Tests.js:
(.TestSuite.prototype.checkLogAndErrorMessages.validMessage):
(.TestSuite.prototype.checkLogAndErrorMessages.onConsoleMessage):
(.TestSuite.prototype.checkLogAndErrorMessages):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (110390 => 110391)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-11 10:11:52 UTC (rev 110390)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-11 13:15:48 UTC (rev 110391)
@@ -1,3 +1,15 @@
+2012-03-11  Pavel Feldman  <[email protected]>
+
+        Web Inspector: [chromium] add provisional test for the downstream sanity test.
+        https://bugs.webkit.org/show_bug.cgi?id=80784
+
+        Reviewed by Yury Semikhatsky.
+
+        * src/js/Tests.js:
+        (.TestSuite.prototype.checkLogAndErrorMessages.validMessage):
+        (.TestSuite.prototype.checkLogAndErrorMessages.onConsoleMessage):
+        (.TestSuite.prototype.checkLogAndErrorMessages):
+
 2012-03-10  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r110384.

Modified: trunk/Source/WebKit/chromium/src/js/Tests.js (110390 => 110391)


--- trunk/Source/WebKit/chromium/src/js/Tests.js	2012-03-11 10:11:52 UTC (rev 110390)
+++ trunk/Source/WebKit/chromium/src/js/Tests.js	2012-03-11 13:15:48 UTC (rev 110391)
@@ -579,7 +579,51 @@
     this.takeControl();
 };
 
+TestSuite.prototype.checkLogAndErrorMessages = function()
+{
+    var messages = WebInspector.console.messages;
 
+    var matchesCount = 0;
+    function validMessage(message)
+    {
+        if (message.text === "log" && message.level === WebInspector.ConsoleMessage.MessageLevel.Log) {
+            ++matchesCount;
+            return true;
+        }
+
+        if (message.text === "error" && message.level === WebInspector.ConsoleMessage.MessageLevel.Error) {
+            ++matchesCount;
+            return true;
+        }
+        return false;
+    }
+
+    for (var i = 0; i < messages.length; ++i) {
+        if (validMessage(messages[i]))
+            continue;
+        this.fail(messages[i].text + ":" + messages[i].level); // This will throw.
+    }
+
+    if (matchesCount === 2)
+        return;
+
+    // Wait for more messages.
+    function onConsoleMessage(event)
+    {
+        var message = event.data;
+        if (validMessage(message)) {
+            if (matchesCount === 2) {
+                this.releaseControl();
+                return;
+            }
+        } else
+            this.fail(message.text + ":" + messages[i].level);
+    }
+
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
+    this.takeControl();
+};
+
 /**
  * Serializes array of uiSourceCodes to string.
  * @param {Array.<WebInspectorUISourceCode>} uiSourceCodes
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to