Skip to content
Permalink
Browse files
[chromium] move resource load callback dumping to TestRunner library
https://bugs.webkit.org/show_bug.cgi?id=106449

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::reset):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebKit):
(WebTestRunner::WebTestDelegate::makeURLErrorDescription):
* DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
(WebKit):
(WebTestProxyBase):
(WebTestRunner::WebTestProxy::assignIdentifierToRequest):
(WebTestRunner::WebTestProxy::willRequestResource):
(WebTestRunner::WebTestProxy::willSendRequest):
(WebTestRunner::WebTestProxy::didReceiveResponse):
(WebTestRunner::WebTestProxy::didFinishResourceLoad):
(WebTestRunner::WebTestProxy::didFailResourceLoad):
* DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
(WebTestRunner::WebTestRunner::shouldDumpResourceLoadCallbacks):
(WebTestRunner::WebTestRunner::shouldDumpResourceRequestCallbacks):
(WebTestRunner::WebTestRunner::shouldDumpResourceResponseMIMETypes):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::shouldDumpResourceLoadCallbacks):
(WebTestRunner::TestRunner::shouldDumpResourceRequestCallbacks):
(WebTestRunner::TestRunner::shouldDumpResourceResponseMIMETypes):
(WebTestRunner):
(WebTestRunner::TestRunner::dumpResourceLoadCallbacks):
(WebTestRunner::TestRunner::dumpResourceRequestCallbacks):
(WebTestRunner::TestRunner::dumpResourceResponseMIMETypes):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::reset):
(WebTestRunner):
(WebTestRunner::WebTestProxyBase::assignIdentifierToRequest):
(WebTestRunner::WebTestProxyBase::willRequestResource):
(WebTestRunner::WebTestProxyBase::willSendRequest):
(WebTestRunner::WebTestProxyBase::didReceiveResponse):
(WebTestRunner::WebTestProxyBase::didFinishResourceLoad):
(WebTestRunner::WebTestProxyBase::didFailResourceLoad):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::willSendRequest):
(WebViewHost::makeURLErrorDescription):
(WebViewHost::reset):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):


Canonical link: https://commits.webkit.org/124683@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jeisinger committed Jan 9, 2013
1 parent 2fd97ac commit 5c8fc0fb6eb39708072ac22d2ed5a3a85360b07a
Showing 11 changed files with 318 additions and 184 deletions.
@@ -1,3 +1,59 @@
2013-01-09 Jochen Eisinger <jochen@chromium.org>

[chromium] move resource load callback dumping to TestRunner library
https://bugs.webkit.org/show_bug.cgi?id=106449

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::reset):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebKit):
(WebTestRunner::WebTestDelegate::makeURLErrorDescription):
* DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
(WebKit):
(WebTestProxyBase):
(WebTestRunner::WebTestProxy::assignIdentifierToRequest):
(WebTestRunner::WebTestProxy::willRequestResource):
(WebTestRunner::WebTestProxy::willSendRequest):
(WebTestRunner::WebTestProxy::didReceiveResponse):
(WebTestRunner::WebTestProxy::didFinishResourceLoad):
(WebTestRunner::WebTestProxy::didFailResourceLoad):
* DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
(WebTestRunner::WebTestRunner::shouldDumpResourceLoadCallbacks):
(WebTestRunner::WebTestRunner::shouldDumpResourceRequestCallbacks):
(WebTestRunner::WebTestRunner::shouldDumpResourceResponseMIMETypes):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::shouldDumpResourceLoadCallbacks):
(WebTestRunner::TestRunner::shouldDumpResourceRequestCallbacks):
(WebTestRunner::TestRunner::shouldDumpResourceResponseMIMETypes):
(WebTestRunner):
(WebTestRunner::TestRunner::dumpResourceLoadCallbacks):
(WebTestRunner::TestRunner::dumpResourceRequestCallbacks):
(WebTestRunner::TestRunner::dumpResourceResponseMIMETypes):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::reset):
(WebTestRunner):
(WebTestRunner::WebTestProxyBase::assignIdentifierToRequest):
(WebTestRunner::WebTestProxyBase::willRequestResource):
(WebTestRunner::WebTestProxyBase::willSendRequest):
(WebTestRunner::WebTestProxyBase::didReceiveResponse):
(WebTestRunner::WebTestProxyBase::didFinishResourceLoad):
(WebTestRunner::WebTestProxyBase::didFailResourceLoad):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::willSendRequest):
(WebViewHost::makeURLErrorDescription):
(WebViewHost::reset):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

