Skip to content
Permalink
Browse files
Add dumping of statusbar text to WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42516

Reviewed by Dan Bernstein.

WebKit2:

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
Add setStatusbarText callback to WKBundlePageUIClient.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::setStatusbarText):
Call setStatusbarText.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setStatusbarText):
Call the bundle page UI client.

WebKitTools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::_setStatusbarText):
(WTR::InjectedBundlePage::setStatusbarText):
Dump the statusbar text.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController):
Initialize m_dumpStatusCallbacks to false.

(WTR::dumpStatusCallbacksCallback):
Implement JSC callback.

(WTR::LayoutTestController::staticFunctions):
Add dumpStatusCallbacks.

* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(WTR::LayoutTestController::dumpStatusCallbacks):
(WTR::LayoutTestController::setDumpStatusCallbacks):
Add setter and getter for m_dumpStatusCallbacks.

Canonical link: https://commits.webkit.org/54467@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Jul 18, 2010
1 parent ef04d0a commit bdbd85de4bd4ba2dc45a4e10e9545710e0956507
@@ -1,3 +1,22 @@
2010-07-18 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Add dumping of statusbar text to WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42516

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
Add setStatusbarText callback to WKBundlePageUIClient.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::setStatusbarText):
Call setStatusbarText.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setStatusbarText):
Call the bundle page UI client.

2010-07-17 Anders Carlsson <andersca@apple.com>

Reviewed by Maciej Stachowiak.
@@ -61,11 +61,13 @@ typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;

// UI Client
typedef void (*WKBundlePageAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
typedef void (*WKBundlePageSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);

struct WKBundlePageUIClient {
int version;
const void * clientInfo;
WKBundlePageAddMessageToConsoleCallback addMessageToConsole;
WKBundlePageSetStatusbarTextCallback setStatusbarText;
};
typedef struct WKBundlePageUIClient WKBundlePageUIClient;

@@ -52,4 +52,10 @@ void InjectedBundlePageUIClient::addMessageToConsole(WebPage* page, const String
m_client.addMessageToConsole(toRef(page), toRef(message.impl()), lineNumber, m_client.clientInfo);
}

void InjectedBundlePageUIClient::setStatusbarText(WebPage* page, const String& statusbarText)
{
if (m_client.setStatusbarText)
m_client.setStatusbarText(toRef(page), toRef(statusbarText.impl()), m_client.clientInfo);
}

} // namespace WebKit
@@ -42,6 +42,7 @@ class InjectedBundlePageUIClient {
void initialize(WKBundlePageUIClient*);

void addMessageToConsole(WebPage*, const WebCore::String& message, int32_t lineNumber);
void setStatusbarText(WebPage*, const WebCore::String&);

private:
WKBundlePageUIClient m_client;
@@ -230,8 +230,11 @@ bool WebChromeClient::runJavaScriptPrompt(Frame*, const String& message, const S
return false;
}

void WebChromeClient::setStatusbarText(const String&)
void WebChromeClient::setStatusbarText(const String& statusbarText)
{
// Notify the bundle client.
m_page->injectedBundleUIClient().setStatusbarText(m_page, statusbarText);

notImplemented();
}

@@ -1,3 +1,32 @@
2010-07-18 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Add dumping of statusbar text to WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=42516

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::_setStatusbarText):
(WTR::InjectedBundlePage::setStatusbarText):
Dump the statusbar text.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController):
Initialize m_dumpStatusCallbacks to false.

(WTR::dumpStatusCallbacksCallback):
Implement JSC callback.

(WTR::LayoutTestController::staticFunctions):
Add dumpStatusCallbacks.

* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(WTR::LayoutTestController::dumpStatusCallbacks):
(WTR::LayoutTestController::setDumpStatusCallbacks):
Add setter and getter for m_dumpStatusCallbacks.

2010-07-17 Anders Carlsson <andersca@apple.com>

Reviewed by Maciej Stachowiak.
@@ -58,7 +58,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
WKBundlePageUIClient uiClient = {
0,
this,
_addMessageToConsole
_addMessageToConsole,
_setStatusbarText
};
WKBundlePageSetUIClient(m_page, &uiClient);

@@ -198,11 +199,25 @@ void InjectedBundlePage::_addMessageToConsole(WKBundlePageRef page, WKStringRef
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->addMessageToConsole(message, lineNumber);
}

void InjectedBundlePage::_setStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->setStatusbarText(statusbarText);
}

void InjectedBundlePage::addMessageToConsole(WKStringRef message, uint32_t lineNumber)
{
// FIXME: Strip file: urls.
OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << utf8Message->data() << "\n";
}

void InjectedBundlePage::setStatusbarText(WKStringRef statusbarText)
{
if (!InjectedBundle::shared().layoutTestController()->dumpStatusCallbacks())
return;

OwnPtr<Vector<char> > utf8StatusbarText = WKStringToUTF8(statusbarText);
InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << utf8StatusbarText << "\n";
}

} // namespace WTR
@@ -61,7 +61,10 @@ class InjectedBundlePage {

// UI Client
static void _addMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
static void _setStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);

void addMessageToConsole(WKStringRef message, uint32_t lineNumber);
void setStatusbarText(WKStringRef statusbarText);

WKBundlePageRef m_page;
bool m_isLoading;
@@ -42,6 +42,7 @@ PassRefPtr<LayoutTestController> LayoutTestController::create(const std::string&

LayoutTestController::LayoutTestController(const std::string& testPathOrURL)
: m_dumpAsText(false)
, m_dumpStatusCallbacks(false)
, m_waitToDump(false)
, m_testRepaint(false)
, m_testRepaintSweepHorizontally(false)
@@ -133,6 +134,13 @@ static JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}

static JSValueRef dumpStatusCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
controller->setDumpStatusCallbacks(true);
return JSValueMakeUndefined(context);
}

static JSValueRef waitUntilDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -224,6 +232,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
static JSStaticFunction staticFunctions[] = {
{ "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpStatusCallbacks", dumpStatusCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -44,6 +44,9 @@ class LayoutTestController : public RefCounted<LayoutTestController> {
bool dumpAsText() const { return m_dumpAsText; }
void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; }

bool dumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
void setDumpStatusCallbacks(bool dumpStatusCallbacks) { m_dumpStatusCallbacks = dumpStatusCallbacks; }

bool waitToDump() const { return m_waitToDump; }
void setWaitToDump();
void waitToDumpWatchdogTimerFired();
@@ -61,6 +64,7 @@ class LayoutTestController : public RefCounted<LayoutTestController> {
LayoutTestController(const std::string& testPathOrURL);

bool m_dumpAsText;
bool m_dumpStatusCallbacks;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
bool m_testRepaint;
bool m_testRepaintSweepHorizontally;

0 comments on commit bdbd85d

Please sign in to comment.