summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-18 13:59:13 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-18 13:59:28 +0200
commit4d6084feccab99c0a7b3ecef26bb49c41dd50201 (patch)
treefd1195897f551eee6d5a15d07ff5733b15aa2a5c /Tools/DumpRenderTree
parentae901828d4689ab9e89113f6b6ea8042b37a9fda (diff)
downloadqtwebkit-4d6084feccab99c0a7b3ecef26bb49c41dd50201.tar.gz
Imported WebKit commit ff52235a78888e5cb8e286a828a8698042200e67 (http://svn.webkit.org/repository/webkit/trunk@122948)
New snapshot that should fix the rendering issues recently introduced
Diffstat (limited to 'Tools/DumpRenderTree')
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp24
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.gypi32
-rw-r--r--Tools/DumpRenderTree/chromium/DumpRenderTree.cpp52
-rw-r--r--Tools/DumpRenderTree/chromium/TestEventPrinter.cpp129
-rw-r--r--Tools/DumpRenderTree/chromium/TestEventPrinter.h28
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp (renamed from Tools/DumpRenderTree/chromium/AccessibilityController.cpp)10
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h (renamed from Tools/DumpRenderTree/chromium/AccessibilityController.h)9
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp (renamed from Tools/DumpRenderTree/chromium/AccessibilityUIElement.cpp)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h (renamed from Tools/DumpRenderTree/chromium/AccessibilityUIElement.h)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp (renamed from Tools/DumpRenderTree/chromium/CppBoundClass.cpp)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.h (renamed from Tools/DumpRenderTree/chromium/CppBoundClass.h)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/CppVariant.cpp (renamed from Tools/DumpRenderTree/chromium/CppVariant.cpp)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/CppVariant.h (renamed from Tools/DumpRenderTree/chromium/CppVariant.h)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp (renamed from Tools/DumpRenderTree/chromium/GamepadController.cpp)4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h (renamed from Tools/DumpRenderTree/chromium/GamepadController.h)4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/Task.cpp (renamed from Tools/DumpRenderTree/chromium/Task.cpp)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/Task.h (renamed from Tools/DumpRenderTree/chromium/Task.h)0
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp57
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h54
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/TextInputController.cpp (renamed from Tools/DumpRenderTree/chromium/TextInputController.cpp)50
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/TextInputController.h (renamed from Tools/DumpRenderTree/chromium/TextInputController.h)14
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.cpp46
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.h15
-rw-r--r--Tools/DumpRenderTree/chromium/TestShellAndroid.cpp31
-rw-r--r--Tools/DumpRenderTree/efl/DumpRenderTree.cpp38
25 files changed, 315 insertions, 282 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
index 2f29f058c..4fc5468f2 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
+++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
@@ -75,11 +75,35 @@
],
},
{
+ 'target_name': 'TestRunner',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
+ '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
+ '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
+ ],
+ 'include_dirs': [
+ '<(chromium_src_dir)',
+ '<(source_dir)/WebKit/chromium/public',
+ '<(DEPTH)',
+ '../chromium/TestRunner',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../chromium/TestRunner',
+ ],
+ },
+ 'sources': [
+ '<@(test_runner_files)',
+ ],
+ },
+ {
'target_name': 'DumpRenderTree',
'type': 'executable',
'mac_bundle': 1,
'dependencies': [
'ImageDiff',
+ 'TestRunner',
'copy_TestNetscapePlugIn',
'<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources',
'<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi
index a414fd25a..61e6a138f 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gypi
+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi
@@ -1,14 +1,6 @@
{
'variables': {
'drt_files': [
- 'chromium/AccessibilityController.cpp',
- 'chromium/AccessibilityController.h',
- 'chromium/AccessibilityUIElement.cpp',
- 'chromium/AccessibilityUIElement.h',
- 'chromium/CppBoundClass.cpp',
- 'chromium/CppBoundClass.h',
- 'chromium/CppVariant.cpp',
- 'chromium/CppVariant.h',
'chromium/DRTDevToolsAgent.cpp',
'chromium/DRTDevToolsAgent.h',
'chromium/DRTDevToolsClient.cpp',
@@ -16,8 +8,6 @@
'chromium/DumpRenderTree.cpp',
'chromium/EventSender.cpp',
'chromium/EventSender.h',
- 'chromium/GamepadController.cpp',
- 'chromium/GamepadController.h',
'chromium/LayoutTestController.cpp',
'chromium/LayoutTestController.h',
'chromium/MockGrammarCheck.cpp',
@@ -32,8 +22,6 @@
'chromium/MockWebSpeechRecognizer.h',
'chromium/NotificationPresenter.h',
'chromium/NotificationPresenter.cpp',
- 'chromium/Task.h',
- 'chromium/Task.cpp',
'chromium/TestEventPrinter.h',
'chromium/TestEventPrinter.cpp',
'chromium/TestNavigationController.cpp',
@@ -48,8 +36,6 @@
'chromium/TestShellX11.cpp',
'chromium/TestWebPlugin.cpp',
'chromium/TestWebPlugin.h',
- 'chromium/TextInputController.cpp',
- 'chromium/TextInputController.h',
'chromium/WebPermissions.cpp',
'chromium/WebPermissions.h',
'chromium/WebPreferences.cpp',
@@ -65,6 +51,24 @@
'chromium/WebViewHost.cpp',
'chromium/WebViewHost.h',
],
+ 'test_runner_files': [
+ 'chromium/TestRunner/AccessibilityController.cpp',
+ 'chromium/TestRunner/AccessibilityController.h',
+ 'chromium/TestRunner/AccessibilityUIElement.cpp',
+ 'chromium/TestRunner/AccessibilityUIElement.h',
+ 'chromium/TestRunner/CppBoundClass.cpp',
+ 'chromium/TestRunner/CppBoundClass.h',
+ 'chromium/TestRunner/CppVariant.cpp',
+ 'chromium/TestRunner/CppVariant.h',
+ 'chromium/TestRunner/GamepadController.cpp',
+ 'chromium/TestRunner/GamepadController.h',
+ 'chromium/TestRunner/Task.cpp',
+ 'chromium/TestRunner/Task.h',
+ 'chromium/TestRunner/TestInterfaces.cpp',
+ 'chromium/TestRunner/TestInterfaces.h',
+ 'chromium/TestRunner/TextInputController.cpp',
+ 'chromium/TestRunner/TextInputController.h',
+ ],
'test_plugin_files': [
'TestNetscapePlugIn/PluginObject.cpp',
'TestNetscapePlugIn/PluginObject.h',
diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 7b1284d31..789aa877f 100644
--- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -47,8 +47,6 @@ static const char optionThreaded[] = "--threaded";
static const char optionDebugRenderTree[] = "--debug-render-tree";
static const char optionDebugLayerTree[] = "--debug-layer-tree";
-static const char optionPixelTestsWithName[] = "--pixel-tests=";
-static const char optionTestShell[] = "--test-shell";
static const char optionAllowExternalPages[] = "--allow-external-pages";
static const char optionStartupDialog[] = "--testshell-startup-dialog";
static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps";
@@ -66,6 +64,7 @@ static const char optionEnablePerTilePainting[] = "--enable-per-tile-painting";
static const char optionStressOpt[] = "--stress-opt";
static const char optionStressDeopt[] = "--stress-deopt";
static const char optionJavaScriptFlags[] = "--js-flags=";
+static const char optionEncodeBinary[] = "--encode-binary";
static const char optionNoTimeout[] = "--no-timeout";
static const char optionWebCoreLogChannels[] = "--webcore-log-channels=";
@@ -81,30 +80,15 @@ public:
}
};
-static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
+static void runTest(TestShell& shell, TestParams& params, const string& testName)
{
int oldTimeoutMsec = shell.layoutTestTimeout();
params.pixelHash = "";
string pathOrURL = testName;
- if (testShellMode) {
- string timeOut;
- string::size_type separatorPosition = pathOrURL.find(' ');
- if (separatorPosition != string::npos) {
- timeOut = pathOrURL.substr(separatorPosition + 1);
- pathOrURL.erase(separatorPosition);
- separatorPosition = timeOut.find_first_of(' ');
- if (separatorPosition != string::npos) {
- params.pixelHash = timeOut.substr(separatorPosition + 1);
- timeOut.erase(separatorPosition);
- }
- shell.setLayoutTestTimeout(atoi(timeOut.c_str()));
- }
- } else {
- string::size_type separatorPosition = pathOrURL.find("'");
- if (separatorPosition != string::npos) {
- params.pixelHash = pathOrURL.substr(separatorPosition + 1);
- pathOrURL.erase(separatorPosition);
- }
+ string::size_type separatorPosition = pathOrURL.find("'");
+ if (separatorPosition != string::npos) {
+ params.pixelHash = pathOrURL.substr(separatorPosition + 1);
+ pathOrURL.erase(separatorPosition);
}
params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL);
webkit_support::SetCurrentDirectoryForFileURL(params.testUrl);
@@ -136,7 +120,6 @@ int main(int argc, char* argv[])
TestParams params;
Vector<string> tests;
bool serverMode = false;
- bool testShellMode = false;
bool allowExternalPages = false;
bool startupDialog = false;
bool acceleratedCompositingForVideoEnabled = false;
@@ -150,6 +133,7 @@ int main(int argc, char* argv[])
bool stressDeopt = false;
bool hardwareAcceleratedGL = false;
string javaScriptFlags;
+ bool encodeBinary = false;
bool noTimeout = false;
for (int i = 1; i < argc; ++i) {
string argument(argv[i]);
@@ -159,17 +143,11 @@ int main(int argc, char* argv[])
params.dumpTree = false;
else if (argument == optionPixelTests)
params.dumpPixels = true;
- else if (!argument.find(optionPixelTestsWithName)) {
- params.dumpPixels = true;
- params.pixelFileName = argument.substr(strlen(optionPixelTestsWithName));
- } else if (argument == optionDebugRenderTree)
+ else if (argument == optionDebugRenderTree)
params.debugRenderTree = true;
else if (argument == optionDebugLayerTree)
params.debugLayerTree = true;
- else if (argument == optionTestShell) {
- testShellMode = true;
- serverMode = true;
- } else if (argument == optionAllowExternalPages)
+ else if (argument == optionAllowExternalPages)
allowExternalPages = true;
else if (argument == optionStartupDialog)
startupDialog = true;
@@ -205,6 +183,8 @@ int main(int argc, char* argv[])
stressDeopt = true;
else if (!argument.find(optionJavaScriptFlags))
javaScriptFlags = argument.substr(strlen(optionJavaScriptFlags));
+ else if (argument == optionEncodeBinary)
+ encodeBinary = true;
else if (argument == optionNoTimeout)
noTimeout = true;
else if (!argument.find(optionWebCoreLogChannels)) {
@@ -215,10 +195,6 @@ int main(int argc, char* argv[])
else
tests.append(argument);
}
- if (testShellMode && params.dumpPixels && params.pixelFileName.empty()) {
- fprintf(stderr, "--pixel-tests with --test-shell requires a file name.\n");
- return EXIT_FAILURE;
- }
if (stressOpt && stressDeopt) {
fprintf(stderr, "--stress-opt and --stress-deopt are mutually exclusive.\n");
return EXIT_FAILURE;
@@ -231,7 +207,6 @@ int main(int argc, char* argv[])
{ // Explicit scope for the TestShell instance.
TestShell shell;
- shell.setTestShellMode(testShellMode);
shell.setAllowExternalPages(allowExternalPages);
shell.setAcceleratedCompositingForVideoEnabled(acceleratedCompositingForVideoEnabled);
shell.setThreadedCompositingEnabled(threadedCompositingEnabled);
@@ -243,6 +218,7 @@ int main(int argc, char* argv[])
shell.setJavaScriptFlags(javaScriptFlags);
shell.setStressOpt(stressOpt);
shell.setStressDeopt(stressDeopt);
+ shell.setEncodeBinary(encodeBinary);
if (noTimeout) {
// 0x20000000ms is big enough for the purpose to avoid timeout in debugging.
shell.setLayoutTestTimeout(0x20000000);
@@ -265,14 +241,14 @@ int main(int argc, char* argv[])
// Explicitly quit on platforms where EOF is not reliable.
if (!strcmp(testString, "QUIT"))
break;
- runTest(shell, params, testString, testShellMode);
+ runTest(shell, params, testString);
}
} else if (!tests.size())
puts("#EOF");
else {
params.printSeparators = tests.size() > 1;
for (unsigned i = 0; i < tests.size(); i++)
- runTest(shell, params, tests[i], testShellMode);
+ runTest(shell, params, tests[i]);
}
shell.callJSGC();
diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp b/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp
index 730d76b27..b8aecf100 100644
--- a/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp
+++ b/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp
@@ -34,84 +34,53 @@
#include <stdio.h>
#include <stdlib.h>
#include <wtf/Assertions.h>
+#include <wtf/text/Base64.h>
-class DRTPrinter : public TestEventPrinter {
-public:
- DRTPrinter() { }
- void handleTestHeader(const char* url) const;
- void handleTimedOut() const;
- void handleTextHeader() const;
- void handleTextFooter() const;
- void handleAudioHeader() const;
- void handleAudioFooter() const;
- void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
- void handleImageFooter() const;
- void handleTestFooter(bool dumpedAnything) const;
-};
-
-class TestShellPrinter : public TestEventPrinter {
-public:
- TestShellPrinter() { }
- void handleTestHeader(const char* url) const;
- void handleTimedOut() const;
- void handleTextHeader() const;
- void handleTextFooter() const;
- void handleAudioHeader() const;
- void handleAudioFooter() const;
- void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
- void handleImageFooter() const;
- void handleTestFooter(bool dumpedAnything) const;
-};
-
-TestEventPrinter::~TestEventPrinter()
+TestEventPrinter::TestEventPrinter()
+ : m_encodeBinary(false)
{
}
-PassOwnPtr<TestEventPrinter> TestEventPrinter::createDRTPrinter()
-{
- return adoptPtr(new DRTPrinter);
-}
-
-PassOwnPtr<TestEventPrinter> TestEventPrinter::createTestShellPrinter()
+TestEventPrinter::~TestEventPrinter()
{
- return adoptPtr(new TestShellPrinter);
}
// ----------------------------------------------------------------
-void DRTPrinter::handleTestHeader(const char*) const
+void TestEventPrinter::handleTestHeader(const char*) const
{
}
-void DRTPrinter::handleTimedOut() const
+void TestEventPrinter::handleTimedOut() const
{
fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n");
fprintf(stdout, "FAIL: Timed out waiting for notifyDone to be called\n");
}
-void DRTPrinter::handleTextHeader() const
+void TestEventPrinter::handleTextHeader() const
{
printf("Content-Type: text/plain\n");
}
-void DRTPrinter::handleTextFooter() const
+void TestEventPrinter::handleTextFooter() const
{
printf("#EOF\n");
fprintf(stderr, "#EOF\n");
}
-void DRTPrinter::handleAudioHeader() const
+void TestEventPrinter::handleAudio(const void* audioData, size_t audioSize) const
{
printf("Content-Type: audio/wav\n");
+ handleBinary(audioData, audioSize);
}
-void DRTPrinter::handleAudioFooter() const
+void TestEventPrinter::handleAudioFooter() const
{
printf("#EOF\n");
fprintf(stderr, "#EOF\n");
}
-void DRTPrinter::handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char*) const
+void TestEventPrinter::handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const
{
ASSERT(actualHash);
printf("\nActualHash: %s\n", actualHash);
@@ -119,72 +88,28 @@ void DRTPrinter::handleImage(const char* actualHash, const char* expectedHash, c
printf("\nExpectedHash: %s\n", expectedHash);
if (imageData && imageSize) {
printf("Content-Type: image/png\n");
- // Printf formatting for size_t on 32-bit, 64-bit, and on Windows is hard so just cast to an int.
- printf("Content-Length: %d\n", static_cast<int>(imageSize));
- if (fwrite(imageData, 1, imageSize, stdout) != imageSize) {
- fprintf(stderr, "Short write to stdout.\n");
- exit(1);
- }
+ handleBinary(imageData, imageSize);
}
}
-void DRTPrinter::handleTestFooter(bool) const
+void TestEventPrinter::handleTestFooter(bool) const
{
printf("#EOF\n");
}
-// ----------------------------------------------------------------
-
-void TestShellPrinter::handleTestHeader(const char* url) const
-{
- printf("#URL:%s\n", url);
-}
-
-void TestShellPrinter::handleTimedOut() const
-{
- puts("#TEST_TIMED_OUT\n");
-}
-
-void TestShellPrinter::handleTextHeader() const
-{
-}
-
-void TestShellPrinter::handleTextFooter() const
+void TestEventPrinter::handleBinary(const void* data, size_t size) const
{
-}
-
-void TestShellPrinter::handleAudioHeader() const
-{
- printf("Content-Type: audio/wav\n");
-}
-
-void TestShellPrinter::handleAudioFooter() const
-{
- printf("\n");
-}
-
-void TestShellPrinter::handleImage(const char* actualHash, const char*, const unsigned char* imageData, size_t imageSize, const char* fileName) const
-{
- ASSERT(actualHash);
- if (imageData && imageSize) {
- ASSERT(fileName);
- FILE* fp = fopen(fileName, "wb");
- if (!fp) {
- perror(fileName);
- exit(EXIT_FAILURE);
- }
- if (fwrite(imageData, 1, imageSize, fp) != imageSize) {
- perror(fileName);
- fclose(fp);
- exit(EXIT_FAILURE);
- }
- fclose(fp);
+ Vector<char> base64;
+ if (m_encodeBinary) {
+ base64Encode(static_cast<const char*>(data), size, base64, Base64InsertLFs);
+ data = base64.data();
+ size = base64.size();
+ printf("Content-Transfer-Encoding: base64\n");
+ }
+ // Printf formatting for size_t on 32-bit, 64-bit, and on Windows is hard so just cast to an int.
+ printf("Content-Length: %d\n", static_cast<int>(size));
+ if (fwrite(data, 1, size, stdout) != size) {
+ fprintf(stderr, "Short write to stdout.\n");
+ exit(1);
}
- printf("#MD5:%s\n", actualHash);
-}
-
-void TestShellPrinter::handleTestFooter(bool dumpedAnything) const
-{
- if (dumpedAnything)
- printf("#EOF\n");
}
diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.h b/Tools/DumpRenderTree/chromium/TestEventPrinter.h
index 374827e18..c1a7e2dcd 100644
--- a/Tools/DumpRenderTree/chromium/TestEventPrinter.h
+++ b/Tools/DumpRenderTree/chromium/TestEventPrinter.h
@@ -35,18 +35,24 @@
class TestEventPrinter {
public:
- static PassOwnPtr<TestEventPrinter> createDRTPrinter();
- static PassOwnPtr<TestEventPrinter> createTestShellPrinter();
+ TestEventPrinter();
+ ~TestEventPrinter();
+ void handleTestHeader(const char* url) const;
+ void handleTimedOut() const;
+ void handleTextHeader() const;
+ void handleTextFooter() const;
+ void handleAudio(const void* audioData, size_t audioSize) const;
+ void handleAudioFooter() const;
+ void handleImage(const char* actualHash, const char* expectedHash, const void* imageData, size_t imageSize) const;
+ void handleTestFooter(bool dumpedAnything) const;
- virtual ~TestEventPrinter();
- virtual void handleTestHeader(const char* url) const = 0;
- virtual void handleTimedOut() const = 0;
- virtual void handleTextHeader() const = 0;
- virtual void handleTextFooter() const = 0;
- virtual void handleAudioHeader() const = 0;
- virtual void handleAudioFooter() const = 0;
- virtual void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const = 0;
- virtual void handleTestFooter(bool dumpedAnything) const = 0;
+ // Set if binary output data should be encoded in base64. Default is off.
+ void setEncodeBinary(bool encodeBinary) { m_encodeBinary = encodeBinary; }
+
+private:
+ void handleBinary(const void* data, size_t) const;
+
+ bool m_encodeBinary;
};
#endif // TestEventPrinter_h
diff --git a/Tools/DumpRenderTree/chromium/AccessibilityController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp
index 860a747aa..c6e4404c2 100644
--- a/Tools/DumpRenderTree/chromium/AccessibilityController.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp
@@ -31,17 +31,15 @@
#include "config.h"
#include "AccessibilityController.h"
-#include "TestShell.h"
#include "WebAccessibilityObject.h"
#include "WebFrame.h"
-#include "platform/WebString.h"
#include "WebView.h"
+#include "platform/WebString.h"
using namespace WebKit;
-AccessibilityController::AccessibilityController(TestShell* shell)
+AccessibilityController::AccessibilityController()
: m_logAccessibilityEvents(false)
- , m_shell(shell)
{
bindMethod("logAccessibilityEvents", &AccessibilityController::logAccessibilityEventsCallback);
@@ -77,14 +75,14 @@ void AccessibilityController::setFocusedElement(const WebAccessibilityObject& fo
AccessibilityUIElement* AccessibilityController::getFocusedElement()
{
if (m_focusedElement.isNull())
- m_focusedElement = m_shell->webView()->accessibilityObject();
+ m_focusedElement = m_webView->accessibilityObject();
return m_elements.getOrCreate(m_focusedElement);
}
AccessibilityUIElement* AccessibilityController::getRootElement()
{
if (m_rootElement.isNull())
- m_rootElement = m_shell->webView()->accessibilityObject();
+ m_rootElement = m_webView->accessibilityObject();
return m_elements.createRoot(m_rootElement);
}
diff --git a/Tools/DumpRenderTree/chromium/AccessibilityController.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h
index 954edb9ca..967259536 100644
--- a/Tools/DumpRenderTree/chromium/AccessibilityController.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h
@@ -37,13 +37,12 @@
namespace WebKit {
class WebAccessibilityObject;
class WebFrame;
+class WebView;
}
-class TestShell;
-
class AccessibilityController : public CppBoundClass {
public:
- explicit AccessibilityController(TestShell*);
+ AccessibilityController();
// Shadow to include accessibility initialization.
void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname);
@@ -57,6 +56,8 @@ public:
void notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName);
+ void setWebView(WebKit::WebView* webView) { m_webView = webView; }
+
private:
// If true, will log all accessibility notifications.
bool m_logAccessibilityEvents;
@@ -77,7 +78,7 @@ private:
std::vector<CppVariant> m_notificationCallbacks;
- TestShell* m_shell;
+ WebKit::WebView* m_webView;
};
#endif // AccessibilityController_h
diff --git a/Tools/DumpRenderTree/chromium/AccessibilityUIElement.cpp b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp
index 583806585..583806585 100644
--- a/Tools/DumpRenderTree/chromium/AccessibilityUIElement.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp
diff --git a/Tools/DumpRenderTree/chromium/AccessibilityUIElement.h b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h
index 8ae6d412f..8ae6d412f 100644
--- a/Tools/DumpRenderTree/chromium/AccessibilityUIElement.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h
diff --git a/Tools/DumpRenderTree/chromium/CppBoundClass.cpp b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp
index 9b4a3b646..9b4a3b646 100644
--- a/Tools/DumpRenderTree/chromium/CppBoundClass.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.cpp
diff --git a/Tools/DumpRenderTree/chromium/CppBoundClass.h b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.h
index 4fb5361e1..4fb5361e1 100644
--- a/Tools/DumpRenderTree/chromium/CppBoundClass.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/CppBoundClass.h
diff --git a/Tools/DumpRenderTree/chromium/CppVariant.cpp b/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.cpp
index b587d75aa..b587d75aa 100644
--- a/Tools/DumpRenderTree/chromium/CppVariant.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.cpp
diff --git a/Tools/DumpRenderTree/chromium/CppVariant.h b/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.h
index 60cc6271e..60cc6271e 100644
--- a/Tools/DumpRenderTree/chromium/CppVariant.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/CppVariant.h
diff --git a/Tools/DumpRenderTree/chromium/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp
index b38dfa0c5..cdf1befc3 100644
--- a/Tools/DumpRenderTree/chromium/GamepadController.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp
@@ -31,11 +31,9 @@
#include "config.h"
#include "GamepadController.h"
-#include "TestShell.h"
-
using namespace WebKit;
-GamepadController::GamepadController(TestShell*)
+GamepadController::GamepadController()
{
bindMethod("connect", &GamepadController::connect);
bindMethod("disconnect", &GamepadController::disconnect);
diff --git a/Tools/DumpRenderTree/chromium/GamepadController.h b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h
index 5a6f40d5d..8cf4cb824 100644
--- a/Tools/DumpRenderTree/chromium/GamepadController.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h
@@ -39,11 +39,9 @@ class WebGamepads;
class WebFrame;
}
-class TestShell;
-
class GamepadController : public CppBoundClass {
public:
- explicit GamepadController(TestShell*);
+ GamepadController();
void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname);
void reset();
diff --git a/Tools/DumpRenderTree/chromium/Task.cpp b/Tools/DumpRenderTree/chromium/TestRunner/Task.cpp
index d80beef34..d80beef34 100644
--- a/Tools/DumpRenderTree/chromium/Task.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/Task.cpp
diff --git a/Tools/DumpRenderTree/chromium/Task.h b/Tools/DumpRenderTree/chromium/TestRunner/Task.h
index 0b32c472b..0b32c472b 100644
--- a/Tools/DumpRenderTree/chromium/Task.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/Task.h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp
new file mode 100644
index 000000000..5cfb2c2f8
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TestInterfaces.h"
+
+#include "GamepadController.h"
+#include "platform/WebString.h"
+
+using WebKit::WebFrame;
+using WebKit::WebString;
+
+TestInterfaces::TestInterfaces()
+{
+ m_gamepadController = adoptPtr(new GamepadController());
+}
+
+TestInterfaces::~TestInterfaces()
+{
+}
+
+void TestInterfaces::bindTo(WebFrame* frame)
+{
+ m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
+}
+
+void TestInterfaces::resetAll()
+{
+ m_gamepadController->reset();
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h
new file mode 100644
index 000000000..e2404ad6d
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TestInterfaces_h
+#define TestInterfaces_h
+
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+class WebFrame;
+}
+
+class GamepadController;
+
+class TestInterfaces {
+public:
+ TestInterfaces();
+ ~TestInterfaces();
+
+ void bindTo(WebKit::WebFrame*);
+ void resetAll();
+
+private:
+ OwnPtr<GamepadController> m_gamepadController;
+};
+
+#endif // TestInterfaces_h
diff --git a/Tools/DumpRenderTree/chromium/TextInputController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.cpp
index a3637067a..b72a2080d 100644
--- a/Tools/DumpRenderTree/chromium/TextInputController.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.cpp
@@ -31,28 +31,21 @@
#include "config.h"
#include "TextInputController.h"
-#include "TestShell.h"
#include "WebBindings.h"
#include "WebCompositionUnderline.h"
#include "WebFrame.h"
+#include "WebInputEvent.h"
#include "WebRange.h"
+#include "WebView.h"
#include "platform/WebString.h"
#include "platform/WebVector.h"
-#include "WebView.h"
#include <string>
#include <wtf/StringExtras.h>
using namespace WebKit;
-TestShell* TextInputController::testShell = 0;
-
-TextInputController::TextInputController(TestShell* shell)
+TextInputController::TextInputController()
{
- // Set static testShell variable. Be careful not to assign testShell to new
- // windows which are temporary.
- if (!testShell)
- testShell = shell;
-
bindMethod("attributedSubstringFromRange", &TextInputController::attributedSubstringFromRange);
bindMethod("characterIndexForPoint", &TextInputController::characterIndexForPoint);
bindMethod("conversationIdentifier", &TextInputController::conversationIdentifier);
@@ -70,11 +63,6 @@ TextInputController::TextInputController(TestShell* shell)
bindMethod("setComposition", &TextInputController::setComposition);
}
-WebFrame* TextInputController::getMainFrame()
-{
- return testShell->webView()->mainFrame();
-}
-
void TextInputController::insertText(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -82,14 +70,14 @@ void TextInputController::insertText(const CppArgumentList& arguments, CppVarian
if (arguments.size() < 1 || !arguments[0].isString())
return;
- testShell->webView()->confirmComposition(WebString::fromUTF8(arguments[0].toString()));
+ m_webView->confirmComposition(WebString::fromUTF8(arguments[0].toString()));
}
void TextInputController::doCommand(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
- WebFrame* mainFrame = getMainFrame();
+ WebFrame* mainFrame = m_webView->mainFrame();
if (!mainFrame)
return;
@@ -104,10 +92,10 @@ void TextInputController::setMarkedText(const CppArgumentList& arguments, CppVar
if (arguments.size() >= 3 && arguments[0].isString()
&& arguments[1].isNumber() && arguments[2].isNumber()) {
WebVector<WebCompositionUnderline> underlines;
- testShell->webView()->setComposition(WebString::fromUTF8(arguments[0].toString()),
- underlines,
- arguments[1].toInt32(),
- arguments[1].toInt32() + arguments[2].toInt32());
+ m_webView->setComposition(WebString::fromUTF8(arguments[0].toString()),
+ underlines,
+ arguments[1].toInt32(),
+ arguments[1].toInt32() + arguments[2].toInt32());
}
}
@@ -115,14 +103,14 @@ void TextInputController::unmarkText(const CppArgumentList&, CppVariant* result)
{
result->setNull();
- testShell->webView()->confirmComposition();
+ m_webView->confirmComposition();
}
void TextInputController::hasMarkedText(const CppArgumentList&, CppVariant* result)
{
result->setNull();
- WebFrame* mainFrame = getMainFrame();
+ WebFrame* mainFrame = m_webView->mainFrame();
if (!mainFrame)
return;
@@ -151,7 +139,7 @@ void TextInputController::markedRange(const CppArgumentList&, CppVariant* result
{
result->setNull();
- WebFrame* mainFrame = getMainFrame();
+ WebFrame* mainFrame = m_webView->mainFrame();
if (!mainFrame)
return;
@@ -166,7 +154,7 @@ void TextInputController::selectedRange(const CppArgumentList&, CppVariant* resu
{
result->setNull();
- WebFrame* mainFrame = getMainFrame();
+ WebFrame* mainFrame = m_webView->mainFrame();
if (!mainFrame)
return;
@@ -181,7 +169,7 @@ void TextInputController::firstRectForCharacterRange(const CppArgumentList& argu
{
result->setNull();
- WebFrame* frame = testShell->webView()->focusedFrame();
+ WebFrame* frame = m_webView->focusedFrame();
if (!frame)
return;
@@ -210,7 +198,7 @@ void TextInputController::validAttributesForMarkedText(const CppArgumentList&, C
{
result->setNull();
- WebFrame* mainFrame = getMainFrame();
+ WebFrame* mainFrame = m_webView->mainFrame();
if (!mainFrame)
return;
@@ -228,10 +216,6 @@ void TextInputController::setComposition(const CppArgumentList& arguments, CppVa
{
result->setNull();
- WebView* view = getMainFrame() ? getMainFrame()->view() : 0;
- if (!view)
- return;
-
if (arguments.size() < 1)
return;
@@ -241,9 +225,9 @@ void TextInputController::setComposition(const CppArgumentList& arguments, CppVa
keyDown.modifiers = 0;
keyDown.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
keyDown.setKeyIdentifierFromWindowsKeyCode();
- view->handleInputEvent(keyDown);
+ m_webView->handleInputEvent(keyDown);
WebVector<WebCompositionUnderline> underlines;
WebString text(WebString::fromUTF8(arguments[0].toString()));
- view->setComposition(text, underlines, 0, text.length());
+ m_webView->setComposition(text, underlines, 0, text.length());
}
diff --git a/Tools/DumpRenderTree/chromium/TextInputController.h b/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.h
index 3a3907fda..a959aa8b3 100644
--- a/Tools/DumpRenderTree/chromium/TextInputController.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/TextInputController.h
@@ -37,15 +37,15 @@
#include "CppBoundClass.h"
-class TestShell;
-
namespace WebKit {
-class WebFrame;
+class WebView;
}
class TextInputController : public CppBoundClass {
public:
- TextInputController(TestShell*);
+ TextInputController();
+
+ void setWebView(WebKit::WebView* webView) { m_webView = webView; }
void insertText(const CppArgumentList&, CppVariant*);
void doCommand(const CppArgumentList&, CppVariant*);
@@ -64,11 +64,7 @@ public:
void setComposition(const CppArgumentList&, CppVariant*);
private:
- // Returns the test shell's main WebFrame.
- static WebKit::WebFrame* getMainFrame();
-
- // Non-owning pointer. The TextInputController is owned by the TestShell.
- static TestShell* testShell;
+ WebKit::WebView* m_webView;
};
#endif // TextInputController_h
diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp
index 46bde2a90..b4142eacf 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp
@@ -105,7 +105,6 @@ TestShell::TestShell()
: m_testIsPending(false)
, m_testIsPreparing(false)
, m_focusedWidget(0)
- , m_testShellMode(false)
, m_devTools(0)
, m_allowExternalPages(false)
, m_acceleratedCompositingForVideoEnabled(false)
@@ -146,16 +145,14 @@ TestShell::TestShell()
void TestShell::initialize()
{
m_webPermissions = adoptPtr(new WebPermissions(this));
- m_accessibilityController = adoptPtr(new AccessibilityController(this));
- m_gamepadController = adoptPtr(new GamepadController(this));
-
+ m_accessibilityController = adoptPtr(new AccessibilityController());
+ m_testInterfaces = adoptPtr(new TestInterfaces());
m_layoutTestController = adoptPtr(new LayoutTestController(this));
m_eventSender = adoptPtr(new EventSender(this));
- m_textInputController = adoptPtr(new TextInputController(this));
+ m_textInputController = adoptPtr(new TextInputController());
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
m_notificationPresenter = adoptPtr(new NotificationPresenter(this));
#endif
- m_printer = m_testShellMode ? TestEventPrinter::createTestShellPrinter() : TestEventPrinter::createDRTPrinter();
#if ENABLE(LINK_PRERENDER)
m_prerenderingSupport = adoptPtr(new MockWebPrerenderingSupport());
#endif
@@ -176,15 +173,15 @@ void TestShell::createMainWindow()
m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent);
m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get()));
m_webView = m_webViewHost->webView();
+ m_accessibilityController->setWebView(m_webView);
+ m_textInputController->setWebView(m_webView);
m_drtDevToolsAgent->setWebView(m_webView);
}
TestShell::~TestShell()
{
- // Note: DevTools are closed together with all the other windows in the
- // windows list.
-
- // Destroy the WebView before its WebViewHost.
+ m_accessibilityController->setWebView(0);
+ m_textInputController->setWebView(0);
m_drtDevToolsAgent->setWebView(0);
}
@@ -266,7 +263,7 @@ void TestShell::runFileTest(const TestParams& params)
m_layoutTestController->setShowDebugLayerTree(true);
if (m_dumpWhenFinished)
- m_printer->handleTestHeader(testUrl.c_str());
+ m_printer.handleTestHeader(testUrl.c_str());
loadURL(m_params.testUrl);
m_testIsPreparing = false;
@@ -296,7 +293,7 @@ void TestShell::resetTestController()
resetWebSettings(*webView());
m_webPermissions->reset();
m_accessibilityController->reset();
- m_gamepadController->reset();
+ m_testInterfaces->resetAll();
m_layoutTestController->reset();
m_eventSender->reset();
m_webViewHost->reset();
@@ -374,7 +371,7 @@ void TestShell::testFinished()
void TestShell::testTimedOut()
{
- m_printer->handleTimedOut();
+ m_printer.handleTimedOut();
testFinished();
}
@@ -562,15 +559,10 @@ void TestShell::dump()
bool dumpedAnything = false;
if (shouldDumpAsAudio) {
- m_printer->handleAudioHeader();
-
const WebKit::WebArrayBufferView& webArrayBufferView = m_layoutTestController->audioData();
- printf("Content-Length: %d\n", webArrayBufferView.byteLength());
-
- if (fwrite(webArrayBufferView.baseAddress(), 1, webArrayBufferView.byteLength(), stdout) != webArrayBufferView.byteLength())
- FATAL("Short write to stdout, disk full?\n");
- m_printer->handleAudioFooter();
- m_printer->handleTestFooter(true);
+ m_printer.handleAudio(webArrayBufferView.baseAddress(), webArrayBufferView.byteLength());
+ m_printer.handleAudioFooter();
+ m_printer.handleTestFooter(true);
fflush(stdout);
fflush(stderr);
@@ -579,7 +571,7 @@ void TestShell::dump()
if (m_params.dumpTree) {
dumpedAnything = true;
- m_printer->handleTextHeader();
+ m_printer.handleTextHeader();
// Text output: the test page can request different types of output
// which we handle here.
if (!shouldDumpAsText) {
@@ -609,7 +601,7 @@ void TestShell::dump()
printf("%s", dumpAllBackForwardLists().c_str());
}
if (dumpedAnything && m_params.printSeparators)
- m_printer->handleTextFooter();
+ m_printer.handleTextFooter();
if (m_params.dumpPixels && shouldGeneratePixelResults) {
// Image output: we write the image data to the file given on the
@@ -654,7 +646,7 @@ void TestShell::dump()
dumpImage(m_webViewHost->canvas());
}
- m_printer->handleTestFooter(dumpedAnything);
+ m_printer.handleTestFooter(dumpedAnything);
fflush(stdout);
fflush(stderr);
}
@@ -721,16 +713,16 @@ void TestShell::dumpImage(SkCanvas* canvas) const
sourceBitmap.height(), static_cast<int>(sourceBitmap.rowBytes()), discardTransparency, md5hash, &png);
#endif
- m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size(), m_params.pixelFileName.c_str());
+ m_printer.handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), &png[0], png.size());
} else
- m_printer->handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), 0, 0, m_params.pixelFileName.c_str());
+ m_printer.handleImage(md5hash.c_str(), m_params.pixelHash.c_str(), 0, 0);
}
void TestShell::bindJSObjectsToWindow(WebFrame* frame)
{
WebTestingSupport::injectInternalsObject(frame);
m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController"));
- m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
+ m_testInterfaces->bindTo(frame);
m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController"));
m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("testRunner"));
m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender"));
diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h
index 8ae0c2421..7ea579056 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.h
+++ b/Tools/DumpRenderTree/chromium/TestShell.h
@@ -37,6 +37,7 @@
#include "LayoutTestController.h"
#include "NotificationPresenter.h"
#include "TestEventPrinter.h"
+#include "TestInterfaces.h"
#include "TextInputController.h"
#include "WebPreferences.h"
#include "WebViewHost.h"
@@ -69,8 +70,6 @@ struct TestParams {
bool debugLayerTree;
bool printSeparators;
WebKit::WebURL testUrl;
- // Resultant image file name. Required only if the test_shell mode.
- std::string pixelFileName;
std::string pixelHash;
TestParams()
@@ -95,11 +94,10 @@ public:
LayoutTestController* layoutTestController() const { return m_layoutTestController.get(); }
EventSender* eventSender() const { return m_eventSender.get(); }
AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); }
- GamepadController* gamepadController() const { return m_gamepadController.get(); }
#if ENABLE(NOTIFICATIONS)
NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); }
#endif
- TestEventPrinter* printer() const { return m_printer.get(); }
+ const TestEventPrinter* printer() const { return &m_printer; }
WebPreferences* preferences() { return &m_prefs; }
void applyPreferences() { m_prefs.applyTo(m_webView); }
@@ -135,7 +133,6 @@ public:
bool allowExternalPages() const { return m_allowExternalPages; }
void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; }
- void setTestShellMode(bool testShellMode) { m_testShellMode = testShellMode; }
void setAcceleratedCompositingForVideoEnabled(bool enabled) { m_acceleratedCompositingForVideoEnabled = enabled; }
void setThreadedCompositingEnabled(bool enabled) { m_threadedCompositingEnabled = enabled; }
void setForceCompositingMode(bool enabled) { m_forceCompositingMode = enabled; }
@@ -170,6 +167,9 @@ public:
void setIsDisplayingModalDialog(bool isDisplayingModalDialog) { m_isDisplayingModalDialog = isDisplayingModalDialog; }
bool isDisplayingModalDialog() const { return m_isDisplayingModalDialog; }
+ // Set whether the binary data output should be encoded in base64 text.
+ void setEncodeBinary(bool encodeBinary) { m_printer.setEncodeBinary(encodeBinary); }
+
WebViewHost* createNewWindow(const WebKit::WebURL&);
void closeWindow(WebViewHost*);
void closeRemainingWindows();
@@ -207,16 +207,15 @@ private:
bool m_isLoading;
WebKit::WebView* m_webView;
WebKit::WebWidget* m_focusedWidget;
- bool m_testShellMode;
WebViewHost* m_devTools;
// Be careful of the destruction order of the following objects.
- OwnPtr<TestEventPrinter> m_printer;
+ TestEventPrinter m_printer;
OwnPtr<WebPermissions> m_webPermissions;
OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent;
OwnPtr<DRTDevToolsClient> m_drtDevToolsClient;
OwnPtr<AccessibilityController> m_accessibilityController;
- OwnPtr<GamepadController> m_gamepadController;
+ OwnPtr<TestInterfaces> m_testInterfaces;
OwnPtr<EventSender> m_eventSender;
OwnPtr<LayoutTestController> m_layoutTestController;
OwnPtr<TextInputController> m_textInputController;
diff --git a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp
index bc0acaad9..5f04fff5b 100644
--- a/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp
@@ -50,7 +50,7 @@ const char fontsDir[] = "/data/drt/fonts/";
const char optionInFIFO[] = "--in-fifo=";
const char optionOutFIFO[] = "--out-fifo=";
-const char optionErrFile[] = "--err-file=";
+const char optionErrFIFO[] = "--err-fifo=";
void androidLogError(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
@@ -78,18 +78,7 @@ void createFIFO(const char* fifoPath)
}
}
-void createFile(const char* filePath)
-{
- unlink(filePath);
- int fd = creat(filePath, 0600);
- if (fd < 0) {
- androidLogError("Failed to create file %s: %s\n", filePath, strerror(errno));
- exit(EXIT_FAILURE);
- }
- close(fd);
-}
-
-void redirectToFile(FILE* stream, const char* path, const char* mode)
+void redirect(FILE* stream, const char* path, const char* mode)
{
if (!freopen(path, mode, stream)) {
androidLogError("Failed to redirect stream to file: %s: %s\n", path, strerror(errno));
@@ -106,7 +95,7 @@ void platformInit(int* argc, char*** argv)
const char* inFIFO = 0;
const char* outFIFO = 0;
- const char* errFile = 0;
+ const char* errFIFO = 0;
for (int i = 1; i < *argc; ) {
const char* argument = (*argv)[i];
if (strstr(argument, optionInFIFO) == argument) {
@@ -117,9 +106,9 @@ void platformInit(int* argc, char*** argv)
outFIFO = argument + WTF_ARRAY_LENGTH(optionOutFIFO) - 1;
createFIFO(outFIFO);
removeArg(i, argc, argv);
- } else if (strstr(argument, optionErrFile) == argument) {
- errFile = argument + WTF_ARRAY_LENGTH(optionErrFile) - 1;
- createFile(errFile);
+ } else if (strstr(argument, optionErrFIFO) == argument) {
+ errFIFO = argument + WTF_ARRAY_LENGTH(optionErrFIFO) - 1;
+ createFIFO(errFIFO);
removeArg(i, argc, argv);
} else
++i;
@@ -127,11 +116,11 @@ void platformInit(int* argc, char*** argv)
// The order of createFIFO() and redirectToFIFO() is important to avoid deadlock.
if (outFIFO)
- redirectToFile(stdout, outFIFO, "w");
+ redirect(stdout, outFIFO, "w");
if (inFIFO)
- redirectToFile(stdin, inFIFO, "r");
- if (errFile)
- redirectToFile(stderr, errFile, "w");
+ redirect(stdin, inFIFO, "r");
+ if (errFIFO)
+ redirect(stderr, errFIFO, "w");
else {
// Redirect stderr to stdout.
dup2(1, 2);
diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
index aace475b5..ee26356ac 100644
--- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
@@ -50,6 +50,7 @@
#include <unistd.h>
#include <wtf/OwnPtr.h>
#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
OwnPtr<DumpRenderTreeChrome> browser;
Evas_Object* topLoadingFrame = 0;
@@ -101,9 +102,40 @@ static String dumpFramesAsText(Evas_Object* frame)
return result;
}
-static void dumpFrameScrollPosition(Evas_Object*)
+static void dumpFrameScrollPosition(Evas_Object* frame)
{
- notImplemented();
+ int x, y;
+ ewk_frame_scroll_pos_get(frame, &x, &y);
+ if (abs(x) > 0 || abs(y) > 0) {
+ StringBuilder result;
+
+ Evas_Object* parent = evas_object_smart_parent_get(frame);
+
+ // smart parent of main frame is view object.
+ if (parent != browser->mainView()) {
+ result.append("frame '");
+ result.append(ewk_frame_name_get(frame));
+ result.append("' ");
+ }
+
+ result.append("scrolled to ");
+ result.append(WTF::String::number(x));
+ result.append(",");
+ result.append(WTF::String::number(y));
+ result.append("\n");
+
+ printf("%s", result.toString().utf8().data());
+ }
+
+ if (gLayoutTestController->dumpChildFrameScrollPositions()) {
+ Eina_List* children = DumpRenderTreeSupportEfl::frameChildren(frame);
+ void* iterator;
+
+ EINA_LIST_FREE(children, iterator) {
+ Evas_Object* currentFrame = static_cast<Evas_Object*>(iterator);
+ dumpFrameScrollPosition(currentFrame);
+ }
+ }
}
static bool shouldLogFrameLoadDelegates(const String& pathOrURL)
@@ -306,7 +338,7 @@ static void dumpFrameContentsAsText(Evas_Object* frame)
static bool shouldDumpFrameScrollPosition()
{
- return gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive();
+ return !gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive();
}
static bool shouldDumpPixelsAndCompareWithExpected()