2013-01-09 Dan Carney <dcarney@google.com>

[chromium] move dumpcreateview methods to testrunner library
@@ -119,9 +119,6 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("displayInvalidatedRegion", &DRTTestRunner::displayInvalidatedRegion);
bindMethod("dumpBackForwardList", &DRTTestRunner::dumpBackForwardList);
bindMethod("dumpProgressFinishedCallback", &DRTTestRunner::dumpProgressFinishedCallback);
bindMethod("dumpResourceLoadCallbacks", &DRTTestRunner::dumpResourceLoadCallbacks);
bindMethod("dumpResourceRequestCallbacks", &DRTTestRunner::dumpResourceRequestCallbacks);
bindMethod("dumpResourceResponseMIMETypes", &DRTTestRunner::dumpResourceResponseMIMETypes);
bindMethod("dumpSelectionRect", &DRTTestRunner::dumpSelectionRect);
bindMethod("dumpStatusCallbacks", &DRTTestRunner::dumpWindowStatusChanges);
bindMethod("dumpPermissionClientCallbacks", &DRTTestRunner::dumpPermissionClientCallbacks);
@@ -251,24 +248,6 @@ void DRTTestRunner::dumpProgressFinishedCallback(const CppArgumentList&, CppVari
result->setNull();
}

void DRTTestRunner::dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceLoadCallbacks = true;
result->setNull();
}

void DRTTestRunner::dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceRequestCallbacks = true;
result->setNull();
}

void DRTTestRunner::dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceResponseMIMETypes = true;
result->setNull();
}

