summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp')
-rw-r--r--Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp51
1 files changed, 32 insertions, 19 deletions
diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
index 00321ac9b..ebc5c396b 100644
--- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
@@ -77,6 +77,7 @@ RefPtr<TestRunner> gTestRunner;
WebCore::Frame* mainFrame = 0;
WebCore::Frame* topLoadingFrame = 0;
bool waitForPolicy = false;
+bool runFromCommandLine = false;
// FIXME: Assuming LayoutTests has been copied to /developer/LayoutTests/
static const char* const kSDCLayoutTestsURI = "file:///developer/LayoutTests/";
@@ -176,20 +177,21 @@ DumpRenderTree::~DumpRenderTree()
void DumpRenderTree::runTest(const String& url)
{
- createFile(m_resultsDir + *m_currentTest + ".dump.crash");
-
mainFrame->loader()->stopForUserCancel();
resetToConsistentStateBeforeTesting();
if (shouldLogFrameLoadDelegates(url))
gTestRunner->setDumpFrameLoadCallbacks(true);
- String stdoutFile = m_resultsDir + *m_currentTest + ".dump";
- String stderrFile = m_resultsDir + *m_currentTest + ".stderr";
+ if (!runFromCommandLine) {
+ createFile(m_resultsDir + *m_currentTest + ".dump.crash");
- // FIXME: we should preserve the original stdout and stderr here but aren't doing
- // that yet due to issues with dup, etc.
- freopen(stdoutFile.utf8().data(), "wb", stdout);
- freopen(stderrFile.utf8().data(), "wb", stderr);
+ String stdoutFile = m_resultsDir + *m_currentTest + ".dump";
+ String stderrFile = m_resultsDir + *m_currentTest + ".stderr";
+ // FIXME: we should preserve the original stdout and stderr here but aren't doing
+ // that yet due to issues with dup, etc.
+ freopen(stdoutFile.utf8().data(), "wb", stdout);
+ freopen(stderrFile.utf8().data(), "wb", stderr);
+ }
FILE* current = fopen(m_currentTestFile.utf8().data(), "w");
fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current);
fclose(current);
@@ -219,6 +221,11 @@ void DumpRenderTree::runCurrentTest()
void DumpRenderTree::runRemainingTests()
{
+ if (runFromCommandLine) {
+ doneDrt();
+ return;
+ }
+
// FIXME: fflush should not be necessary but is temporarily required due to a bug in stdio output.
fflush(stdout);
fflush(stderr);
@@ -328,9 +335,14 @@ void DumpRenderTree::runTests()
mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame();
- // Get Test file name from PPS: /pps/services/drt/input
- // Example: test_file::fast/js/arguments.html
- waitForTest();
+ if (getenv("drtTestFile")) {
+ runFromCommandLine = true;
+ addTest(testFile);
+ } else {
+ // Get Test file name from PPS: /pps/services/drt/input
+ // Example: test_file::fast/js/arguments.html
+ waitForTest();
+ }
}
void DumpRenderTree::addTest(const char* testFile)
@@ -381,7 +393,7 @@ bool DumpRenderTree::isHTTPTest(const String& test)
String testLower = test.lower();
int lenHttpTestSyntax = strlen(httpTestSyntax);
return testLower.substring(0, lenHttpTestSyntax) == httpTestSyntax
- && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax;
+ && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax;
}
void DumpRenderTree::invalidateAnyPreviousWaitToDumpWatchdog()
@@ -500,12 +512,13 @@ void DumpRenderTree::dump()
if (m_dumpPixels && !dumpAsText && gTestRunner->generatePixelResults())
dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash());
- String crashFile = dumpFile + ".crash";
- unlink(crashFile.utf8().data());
-
- String doneFile = m_resultsDir + *m_currentTest + ".done";
- createFile(doneFile);
+ if (!runFromCommandLine) {
+ String crashFile = dumpFile + ".crash";
+ unlink(crashFile.utf8().data());
+ String doneFile = m_resultsDir + *m_currentTest + ".done";
+ createFile(doneFile);
+ }
testDone = true;
runRemainingTests();
}
@@ -641,7 +654,7 @@ void DumpRenderTree::didReceiveTitleForFrame(const String& title, WebCore::Frame
}
// ChromeClient delegates.
-void DumpRenderTree::addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID)
+void DumpRenderTree::addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID)
{
printf("CONSOLE MESSAGE: ");
if (lineNumber)
@@ -653,7 +666,7 @@ void DumpRenderTree::addMessageToConsole(const String& message, unsigned int lin
String remaining = message.substring(pos);
String fileName;
int indexFile = remaining.reverseFind('/') + 1;
- if (indexFile > 0 && indexFile < remaining.length())
+ if (indexFile > 0 && unsigned(indexFile) < remaining.length())
fileName = remaining.substring(indexFile);
else
fileName = "file:";