Title: [172355] trunk/Source
Revision
172355
Author
[email protected]
Date
2014-08-08 13:21:59 -0700 (Fri, 08 Aug 2014)

Log Message

Web Inspector: add debugging flag to InspectorTest for unbuffered logging to stderr
https://bugs.webkit.org/show_bug.cgi?id=135726

Reviewed by Timothy Hatcher.

Source/WebCore:

Add a bridge so that InspectorTest can synchronously log to the console.

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::unbufferedLog): Added.
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:

Source/WebInspectorUI:

Added a flag for debugging inspector tests which will synchronously log messages.
This avoids failure modes that prevent logging from being added to the test page.

* UserInterface/Base/Test.js:
(InspectorTest.debugLog):
(InspectorTest.addResult):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172354 => 172355)


--- trunk/Source/WebCore/ChangeLog	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebCore/ChangeLog	2014-08-08 20:21:59 UTC (rev 172355)
@@ -1,3 +1,17 @@
+2014-08-08  Brian J. Burg  <[email protected]>
+
+        Web Inspector: add debugging flag to InspectorTest for unbuffered logging to stderr
+        https://bugs.webkit.org/show_bug.cgi?id=135726
+
+        Reviewed by Timothy Hatcher.
+
+        Add a bridge so that InspectorTest can synchronously log to the console.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::unbufferedLog): Added.
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+
 2014-08-08  Roger Fong  <[email protected]>
 
         Adjustments to CueBox CSS Width calculations.

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (172354 => 172355)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2014-08-08 20:21:59 UTC (rev 172355)
@@ -302,6 +302,12 @@
     return m_client && m_client->isUnderTest();
 }
 
+void InspectorFrontendHost::unbufferedLog(const String& message)
+{
+    // This is used only for debugging inspector tests.
+    WTFLogAlways("InspectorTest: %s", message.utf8().data());
+}
+
 void InspectorFrontendHost::beep()
 {
     systemBeep();

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (172354 => 172355)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2014-08-08 20:21:59 UTC (rev 172355)
@@ -84,6 +84,7 @@
     void dispatchEventAsContextMenuEvent(Event*);
 
     bool isUnderTest();
+    void unbufferedLog(const String& message);
 
     void beep();
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (172354 => 172355)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2014-08-08 20:21:59 UTC (rev 172355)
@@ -64,6 +64,7 @@
     [Custom] void showContextMenu(MouseEvent event, any items);
     void dispatchEventAsContextMenuEvent(Event event);
     void sendMessageToBackend(DOMString message);
+    void unbufferedLog(DOMString message);
 
     [Custom] void recordActionTaken(unsigned long actionCode);
     [Custom] void recordPanelShown(unsigned long panelCode);

Modified: trunk/Source/WebInspectorUI/ChangeLog (172354 => 172355)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-08-08 20:21:59 UTC (rev 172355)
@@ -1,3 +1,17 @@
+2014-08-08  Brian J. Burg  <[email protected]>
+
+        Web Inspector: add debugging flag to InspectorTest for unbuffered logging to stderr
+        https://bugs.webkit.org/show_bug.cgi?id=135726
+
+        Reviewed by Timothy Hatcher.
+
+        Added a flag for debugging inspector tests which will synchronously log messages.
+        This avoids failure modes that prevent logging from being added to the test page.
+
+        * UserInterface/Base/Test.js:
+        (InspectorTest.debugLog):
+        (InspectorTest.addResult):
+
 2014-08-08  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: When Switching Recordings, the UI datagrids do not update to match selection

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Test.js (172354 => 172355)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2014-08-08 20:09:09 UTC (rev 172354)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2014-08-08 20:21:59 UTC (rev 172355)
@@ -78,6 +78,9 @@
 // which are provided by `inspector-test.js`.
 InspectorTest = {};
 
+// This is useful for debugging Inspector tests by synchronously logging messages.
+InspectorTest.dumpMessagesToConsole = false;
+
 // This is a workaround for the fact that it would be hard to set up a constructor,
 // prototype, and prototype chain for the singleton InspectorTest.
 InspectorTest.EventDispatcher = function()
@@ -132,11 +135,17 @@
 // This function should only be used to debug tests and not to produce normal test output.
 InspectorTest.debugLog = function(message)
 {
+    if (InspectorTest.dumpMessagesToConsole)
+        InspectorFrontendHost.unbufferedLog("debugLog: " + message);
+
     this.evaluateInPage("InspectorTestProxy.debugLog(unescape('" + escape(JSON.stringify(message)) + "'))");
 }
 
 InspectorTest.completeTest = function()
 {
+    if (InspectorTest.dumpMessagesToConsole)
+        InspectorFrontendHost.unbufferedLog("InspectorTest.completeTest()");
+
     function signalCompletionToTestPage() {
         InspectorBackend.runAfterPendingDispatches(this.evaluateInPage.bind(this, "InspectorTestProxy.completeTest()"));
     }
@@ -165,6 +174,9 @@
 {
     this._results.push(text);
 
+    if (InspectorTest.dumpMessagesToConsole)
+        InspectorFrontendHost.unbufferedLog("addResult: " + text);
+
     if (!this._testPageIsReloading)
         this.evaluateInPage("InspectorTestProxy.addResult(unescape('" + escape(text) + "'))");
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to