void DRTTestRunner::dumpWindowStatusChanges(const CppArgumentList&, CppVariant* result)
{
m_dumpWindowStatusChanges = true;
@@ -466,9 +445,6 @@ void DRTTestRunner::reset()
if (m_shell)
m_shell->webViewHost()->setDeviceScaleFactor(1);
m_dumpProgressFinishedCallback = false;
m_dumpResourceLoadCallbacks = false;
m_dumpResourceRequestCallbacks = false;
m_dumpResourceResponseMIMETypes = false;
m_dumpBackForwardList = false;
m_dumpWindowStatusChanges = false;
m_dumpSelectionRect = false;
@@ -84,21 +84,6 @@ class DRTTestRunner : public WebTestRunner::TestRunner {
// representation of the back/forward list. It ignores all arguments.
void dumpBackForwardList(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to dump a descriptive
// line for each resource load callback. It takes no arguments, and ignores
// any that may be present.
void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to print a line of
// descriptive text for each element that requested a resource. It takes no
// arguments, and ignores any that may be present.
void dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to dump the MIME type
// for each resource that was loaded. It takes no arguments, and ignores any
// that may be present.
void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to dump all calls
// to window.status().
// It takes no arguments, and ignores any that may be present.
@@ -243,11 +228,6 @@ class DRTTestRunner : public WebTestRunner::TestRunner {

bool shouldDumpProgressFinishedCallback() { return m_dumpProgressFinishedCallback; }
void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
void setShouldDumpResourceRequestCallbacks(bool value) { m_dumpResourceRequestCallbacks = value; }
bool shouldDumpResourceRequestCallbacks() { return m_dumpResourceRequestCallbacks; }
void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; }
bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; }
bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; }
bool shouldDumpSelectionRect() { return m_dumpSelectionRect; }
bool shouldDumpBackForwardList() { return m_dumpBackForwardList; }
@@ -349,18 +329,6 @@ class DRTTestRunner : public WebTestRunner::TestRunner {
// finished callback.
bool m_dumpProgressFinishedCallback;

// If true, the test_shell will output a descriptive line for each resource
// load callback.
bool m_dumpResourceLoadCallbacks;

// If true, the test_shell will output a descriptive line for each resource
// request callback.
bool m_dumpResourceRequestCallbacks;

// If true, the test_shell will output the MIME type for each resource that
// was loaded.
bool m_dumpResourceResponseMIMETypes;

// If true, the test_shell will produce a dump of the back forward list as
// well.
bool m_dumpBackForwardList;
@@ -34,11 +34,13 @@
#include "Platform/chromium/public/WebString.h"
#include "Platform/chromium/public/WebURL.h"
#include "Platform/chromium/public/WebVector.h"
#include <string>

namespace WebKit {
struct WebContextMenuData;
class WebGamepads;
class WebIntentRequest;
struct WebContextMenuData;
struct WebURLError;
}

namespace WebTestRunner {
@@ -74,6 +76,7 @@ class WebTestDelegate {
virtual void applyPreferences() { };
virtual void setCurrentWebIntentRequest(const WebKit::WebIntentRequest&) { };
virtual WebKit::WebIntentRequest* currentWebIntentRequest() { return 0; }
virtual std::string makeURLErrorDescription(const WebKit::WebURLError&) { return std::string(); }
};

}
@@ -38,9 +38,12 @@
#include "WebKit/chromium/public/WebNavigationPolicy.h"
#include "WebKit/chromium/public/WebTextAffinity.h"
#include "WebKit/chromium/public/WebTextDirection.h"
#include <map>
#include <string>

namespace WebKit {
class WebAccessibilityObject;
class WebCachedURLRequest;
class WebDragData;
class WebFrame;
class WebImage;
@@ -53,6 +56,7 @@ class WebSerializedScriptValue;
class WebString;
class WebURL;
class WebURLRequest;
class WebURLResponse;
class WebView;
struct WebPoint;
struct WebSize;
@@ -71,6 +75,8 @@ class WebTestProxyBase {
void setInterfaces(WebTestInterfaces*);
void setDelegate(WebTestDelegate*);

void reset();

void setPaintRect(const WebKit::WebRect&);
WebKit::WebRect paintRect() const;

@@ -116,12 +122,19 @@ class WebTestProxyBase {
void didDisplayInsecureContent(WebKit::WebFrame*);
void didRunInsecureContent(WebKit::WebFrame*, const WebKit::WebSecurityOrigin&, const WebKit::WebURL& insecureURL);
void didDetectXSS(WebKit::WebFrame*, const WebKit::WebURL& insecureURL, bool didBlockEntirePage);
void assignIdentifierToRequest(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&);
void willRequestResource(WebKit::WebFrame*, const WebKit::WebCachedURLRequest&);
void willSendRequest(WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, const WebKit::WebURLResponse& redirectResponse);
void didReceiveResponse(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLResponse&);
void didFinishResourceLoad(WebKit::WebFrame*, unsigned identifier);
void didFailResourceLoad(WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLError&);

private:
WebTestInterfaces* m_testInterfaces;
WebTestDelegate* m_delegate;

WebKit::WebRect m_paintRect;
std::map<unsigned, std::string> m_resourceIdentifierMap;
};

// Use this template to inject methods into your WebViewClient/WebFrameClient
@@ -329,6 +342,36 @@ class WebTestProxy : public Base, public WebTestProxyBase {
WebTestProxyBase::didDetectXSS(frame, insecureURL, didBlockEntirePage);
Base::didDetectXSS(frame, insecureURL, didBlockEntirePage);
}
virtual void assignIdentifierToRequest(WebKit::WebFrame* frame, unsigned identifier, const WebKit::WebURLRequest& request)
{
WebTestProxyBase::assignIdentifierToRequest(frame, identifier, request);
Base::assignIdentifierToRequest(frame, identifier, request);
}
virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebCachedURLRequest& request)
{
WebTestProxyBase::willRequestResource(frame, request);
Base::willRequestResource(frame, request);
}
virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, WebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse)
{
WebTestProxyBase::willSendRequest(frame, identifier, request, redirectResponse);
Base::willSendRequest(frame, identifier, request, redirectResponse);
}
virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier, const WebKit::WebURLResponse& response)
{
WebTestProxyBase::didReceiveResponse(frame, identifier, response);
Base::didReceiveResponse(frame, identifier, response);
}
virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identifier)
{
WebTestProxyBase::didFinishResourceLoad(frame, identifier);
Base::didFinishResourceLoad(frame, identifier);
}
virtual void didFailResourceLoad(WebKit::WebFrame* frame, unsigned identifier, const WebKit::WebURLError& error)
{
WebTestProxyBase::didFailResourceLoad(frame, identifier, error);
Base::didFailResourceLoad(frame, identifier, error);
}
};

}
@@ -58,6 +58,9 @@ class WebTestRunner {
virtual bool shouldDumpTitleChanges() const { return false; }
virtual bool shouldDumpCreateView() const { return false; }
virtual bool canOpenWindows() const { return false; }
virtual bool shouldDumpResourceLoadCallbacks() const { return false; }
virtual bool shouldDumpResourceRequestCallbacks() const { return false; }
virtual bool shouldDumpResourceResponseMIMETypes() const { return false; }
};

}
@@ -144,6 +144,9 @@ TestRunner::TestRunner()
bindMethod("dumpTitleChanges", &TestRunner::dumpTitleChanges);
bindMethod("dumpCreateView", &TestRunner::dumpCreateView);
bindMethod("setCanOpenWindows", &TestRunner::setCanOpenWindows);
bindMethod("dumpResourceLoadCallbacks", &TestRunner::dumpResourceLoadCallbacks);
bindMethod("dumpResourceRequestCallbacks", &TestRunner::dumpResourceRequestCallbacks);
bindMethod("dumpResourceResponseMIMETypes", &TestRunner::dumpResourceResponseMIMETypes);

