Skip to content
Permalink
Browse files
2010-07-22 Darin Adler <darin@apple.com>
        Reviewed by Sam Weinig.

        WebKitTestRunner needs to support layoutTestController.dumpChildFramesAsText
        https://bugs.webkit.org/show_bug.cgi?id=42325

        * platform/mac-wk2/Skipped: Removed a duplicate and sorted lists of tests.
        Added some tests to the pasteboard list. Removed the tests from the
        dumpChildFramesAsText list that now pass, and moved others to other lists.
2010-07-22  Darin Adler  <darin@apple.com>

        Reviewed by Sam Weinig.

        WebKitTestRunner needs to support layoutTestController.dumpChildFramesAsText
        https://bugs.webkit.org/show_bug.cgi?id=42325

        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
        Added dumpChildFramesAsText.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::dumpFrameText): Added.
        (WTR::dumpDescendantFramesText): Added.
        (WTR::InjectedBundlePage::dumpAllFramesText): Added.
        (WTR::InjectedBundlePage::dump): Changed to use the new whatToDump function
        instead of the shouldDumpAsText function, and added a case for AllFramesText.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added dumpAllFramesText.

        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::LayoutTestController): Replaced m_dumpAsText with
        m_whatToDump.

        * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added
        dumpChildFramesAsText. Removed shouldDumpAsText, shouldDumpDOMAsWebArchive,
        and shouldDumpSourceAsWebArchive. Added whatToDump.


Canonical link: https://commits.webkit.org/54743@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
darinadler committed Jul 22, 2010
1 parent 2e10902 commit 6cdcf9192623fece05f397cd5af1368aa1fdeedd
@@ -1,3 +1,14 @@
2010-07-22 Darin Adler <darin@apple.com>

Reviewed by Sam Weinig.

WebKitTestRunner needs to support layoutTestController.dumpChildFramesAsText
https://bugs.webkit.org/show_bug.cgi?id=42325

* platform/mac-wk2/Skipped: Removed a duplicate and sorted lists of tests.
Added some tests to the pasteboard list. Removed the tests from the
dumpChildFramesAsText list that now pass, and moved others to other lists.

2010-07-22 Csaba Osztrogonác <ossy@webkit.org>

Unreviewed.

Large diffs are not rendered by default.

@@ -1,3 +1,30 @@
2010-07-22 Darin Adler <darin@apple.com>

Reviewed by Sam Weinig.

WebKitTestRunner needs to support layoutTestController.dumpChildFramesAsText
https://bugs.webkit.org/show_bug.cgi?id=42325

* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
Added dumpChildFramesAsText.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::dumpFrameText): Added.
(WTR::dumpDescendantFramesText): Added.
(WTR::InjectedBundlePage::dumpAllFramesText): Added.
(WTR::InjectedBundlePage::dump): Changed to use the new whatToDump function
instead of the shouldDumpAsText function, and added a case for AllFramesText.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added dumpAllFramesText.

* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController): Replaced m_dumpAsText with
m_whatToDump.

* WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added
dumpChildFramesAsText. Removed shouldDumpAsText, shouldDumpDOMAsWebArchive,
and shouldDumpSourceAsWebArchive. Added whatToDump.

2010-07-22 Adam Roben <aroben@apple.com>

Windows build fix
@@ -28,10 +28,11 @@ module WTR {
interface LayoutTestController {
// The basics.
void dumpAsText();
void dumpChildFramesAsText();
void waitUntilDone();
void notifyDone();

// Other kinds of dumping.
// Other dumping.
void dumpChildFrameScrollPositions();
void dumpStatusCallbacks();

@@ -192,17 +192,49 @@ void InjectedBundlePage::dumpAllFrameScrollPositions()
dumpDescendantFrameScrollPositions(frame);
}

static void dumpFrameText(WKBundleFrameRef frame)
{
WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame));
InjectedBundle::shared().os() << WKStringToUTF8(text.get())->data() << "\n";
}

