Skip to content
Permalink
Browse files
Web Inspector: add debugging flag to InspectorTest for unbuffered log…
…ging 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):

Canonical link: https://commits.webkit.org/153643@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Brian Burg committed Aug 8, 2014
1 parent 5bbe315 commit 8aa5e2a9b20272e9bbb7ad9a57ab3cfce9b9917d
Showing 6 changed files with 48 additions and 0 deletions.
@@ -1,3 +1,17 @@
2014-08-08 Brian J. Burg <burg@cs.washington.edu>

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 <roger_fong@apple.com>

Adjustments to CueBox CSS Width calculations.
@@ -302,6 +302,12 @@ bool InspectorFrontendHost::isUnderTest()
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();
@@ -84,6 +84,7 @@ class InspectorFrontendHost : public RefCounted<InspectorFrontendHost> {
void dispatchEventAsContextMenuEvent(Event*);

bool isUnderTest();
void unbufferedLog(const String& message);

void beep();

@@ -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);
@@ -1,3 +1,17 @@
2014-08-08 Brian J. Burg <burg@cs.washington.edu>

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 <pecoraro@apple.com>

Web Inspector: When Switching Recordings, the UI datagrids do not update to match selection
@@ -78,6 +78,9 @@ WebInspector.updateDockedState = function()
// 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 @@ InspectorTest.expectThat = function(condition, message)
// 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 @@ InspectorTest.addResult = function(text)
{
this._results.push(text);

if (InspectorTest.dumpMessagesToConsole)
InspectorFrontendHost.unbufferedLog("addResult: " + text);

if (!this._testPageIsReloading)
this.evaluateInPage("InspectorTestProxy.addResult(unescape('" + escape(text) + "'))");
}

0 comments on commit 8aa5e2a

Please sign in to comment.