// The following methods interact with the WebTestProxy.
bindMethod("sendWebIntentResponse", &TestRunner::sendWebIntentResponse);
@@ -220,6 +223,9 @@ void TestRunner::reset()
m_dumpTitleChanges = false;
m_dumpCreateView = false;
m_canOpenWindows = false;
m_dumpResourceLoadCallbacks = false;
m_dumpResourceRequestCallbacks = false;
m_dumpResourceResponseMIMETypes = false;

m_globalFlag.set(false);
m_platformName.set("chromium");
@@ -312,6 +318,21 @@ bool TestRunner::canOpenWindows() const
return m_canOpenWindows;
}

bool TestRunner::shouldDumpResourceLoadCallbacks() const
{
return m_testIsRunning && m_dumpResourceLoadCallbacks;
}

bool TestRunner::shouldDumpResourceRequestCallbacks() const
{
return m_testIsRunning && m_dumpResourceRequestCallbacks;
}

bool TestRunner::shouldDumpResourceResponseMIMETypes() const
{
return m_testIsRunning && m_dumpResourceResponseMIMETypes;
}

void TestRunner::setTabKeyCyclesThroughElements(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool())
@@ -1089,6 +1110,24 @@ void TestRunner::setCanOpenWindows(const CppArgumentList&, CppVariant* result)
result->setNull();
}

void TestRunner::dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceLoadCallbacks = true;
result->setNull();
}

void TestRunner::dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceRequestCallbacks = true;
result->setNull();
}

void TestRunner::dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant* result)
{
m_dumpResourceResponseMIMETypes = true;
result->setNull();
}

void TestRunner::workerThreadCount(CppVariant* result)
{
result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount()));
@@ -76,6 +76,9 @@ class TestRunner : public CppBoundClass, public WebTestRunner {
virtual bool shouldDumpTitleChanges() const OVERRIDE;
virtual bool shouldDumpCreateView() const OVERRIDE;
virtual bool canOpenWindows() const OVERRIDE;
virtual bool shouldDumpResourceLoadCallbacks() const OVERRIDE;
virtual bool shouldDumpResourceRequestCallbacks() const OVERRIDE;
virtual bool shouldDumpResourceResponseMIMETypes() const OVERRIDE;

protected:
// FIXME: make these private once the move from DRTTestRunner to TestRunner
@@ -241,6 +244,21 @@ class TestRunner : public CppBoundClass, public WebTestRunner {

void setCanOpenWindows(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to dump a descriptive
// line for each resource load callback. It takes no arguments, and ignores
// any that may be present.
void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to print a line of
// descriptive text for each element that requested a resource. It takes no
// arguments, and ignores any that may be present.
void dumpResourceRequestCallbacks(const CppArgumentList&, CppVariant*);

// This function sets a flag that tells the test_shell to dump the MIME type
// for each resource that was loaded. It takes no arguments, and ignores any
// that may be present.
void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*);

///////////////////////////////////////////////////////////////////////////
// Methods interacting with the WebTestProxy

@@ -331,6 +349,18 @@ class TestRunner : public CppBoundClass, public WebTestRunner {
// setCanOpenWindows().
bool m_canOpenWindows;

// If true, the test_shell will output a descriptive line for each resource
// load callback.
bool m_dumpResourceLoadCallbacks;

// If true, the test_shell will output a descriptive line for each resource
// request callback.
bool m_dumpResourceRequestCallbacks;

// If true, the test_shell will output the MIME type for each resource that
// was loaded.
bool m_dumpResourceResponseMIMETypes;

// WAV audio data is stored here.
WebKit::WebArrayBufferView m_audioData;

0 comments on commit 5c8fc0f

Please sign in to comment.