static void dumpDescendantFramesText(WKBundleFrameRef frame)
{
WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame));
size_t size = WKArrayGetSize(childFrames.get());
for (size_t i = 0; i < size; ++i) {
// FIXME: I don't like that we have to const_cast here. Can we change WKArray?
WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i)));
WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe));
InjectedBundle::shared().os() << "\n--------\nFrame: '" << WKStringToUTF8(subframeName.get())->data() << "'\n--------\n";
dumpFrameText(subframe);
dumpDescendantFramesText(subframe);
}
}

void InjectedBundlePage::dumpAllFramesText()
{
WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
dumpFrameText(frame);
dumpDescendantFramesText(frame);
}

void InjectedBundlePage::dump()
{
InjectedBundle::shared().layoutTestController()->invalidateWaitToDumpWatchdog();

if (InjectedBundle::shared().layoutTestController()->shouldDumpAsText()) {
// FIXME: Support dumping subframes when layoutTestController()->dumpChildFramesAsText() is true.
WKRetainPtr<WKStringRef> innerText(AdoptWK, WKBundleFrameCopyInnerText(WKBundlePageGetMainFrame(m_page)));
InjectedBundle::shared().os() << WKStringToUTF8(innerText.get())->data() << "\n";
} else {
WKRetainPtr<WKStringRef> externalRepresentation(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));
InjectedBundle::shared().os() << WKStringToUTF8(externalRepresentation.get())->data();
switch (InjectedBundle::shared().layoutTestController()->whatToDump()) {
case LayoutTestController::RenderTree: {
WKRetainPtr<WKStringRef> text(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));
InjectedBundle::shared().os() << WKStringToUTF8(text.get())->data();
break;
}
case LayoutTestController::MainFrameText:
dumpFrameText(WKBundlePageGetMainFrame(m_page));
break;
case LayoutTestController::AllFramesText:
dumpAllFramesText();
break;
}

if (InjectedBundle::shared().layoutTestController()->shouldDumpAllFrameScrollPositions())
@@ -71,6 +71,7 @@ class InjectedBundlePage {
void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef);
void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);

void dumpAllFramesText();
void dumpAllFrameScrollPositions();

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

LayoutTestController::LayoutTestController(const std::string& testPathOrURL)
: m_dumpAsText(false)
: m_whatToDump(RenderTree)
, m_shouldDumpAllFrameScrollPositions(false)
, m_dumpStatusCallbacks(false)
, m_waitToDump(false)
@@ -125,21 +125,6 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima
return WKBundleFramePauseAnimationOnElementWithId(mainFrame, nameWK.get(), idWK.get(), time);
}

bool LayoutTestController::shouldDumpDOMAsWebArchive() const
{
return false;
}

bool LayoutTestController::shouldDumpSourceAsWebArchive() const
{
return false;
}

bool LayoutTestController::shouldDumpMainFrameScrollPosition() const
{
return !shouldDumpAsText() && !shouldDumpDOMAsWebArchive() && !shouldDumpSourceAsWebArchive();
}

// Object Creation

void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
@@ -45,11 +45,12 @@ class LayoutTestController : public JSWrappable {
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);

// The basics.
void dumpAsText() { m_dumpAsText = true; }
void dumpAsText() { m_whatToDump = MainFrameText; }
void dumpChildFramesAsText() { m_whatToDump = AllFramesText; }
void waitUntilDone();
void notifyDone();

// Other kinds of dumping.
// Other dumping.
void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }

@@ -62,11 +63,12 @@ class LayoutTestController : public JSWrappable {
unsigned numberOfActiveAnimations() const;
bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);

enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
WhatToDump whatToDump() const { return m_whatToDump; }

bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
bool shouldDumpAsText() const { return m_dumpAsText; }
bool shouldDumpDOMAsWebArchive() const;
bool shouldDumpMainFrameScrollPosition() const;
bool shouldDumpSourceAsWebArchive() const;
bool shouldDumpMainFrameScrollPosition() const { return m_whatToDump == RenderTree; }

bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }

bool waitToDump() const { return m_waitToDump; }
@@ -76,7 +78,7 @@ class LayoutTestController : public JSWrappable {
private:
LayoutTestController(const std::string& testPathOrURL);

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

0 comments on commit 6cdcf91

Please sign in to comment.