summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/TestController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/TestController.cpp')
-rw-r--r--Tools/WebKitTestRunner/TestController.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index 8c2250831..d02329927 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -67,7 +67,7 @@ TestController& TestController::shared()
}
TestController::TestController(int argc, const char* argv[])
- : m_dumpPixels(false)
+ : m_dumpPixelsForAllTests(false)
, m_verbose(false)
, m_printSeparators(false)
, m_usingServerMode(false)
@@ -268,7 +268,7 @@ void TestController::initialize(int argc, const char* argv[])
}
if (argument == "--pixel-tests") {
- m_dumpPixels = true;
+ m_dumpPixelsForAllTests = true;
continue;
}
if (argument == "--verbose") {
@@ -517,18 +517,31 @@ bool TestController::runTest(const char* test)
return false;
}
- std::string pathOrURL(test);
+ bool dumpPixelsTest = m_dumpPixelsForAllTests;
+ std::string command(test);
+ std::string pathOrURL = command;
std::string expectedPixelHash;
- size_t separatorPos = pathOrURL.find("'");
- if (separatorPos != std::string::npos) {
- pathOrURL = std::string(std::string(test), 0, separatorPos);
- expectedPixelHash = std::string(std::string(test), separatorPos + 1);
+ size_t firstSeparatorPos = command.find_first_of('\'');
+ size_t secondSeparatorPos = command.find_first_of('\'', firstSeparatorPos + 1);
+ if (firstSeparatorPos != std::string::npos) {
+ pathOrURL = std::string(command, 0, firstSeparatorPos);
+ size_t pixelHashPos = firstSeparatorPos + 1;
+
+ // NRWT passes --pixel-test if we should dump pixels for the test.
+ const std::string expectedPixelTestArg("--pixel-test");
+ std::string argTest = std::string(command, firstSeparatorPos + 1, expectedPixelTestArg.size());
+ if (argTest == expectedPixelTestArg) {
+ dumpPixelsTest = true;
+ pixelHashPos = secondSeparatorPos == std::string::npos ? std::string::npos : secondSeparatorPos + 1;
+ }
+ if (pixelHashPos != std::string::npos && pixelHashPos < command.size())
+ expectedPixelHash = std::string(command, pixelHashPos);
}
m_state = RunningTest;
m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL));
- if (m_dumpPixels)
+ if (dumpPixelsTest)
m_currentInvocation->setIsPixelTest(expectedPixelHash);
m_currentInvocation->invoke();