WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-92398-20120731183817.patch (text/plain), 49.38 KB, created by
Balazs Kelemen
on 2012-07-31 09:38:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Balazs Kelemen
Created:
2012-07-31 09:38:35 PDT
Size:
49.38 KB
patch
obsolete
>Subversion Revision: 124209 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 0eaed75998732153240fba90ea4e1e6a892410e3..b99ed55f61d61560c9e5936eef68f737163ec179 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,97 @@ >+2012-07-31 Balazs Kelemen <kbalazs@webkit.org> >+ >+ All ports should support per test switching of pixel testing >+ https://bugs.webkit.org/show_bug.cgi?id=92398 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Teach all test drivers to accept a per test control of whether >+ to dump pixels. Drivers now accept a -p/--pixel-test argument >+ on the standart input that means that running the current >+ test as pixel test is allowed (even if the expected hash is >+ missing). Removed the --pixel-tests command line option since >+ there is no need for it anymore. >+ >+ * DumpRenderTree/DumpRenderTree.gypi: >+ * DumpRenderTree/DumpRenderTree.h: >+ (TestCommand::TestCommand): >+ (TestCommand): >+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: >+ * DumpRenderTree/DumpRenderTreeCommon.cpp: Added. >+ (CommandTokenizer): >+ (CommandTokenizer::CommandTokenizer): >+ (CommandTokenizer::pump): >+ (CommandTokenizer::next): >+ (CommandTokenizer::hasNext): >+ (die): >+ (parseInputLine): >+ Common logic to parse the input line from the standard input (or from the command line >+ in standalone mode). Made it somewhat general so we can easily add more arguments if >+ there is a need. >+ * DumpRenderTree/chromium/DumpRenderTree.cpp: >+ (runTest): >+ (main): >+ * DumpRenderTree/chromium/TestShell.cpp: >+ (TestShell::TestShell): >+ (TestShell::runFileTest): >+ (TestShell::dump): >+ * DumpRenderTree/chromium/TestShell.h: >+ (TestParams::TestParams): >+ (TestShell): >+ * DumpRenderTree/efl/CMakeLists.txt: >+ * DumpRenderTree/efl/DumpRenderTree.cpp: >+ (parseCommandLineOptions): >+ (runTest): >+ (shouldDumpPixelsAndCompareWithExpected): >+ (main): >+ * DumpRenderTree/gtk/DumpRenderTree.cpp: >+ (initializeGlobalsFromCommandLineOptions): >+ (dump): >+ * DumpRenderTree/mac/DumpRenderTree.mm: >+ (initializeGlobalsFromCommandLineOptions): >+ (dumpRenderTree): >+ * DumpRenderTree/qt/DumpRenderTree.pro: >+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp: >+ (WebCore::DumpRenderTree::processLine): >+ * DumpRenderTree/win/DumpRenderTree.cpp: >+ (dump): >+ (runTest): >+ (dllLauncherEntryPoint): >+ * DumpRenderTree/win/DumpRenderTree.vcproj: >+ * DumpRenderTree/wscript: >+ * DumpRenderTree/wx/DumpRenderTreeWx.cpp: >+ (dump): >+ (runTest): >+ (MyApp::OnInit): >+ * Scripts/old-run-webkit-tests: Pass --pixel-test before the hash. >+ Changed the separator form ' to : because it don't need to be escaped >+ when passing manually on the comand line. >+ * Scripts/webkitpy/layout_tests/port/base.py: >+ (Port.should_run_as_pixel_test): Removed now that all ports supports it. >+ * Scripts/webkitpy/layout_tests/port/driver.py: >+ (Driver.cmd_line): Don't pass --pixel-tests anymore. >+ (Driver._command_from_driver_input): >+ >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::TestController): >+ (WTR::TestController::initialize): >+ (WTR::TestCommand::TestCommand): >+ (TestCommand): >+ (WTR): >+ (CommandTokenizer): >+ (WTR::CommandTokenizer::CommandTokenizer): >+ (WTR::CommandTokenizer::pump): >+ (WTR::CommandTokenizer::next): >+ (WTR::CommandTokenizer::hasNext): >+ (WTR::die): >+ (WTR::parseInputLine): >+ (WTR::TestController::runTest): >+ * WebKitTestRunner/TestController.h: >+ (TestController): >+ Duplicate the logic for parsing the command line because >+ unfortunately there is no way to share code between >+ WebKitTestRunner and DumpRenderTree. >+ > 2012-07-31 Jochen Eisinger <jochen@chromium.org> > > [chromium] move EventSender into TestRunner.a >diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >index e38c8d8d49cc31ba4d14800662c9528453d41b2c..de06f775978fba8e8db72a8d095927a304763f64 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >+++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp >@@ -133,6 +133,7 @@ > 'include_dirs': [ > '<(chromium_src_dir)', > '<(source_dir)/WebKit/chromium/public', >+ '../' > '<(DEPTH)', > ], > 'defines': [ >diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi >index f2bc73d7bdf6f74d145677d7dfc43ae35dd2c6a4..416bb07325887d57b909e93122354f08b7dfba46 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.gypi >+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi >@@ -54,6 +54,8 @@ > 'chromium/WebViewHost.h', > ], > 'test_runner_files': [ >+ 'DumpRenderTree.h', >+ 'DumpRenderTreeCommon.cpp', > 'chromium/TestRunner/AccessibilityController.cpp', > 'chromium/TestRunner/AccessibilityController.h', > 'chromium/TestRunner/AccessibilityUIElement.cpp', >diff --git a/Tools/DumpRenderTree/DumpRenderTree.h b/Tools/DumpRenderTree/DumpRenderTree.h >index 0e598be4ae3dd625f0b45efe6b28fa35f67f52f2..18d8cda0eb17fa83bee2089b6d485a649dbb8670 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.h >+++ b/Tools/DumpRenderTree/DumpRenderTree.h >@@ -65,4 +65,14 @@ extern RefPtr<LayoutTestController> gLayoutTestController; > void dump(); > void displayWebView(); > >+struct TestCommand { >+ TestCommand() : shouldDumpPixels(false) { } >+ >+ std::string pathOrURL; >+ bool shouldDumpPixels; >+ std::string expectedPixelHash; >+}; >+ >+TestCommand parseInputLine(const std::string&); >+ > #endif // DumpRenderTree_h >diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >index 83bffd44841aa122eeded4725134c6915200dd5e..aa34b9738cf54fb2275f5de34d181bd401aa89c3 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >+++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >@@ -289,6 +289,7 @@ > 8CCDA81F151A56550003F937 /* SampleFont.sfont */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = SampleFont.sfont; path = fonts/SampleFont.sfont; sourceTree = "<group>"; }; > 9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; > 9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 980511D115C701E5008CFE7B /* DumpRenderTreeCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpRenderTreeCommon.cpp; sourceTree = "<group>"; }; > A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; }; > A817090308B164D300CCB9FB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; > A84F608908B136DA00E9745F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; >@@ -421,6 +422,7 @@ > 08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = { > isa = PBXGroup; > children = ( >+ 980511D115C701E5008CFE7B /* DumpRenderTreeCommon.cpp */, > 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */, > 1422A2750AF6F4BD00E1A883 /* Delegates */, > 1422A2690AF6F45200E1A883 /* Controllers */, >diff --git a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..03349db22067e9a08417a23ad8cb13b45b6d2310 >--- /dev/null >+++ b/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp >@@ -0,0 +1,82 @@ >+#include "config.h" >+#include "DumpRenderTree.h" >+ >+#include <algorithm> >+#include <ctype.h> >+#include <stdio.h> >+#include <stdlib.h> >+#include <string> >+ >+class CommandTokenizer { >+public: >+ CommandTokenizer(const std::string& input) >+ : m_input(input) >+ , m_posNextSeparator(0) >+ { >+ pump(); >+ } >+ >+ bool hasNext() const; >+ std::string next(); >+ >+private: >+ void pump(); >+ static const char kSeparator = ':'; >+ const std::string& m_input; >+ std::string m_next; >+ size_t m_posNextSeparator; >+}; >+ >+void CommandTokenizer::pump() >+{ >+ if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) { >+ m_next = std::string(); >+ return; >+ } >+ size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0; >+ m_posNextSeparator = m_input.find(kSeparator, start); >+ size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start; >+ m_next = std::string(m_input, start, size); >+} >+ >+std::string CommandTokenizer::next() >+{ >+ ASSERT(hasNext()); >+ >+ std::string oldNext = m_next; >+ pump(); >+ return oldNext; >+} >+ >+bool CommandTokenizer::hasNext() const >+{ >+ return m_next != std::string(); >+} >+ >+NO_RETURN static void die(const std::string& inputLine) >+{ >+ fprintf(stderr, "Unexpected input line: %s\n", inputLine.c_str()); >+ exit(1); >+} >+ >+TestCommand parseInputLine(const std::string& inputLine) >+{ >+ TestCommand result; >+ CommandTokenizer tokenizer(inputLine); >+ if (!tokenizer.hasNext()) >+ die(inputLine); >+ >+ result.pathOrURL = tokenizer.next(); >+ if (!tokenizer.hasNext()) >+ return result; >+ >+ std::string arg = tokenizer.next(); >+ if (arg != std::string("-p") && arg != std::string("--pixel-test")) >+ die(inputLine); >+ result.shouldDumpPixels = true; >+ >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ >+ return result; >+} >diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >index 6155f441f5d8bb3c44e5179080dcb17445e89874..b55948436c28b54f2cf769be9ee9257d30192134 100644 >--- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp >@@ -29,6 +29,7 @@ > */ > > #include "config.h" >+#include "DumpRenderTree.h" > > #include "MockWebKitPlatformSupport.h" > #include "TestShell.h" >@@ -44,7 +45,6 @@ using namespace std; > static const char optionComplexText[] = "--complex-text"; > static const char optionDumpAllPixels[] = "--dump-all-pixels"; > static const char optionNotree[] = "--notree"; >-static const char optionPixelTests[] = "--pixel-tests"; > static const char optionThreaded[] = "--threaded"; > static const char optionDebugRenderTree[] = "--debug-render-tree"; > static const char optionDebugLayerTree[] = "--debug-layer-tree"; >@@ -85,17 +85,12 @@ private: > OwnPtr<MockWebKitPlatformSupport> m_mockPlatform; > }; > >-static void runTest(TestShell& shell, TestParams& params, const string& testName) >+static void runTest(TestShell& shell, TestParams& params, const string& inputLine) > { > int oldTimeoutMsec = shell.layoutTestTimeout(); >- params.pixelHash = ""; >- string pathOrURL = testName; >- 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); >+ TestCommand command = parseInputLine(inputLine); >+ params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL); >+ params.pixelHash = command.shouldDumpPixels; > webkit_support::SetCurrentDirectoryForFileURL(params.testUrl); > v8::V8::SetFlagsFromString(shell.javaScriptFlags().c_str(), shell.javaScriptFlags().length()); > if (shell.stressOpt() || shell.stressDeopt()) { >@@ -108,11 +103,11 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName > bool isLastLoad = (i == (v8::Testing::GetStressRuns() - 1)); > shell.setDumpWhenFinished(isLastLoad); > shell.resetTestController(); >- shell.runFileTest(params); >+ shell.runFileTest(params, command.shouldDumpPixels); > } > } else { > shell.resetTestController(); >- shell.runFileTest(params); >+ shell.runFileTest(params, command.shouldDumpPixels); > } > shell.setLayoutTestTimeout(oldTimeoutMsec); > } >@@ -146,8 +141,6 @@ int main(int argc, char* argv[]) > serverMode = true; > else if (argument == optionNotree) > params.dumpTree = false; >- else if (argument == optionPixelTests) >- params.dumpPixels = true; > else if (argument == optionDebugRenderTree) > params.debugRenderTree = true; > else if (argument == optionDebugLayerTree) >diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp >index f122e1d2bee32a54115a333eaf0bdeb69ceebadc..e53a1f2d8763f0644cc3b607f61397cbf6feeb25 100644 >--- a/Tools/DumpRenderTree/chromium/TestShell.cpp >+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp >@@ -106,6 +106,7 @@ TestShell::TestShell() > , m_testIsPreparing(false) > , m_focusedWidget(0) > , m_devTools(0) >+ , m_dumpPixelsForCurrentTest(false) > , m_allowExternalPages(false) > , m_acceleratedCompositingForVideoEnabled(false) > , m_threadedCompositingEnabled(false) >@@ -232,13 +233,16 @@ void TestShell::resetWebSettings(WebView& webView) > m_prefs.applyTo(&webView); > } > >-void TestShell::runFileTest(const TestParams& params) >+void TestShell::runFileTest(const TestParams& params, bool shouldDumpPixels) > { > ASSERT(params.testUrl.isValid()); >+ m_dumpPixelsForCurrentTest = shouldDumpPixels; > m_testIsPreparing = true; > m_params = params; > string testUrl = m_params.testUrl.spec(); > >+ m_layoutTestController->setShouldGeneratePixelResults(shouldDumpPixels); >+ > if (testUrl.find("loading/") != string::npos > || testUrl.find("loading\\") != string::npos) > m_layoutTestController->setShouldDumpFrameLoadCallbacks(true); >@@ -603,7 +607,7 @@ void TestShell::dump() > if (dumpedAnything && m_params.printSeparators) > m_printer.handleTextFooter(); > >- if (m_params.dumpPixels && shouldGeneratePixelResults) { >+ if (m_dumpPixelsForCurrentTest && shouldGeneratePixelResults) { > // Image output: we write the image data to the file given on the > // command line (for the dump pixels argument), and the MD5 sum to > // stdout. >diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h >index dbfc1d1c9a13b1ccc1ed8cf4ae8bf98feb61b942..2e65c0dddc8cb7715a15f0b930d84d8bf33a014a 100644 >--- a/Tools/DumpRenderTree/chromium/TestShell.h >+++ b/Tools/DumpRenderTree/chromium/TestShell.h >@@ -63,7 +63,6 @@ class WebPermissions; > > struct TestParams { > bool dumpTree; >- bool dumpPixels; > bool debugRenderTree; > bool debugLayerTree; > bool printSeparators; >@@ -72,7 +71,6 @@ struct TestParams { > > TestParams() > : dumpTree(true) >- , dumpPixels(false) > , debugRenderTree(false) > , debugLayerTree(false) > , printSeparators(false) { } >@@ -103,7 +101,7 @@ public: > WebPermissions* webPermissions() { return m_webPermissions.get(); } > > void bindJSObjectsToWindow(WebKit::WebFrame*); >- void runFileTest(const TestParams&); >+ void runFileTest(const TestParams&, bool shouldDumpPixelTests); > void callJSGC(); > void resetTestController(); > void waitTestFinished(); >@@ -224,6 +222,7 @@ private: > #endif > > TestParams m_params; >+ bool m_dumpPixelsForCurrentTest; > int m_timeout; // timeout value in millisecond > bool m_allowExternalPages; > bool m_acceleratedCompositingForVideoEnabled; >diff --git a/Tools/DumpRenderTree/efl/CMakeLists.txt b/Tools/DumpRenderTree/efl/CMakeLists.txt >index e1dacf901ba0625a5a1e807ec6b9453434984caa..067dbd32b7aa91f5a547cb7be57ff4bdf5999329 100644 >--- a/Tools/DumpRenderTree/efl/CMakeLists.txt >+++ b/Tools/DumpRenderTree/efl/CMakeLists.txt >@@ -1,4 +1,5 @@ > SET(DumpRenderTree_SOURCES >+ ${TOOLS_DIR}/DumpRenderTree/DumpRenderTreeCommon.cpp > ${TOOLS_DIR}/DumpRenderTree/CyclicRedundancyCheck.cpp > ${TOOLS_DIR}/DumpRenderTree/GCController.cpp > ${TOOLS_DIR}/DumpRenderTree/LayoutTestController.cpp >diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >index c2c9d71c0c515cb08cd412d42add0d105ca9759c..7613f4e4ff0e565356288d4c7d44ff39a82e963e 100644 >--- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >@@ -64,7 +64,7 @@ extern Ewk_History_Item* prevTestBFItem; > RefPtr<LayoutTestController> gLayoutTestController; > volatile bool done = false; > >-static int dumpPixels = false; >+static bool dumpPixelsForCurrentTest; > static int dumpTree = true; > static int printSeparators = true; > static int useX11Window = false; >@@ -192,7 +192,6 @@ static bool parseCommandLineOptions(int argc, char** argv) > { > static const option options[] = { > {"notree", no_argument, &dumpTree, false}, >- {"pixel-tests", no_argument, &dumpPixels, true}, > {"tree", no_argument, &dumpTree, true}, > {"gui", no_argument, &useX11Window, true}, > {0, 0, 0, 0} >@@ -210,32 +209,6 @@ static bool parseCommandLineOptions(int argc, char** argv) > return true; > } > >-static String getFinalTestURL(const String& testURL) >-{ >- const size_t hashSeparatorPos = testURL.find("'"); >- if (hashSeparatorPos != notFound) >- return getFinalTestURL(testURL.left(hashSeparatorPos)); >- >- // Convert the path into a full file URL if it does not look >- // like an HTTP/S URL (doesn't start with http:// or https://). >- if (!testURL.startsWith("http://") && !testURL.startsWith("https://")) { >- char* cFilePath = ecore_file_realpath(testURL.utf8().data()); >- const String filePath = String::fromUTF8(cFilePath); >- free(cFilePath); >- >- if (ecore_file_exists(filePath.utf8().data())) >- return String("file://") + filePath; >- } >- >- return testURL; >-} >- >-static String getExpectedPixelHash(const String& testURL) >-{ >- const size_t hashSeparatorPos = testURL.find("'"); >- return (hashSeparatorPos != notFound) ? testURL.substring(hashSeparatorPos + 1) : String(); >-} >- > static inline bool isGlobalHistoryTest(const String& cTestPathOrURL) > { > return cTestPathOrURL.contains("/globalhistory/"); >@@ -267,13 +240,13 @@ static void createLayoutTestController(const String& testURL, const String& expe > } > } > >-static void runTest(const char* cTestPathOrURL) >+static void runTest(const char* inputLine) > { >- const String testPathOrURL = String::fromUTF8(cTestPathOrURL); >- ASSERT(!testPathOrURL.isEmpty()); >- >- const String testURL = getFinalTestURL(testPathOrURL); >- const String expectedPixelHash = getExpectedPixelHash(testPathOrURL); >+ TestCommand command = parseInputLine(inputLine); >+ const String testURL(command.pathOrURL.c_str()); >+ ASSERT(!testURL.isEmpty()); >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ const String expectedPixelHash(command.expectedPixelHash.c_str()); > > browser->resetDefaultsToConsistentValues(); > createLayoutTestController(testURL, expectedPixelHash); >@@ -351,7 +324,7 @@ static bool shouldDumpFrameScrollPosition() > > static bool shouldDumpPixelsAndCompareWithExpected() > { >- return dumpPixels && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive(); >+ return dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive(); > } > > static bool shouldDumpBackForwardList() >@@ -458,7 +431,7 @@ int main(int argc, char** argv) > printSeparators = true; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc - 1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >index 57cd05917e822558b48376e0102d800a6bcfccda..ebda5cfb23189fc2a795c4c9805e0bcbeaf5cf87 100644 >--- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >@@ -73,7 +73,7 @@ extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame); > > volatile bool done; > static bool printSeparators; >-static int dumpPixels; >+static bool dumpPixelsForCurrentTest; > static int dumpTree = 1; > static int useTimeoutWatchdog = 1; > >@@ -544,7 +544,6 @@ static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[]) > { > struct option options[] = { > {"notree", no_argument, &dumpTree, false}, >- {"pixel-tests", no_argument, &dumpPixels, true}, > {"tree", no_argument, &dumpTree, true}, > {"no-timeout", no_argument, &useTimeoutWatchdog, false}, > {NULL, 0, NULL, 0} >@@ -624,7 +623,7 @@ void dump() > } > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) { >@@ -687,18 +686,13 @@ static void sendPixelResultsEOF() > fflush(stderr); > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { > ASSERT(!testPathOrURL.empty()); > >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string testURL(testPathOrURL); >- string expectedPixelHash; >- size_t separatorPos = testURL.find("'"); >- if (separatorPos != string::npos) { >- testURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >+ TestCommand command = parseInputLine(inputLine); >+ string& testURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > // Convert the path into a full file URL if it does not look > // like an HTTP/S URL (doesn't start with http:// or https://). >@@ -712,7 +706,7 @@ static void runTest(const string& testPathOrURL) > > resetDefaultsToConsistentValues(); > >- gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash); > topLoadingFrame = 0; > done = false; > >@@ -1447,7 +1441,7 @@ int main(int argc, char* argv[]) > printSeparators = true; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc-1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index abba535eddc88a39490294fd451a391968fcc3d1..3f9d4266451facbe11509620355979032bebe6fb 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -140,7 +140,7 @@ static HistoryDelegate *historyDelegate; > PolicyDelegate *policyDelegate; > StorageTrackerDelegate *storageDelegate; > >-static int dumpPixels; >+static bool dumpPixelsForCurrentTest; > static int threaded; > static int dumpTree = YES; > static int useTimeoutWatchdog = YES; >@@ -780,7 +780,6 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[] > { > struct option options[] = { > {"notree", no_argument, &dumpTree, NO}, >- {"pixel-tests", no_argument, &dumpPixels, YES}, > {"tree", no_argument, &dumpTree, YES}, > {"threaded", no_argument, &threaded, YES}, > {"complex-text", no_argument, &forceComplexText, YES}, >@@ -849,7 +848,7 @@ void dumpRenderTree(int argc, const char *argv[]) > initializeGlobalsFromCommandLineOptions(argc, argv); > prepareConsistentTestingEnvironment(); > addTestPluginsToPluginSearchPath(argv[0]); >- if (dumpPixels) >+ if (dumpPixelsForCurrentTest) > installSignalHandlers(); > > if (forceComplexText) >@@ -874,7 +873,7 @@ void dumpRenderTree(int argc, const char *argv[]) > printSeparators = YES; > runTestingServerLoop(); > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) > runTest(argv[i]); > } >@@ -1195,7 +1194,7 @@ void dump() > } > } > >- if (dumpPixels && gLayoutTestController->generatePixelResults()) >+ if (dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults()) > // FIXME: when isPrinting is set, dump the image with page separators. > dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash()); > >@@ -1276,19 +1275,13 @@ static void resetWebViewToConsistentStateBeforeTesting() > [mainFrame _clearOpener]; > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { >- ASSERT(!testPathOrURL.empty()); >- >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string pathOrURL(testPathOrURL); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >+ ASSERT(!inputLine.empty()); >+ >+ TestCommand command = parseInputLine(inputLine); >+ const string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()]; > if (!pathOrURLString) { >@@ -1310,7 +1303,7 @@ static void runTest(const string& testPathOrURL) > > resetWebViewToConsistentStateBeforeTesting(); > >- gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash); > topLoadingFrame = nil; > ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop! > releaseAndZero(&draggingInfo); >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTree.pro b/Tools/DumpRenderTree/qt/DumpRenderTree.pro >index f47fb4344b9ef83a5aa46bb5683d9231494aa125..833870bcac9a82edcee81ed5dba31910acf0f0f2 100644 >--- a/Tools/DumpRenderTree/qt/DumpRenderTree.pro >+++ b/Tools/DumpRenderTree/qt/DumpRenderTree.pro >@@ -25,6 +25,7 @@ contains(DEFINES, HAVE_FONTCONFIG=1): PKGCONFIG += fontconfig > > HEADERS += \ > $$PWD/../WorkQueue.h \ >+ $$PWD/../DumpRenderTree.h \ > DumpRenderTreeQt.h \ > EventSenderQt.h \ > TextInputControllerQt.h \ >@@ -36,6 +37,7 @@ HEADERS += \ > > SOURCES += \ > $$PWD/../WorkQueue.cpp \ >+ $$PWD/../DumpRenderTreeCommon.cpp \ > DumpRenderTreeQt.cpp \ > EventSenderQt.cpp \ > TextInputControllerQt.cpp \ >diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >index 0ecf622f3f8dda56c4c88cefcf08a3c98cf237c4..5a5cb96adec93cd0eb68500e76ec31efdda097af 100755 >--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp >@@ -30,6 +30,7 @@ > */ > > #include "config.h" >+#include "DumpRenderTree.h" > > #include "DumpRenderTreeQt.h" > #include "DumpRenderTreeSupportQt.h" >@@ -690,44 +691,27 @@ void DumpRenderTree::loadNextTestInStandAloneMode() > > void DumpRenderTree::processLine(const QString &input) > { >- QString line = input; >- >- m_dumpPixelsForCurrentTest = false; >- m_expectedHash = QString(); >- // single quote marks the pixel dump hash >- int indexOfFirstSeparator = line.indexOf('\''); >- int indexOfSecondSeparator = line.indexOf('\'', indexOfFirstSeparator + 1); >- if (indexOfFirstSeparator > -1) { >- int indexOfPixelHash = indexOfFirstSeparator + 1; >- >- // NRWT passes --pixel-test if we should dump pixels for the test. >- const QString expectedArg(QLatin1String("--pixel-test")); >- QString argTest = line.mid(indexOfFirstSeparator + 1, expectedArg.length()); >- if (argTest == expectedArg) { >- m_dumpPixelsForCurrentTest = true; >- indexOfPixelHash = indexOfSecondSeparator == -1 ? -1 : indexOfSecondSeparator + 1; >- } >- if (indexOfPixelHash != -1 && indexOfPixelHash < line.size()) >- m_expectedHash = line.mid(indexOfPixelHash); >- line.remove(indexOfFirstSeparator, line.length()); >- } >- >- if (line.startsWith(QLatin1String("http:")) >- || line.startsWith(QLatin1String("https:")) >- || line.startsWith(QLatin1String("file:")) >- || line == QLatin1String("about:blank")) { >- open(QUrl(line)); >+ TestCommand command = parseInputLine(std::string(input.toLatin1().constData())); >+ QString pathOrURL = QLatin1String(command.pathOrURL.c_str()); >+ m_dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ m_expectedHash = QLatin1String(command.expectedPixelHash.c_str()); >+ >+ if (pathOrURL.startsWith(QLatin1String("http:")) >+ || pathOrURL.startsWith(QLatin1String("https:")) >+ || pathOrURL.startsWith(QLatin1String("file:")) >+ || pathOrURL == QLatin1String("about:blank")) { >+ open(QUrl(pathOrURL)); > } else { >- QFileInfo fi(line); >+ QFileInfo fi(pathOrURL); > > if (!fi.exists()) { > QDir currentDir = QDir::currentPath(); > > // Try to be smart about where the test is located > if (currentDir.dirName() == QLatin1String("LayoutTests")) >- fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); >- else if (!line.contains(QLatin1String("LayoutTests"))) >- fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/"))); >+ fi = QFileInfo(currentDir, pathOrURL.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1")); >+ else if (!pathOrURL.contains(QLatin1String("LayoutTests"))) >+ fi = QFileInfo(currentDir, pathOrURL.prepend(QLatin1String("LayoutTests/"))); > > if (!fi.exists()) { > emit ready(); >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >index f402a02ca362c5279de5a5c8c1e0ce9df362abad..312430d56989548bc3ecad13f8df183096c17c85 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >@@ -80,7 +80,7 @@ static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS"; > const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow"; > > static bool dumpTree = true; >-static bool dumpPixels; >+static bool dumpPixelsForCurrentTest; > static bool dumpAllPixels; > static bool printSeparators; > static bool leakChecking = false; >@@ -759,7 +759,7 @@ void dump() > fflush(stderr); > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) >@@ -948,20 +948,14 @@ static void sizeWebViewForCurrentTest() > ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); > } > >-static void runTest(const string& testPathOrURL) >+static void runTest(const string& inputLine) > { >+ TestCommand command = parseInputLine(inputLine); >+ const string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; >+ > static BSTR methodBStr = SysAllocString(TEXT("GET")); > >- // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. >- string pathOrURL(testPathOrURL); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(testPathOrURL, 0, separatorPos); >- expectedPixelHash = string(testPathOrURL, separatorPos + 1); >- } >- > BSTR urlBStr; > > CFStringRef str = CFStringCreateWithCString(0, pathOrURL.c_str(), kCFStringEncodingWindowsLatin1); >@@ -983,7 +977,7 @@ static void runTest(const string& testPathOrURL) > > CFRelease(url); > >- ::gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash); >+ ::gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash); > done = false; > topLoadingFrame = 0; > >@@ -1337,11 +1331,6 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, cons > continue; > } > >- if (!stricmp(argv[i], "--pixel-tests")) { >- dumpPixels = true; >- continue; >- } >- > if (!stricmp(argv[i], "--complex-text")) { > forceComplexText = true; > continue; >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >index 4843c390e7c6b52e24e2b377065478d076c097fa..7e242a1cde4a2fccc1a2471b6169b3e33eadcdcd 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj >@@ -563,6 +563,10 @@ > > > </File> > <File >+ RelativePath="..\DumpRenderTreeCommon.cpp" >+ > >+ </File> >+ <File > RelativePath="..\DumpRenderTreePrefix.h" > > > </File> >diff --git a/Tools/DumpRenderTree/wscript b/Tools/DumpRenderTree/wscript >index 645c7d641598afe2f14e163ad4ccef27c528b764..b32929450b28aa8892c33e3be0d96f0e6e113418 100644 >--- a/Tools/DumpRenderTree/wscript >+++ b/Tools/DumpRenderTree/wscript >@@ -40,6 +40,7 @@ include_paths = [ > 'wx' > ] > sources = [ >+ 'DumpRenderTreeCommon.cpp', > 'LayoutTestController.cpp', > 'WorkQueue.cpp', > 'wx/DumpRenderTreeWx.cpp', >diff --git a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >index 31add11a2eb74d1f4d8329479f419f107ffba88f..45b852d88ab9bda291fb1ed277aca751dfd35097 100644 >--- a/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >+++ b/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp >@@ -50,7 +50,7 @@ > volatile bool done = true; > volatile bool notified = false; > static bool printSeparators = true; >-static int dumpPixels; >+static int dumpPixelsForCurrentTest; > static int dumpTree = 1; > time_t startTime; // to detect timeouts / failed tests > >@@ -203,7 +203,7 @@ void dump() > } > } > >- if (dumpPixels >+ if (dumpPixelsForCurrentTest > && gLayoutTestController->generatePixelResults() > && !gLayoutTestController->dumpDOMAsWebArchive() > && !gLayoutTestController->dumpSourceAsWebArchive()) { >@@ -218,26 +218,21 @@ void dump() > gLayoutTestController.clear(); > } > >-static void runTest(const wxString testPathOrURL) >+static void runTest(const wxString inputLine) > { > done = false; > time(&startTime); >- string pathOrURLString(testPathOrURL.char_str()); >- string pathOrURL(pathOrURLString); >- string expectedPixelHash; >- >- size_t separatorPos = pathOrURL.find("'"); >- if (separatorPos != string::npos) { >- pathOrURL = string(pathOrURLString, 0, separatorPos); >- expectedPixelHash = string(pathOrURLString, separatorPos + 1); >- } >+ >+ TestCommand command = parseInputLine(std::string(inputLine.ToAscii())); >+ string& pathOrURL = command.pathOrURL; >+ dumpPixelsForCurrentTest = command.shouldDumpPixels; > > // CURL isn't happy if we don't have a protocol. > size_t http = pathOrURL.find("http://"); > if (http == string::npos) > pathOrURL.insert(0, "file://"); > >- gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash); >+ gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash); > if (!gLayoutTestController) { > wxTheApp->ExitMainLoop(); > } >@@ -282,11 +277,6 @@ bool MyApp::OnInit() > continue; > } > >- if (!option.CmpNoCase(_T("--pixel-tests"))) { >- dumpPixels = true; >- continue; >- } >- > if (!option.CmpNoCase(_T("--tree"))) { > dumpTree = true; > continue; >@@ -323,7 +313,7 @@ bool MyApp::OnInit() > } > > } else { >- printSeparators = (optind < argc-1 || (dumpPixels && dumpTree)); >+ printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree)); > for (int i = optind; i != argc; ++i) { > runTest(wxTheApp->argv[1]); > } >diff --git a/Tools/GNUmakefile.am b/Tools/GNUmakefile.am >index df9a71f18f95807ef4fd6f7d7c27d311fa321ac2..f85a9d12eb7454231522511062ee27f5a4089d42 100644 >--- a/Tools/GNUmakefile.am >+++ b/Tools/GNUmakefile.am >@@ -106,6 +106,7 @@ endif > > Programs_DumpRenderTree_SOURCES = \ > Tools/DumpRenderTree/DumpRenderTree.h \ >+ Tools/DumpRenderTree/DumpRenderTreeCommon.cpp \ > Tools/DumpRenderTree/DumpRenderTreePrefix.h \ > Tools/DumpRenderTree/AccessibilityController.cpp \ > Tools/DumpRenderTree/AccessibilityController.h \ >diff --git a/Tools/Scripts/old-run-webkit-tests b/Tools/Scripts/old-run-webkit-tests >index 09443c87c02f1e8cf5bde6d1b045c4db9bab0882..f091c19baab73fe5ef42c516bacc145136f2dc20 100755 >--- a/Tools/Scripts/old-run-webkit-tests >+++ b/Tools/Scripts/old-run-webkit-tests >@@ -748,12 +748,16 @@ for my $test (@tests) { > print $tests_run_fh "$test\n"; > > # Try to read expected hash file for pixel tests >- my $suffixExpectedHash = ""; >- if ($pixelTests && !$resetResults) { >- my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); >- if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) { >- # Format expected hash into a suffix string that is appended to the path / URL passed to DRT. >- $suffixExpectedHash = "'$expectedHash"; >+ my $suffixPixelTest = ""; >+ if ($pixelTests) { >+ # : is the separator between arguments. >+ $suffixPixelTest = ":--pixel-test"; >+ if (!$resetResults) { >+ my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png"); >+ if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) { >+ # Format expected hash into a suffix string that is appended to the path / URL passed to DRT. >+ $suffixPixelTest = ":--pixel-test:$expectedHash"; >+ } > } > } > >@@ -789,11 +793,11 @@ for my $test (@tests) { > } elsif ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\//) { > my $path = canonpath($test); > $path =~ s/^http\/tests\///; >- print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n"; >+ print OUT "http://127.0.0.1:$httpdPort/$path$suffixPixelTest\n"; > } elsif ($test =~ /^http\/tests\/ssl\//) { > my $path = canonpath($test); > $path =~ s/^http\/tests\///; >- print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixExpectedHash\n"; >+ print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixPixelTest\n"; > } else { > my $testPath = "$testDirectory/$test"; > if (isCygwin()) { >@@ -801,7 +805,7 @@ for my $test (@tests) { > } else { > $testPath = canonpath($testPath); > } >- print OUT "$testPath$suffixExpectedHash\n"; >+ print OUT "$testPath$suffixPixelTest\n"; > } > } else { > my $testPath = "$testDirectory/$test"; >@@ -810,7 +814,7 @@ for my $test (@tests) { > } else { > $testPath = canonpath($testPath); > } >- print OUT "$testPath$suffixExpectedHash\n" if defined $testPath; >+ print OUT "$testPath$suffixPixelTest\n" if defined $testPath; > } > > # DumpRenderTree is expected to dump two "blocks" to stdout for each test. >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py >index ad70f042de9ecb60063bea6f50c285bf9efd9c12..94215624fe27ea425aa73e891577cc5e6e990e29 100755 >--- a/Tools/Scripts/webkitpy/layout_tests/port/base.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py >@@ -1277,21 +1277,9 @@ class Port(object): > return suite.args > return [] > >- def supports_switching_pixel_tests_per_test(self): >- if self.get_option('webkit_test_runner'): >- return True >- return self._supports_switching_pixel_tests_per_test() >- >- def _supports_switching_pixel_tests_per_test(self): >- # FIXME: all ports should support it. >- return False >- > def should_run_as_pixel_test(self, test_input): > if not self._options.pixel_tests: > return False >- if not self.supports_switching_pixel_tests_per_test(): >- # Cannot do more filtering without this. >- return True > if self._options.pixel_test_directories: > return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories) > return self._should_run_as_pixel_test(test_input) >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/driver.py b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >index 781823b8d670a6eb8e52e0768be664b11d63033c..2eb1e14b52bcd7235f355c1a9740686f95bcc8d6 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/driver.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/driver.py >@@ -293,8 +293,6 @@ class Driver(object): > > cmd.extend(self._port.get_option('additional_drt_flag', [])) > >- if pixel_tests and not self._port.supports_switching_pixel_tests_per_test(): >- cmd.append('--pixel-tests') > cmd.extend(per_test_args) > > cmd.append('-') >@@ -336,12 +334,9 @@ class Driver(object): > assert not driver_input.image_hash or driver_input.should_run_pixel_test > > if driver_input.should_run_pixel_test: >- if self._port.supports_switching_pixel_tests_per_test(): >- # We did not start the driver with --pixel-tests, instead we specify it per test. >- # "'" is the separator of command fields. >- command += "'" + '--pixel-test' >+ command += ":--pixel-test" > if driver_input.image_hash: >- command += "'" + driver_input.image_hash >+ command += ":" + driver_input.image_hash > return command + "\n" > > def _read_first_block(self, deadline): >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt.py b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >index e239c7e3aaf6f602b0c351ec22dcfa68064ea269..6e7b0988d5a77efc5fc372fa7516783400a69f08 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/qt.py >@@ -184,6 +184,3 @@ class QtPort(Port): > return False > return result > >- def _supports_switching_pixel_tests_per_test(self): >- return True >- >diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py >index 5714661fd203676839d6c76f4735bec8132b89b8..0cd171f3bca6abebdb21b98e2a45c21a14a90112 100644 >--- a/Tools/Scripts/webkitpy/layout_tests/port/test.py >+++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py >@@ -513,10 +513,6 @@ class TestPort(Port): > VirtualTestSuite('virtual/skipped', 'failures/expected', ['--virtual-arg2']), > ] > >- def supports_switching_pixel_tests_per_test(self): >- # Let it true so we can test the --pixel-test-directory option. >- return True >- > > class TestDriver(Driver): > """Test/Dummy implementation of the DumpRenderTree interface.""" >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index d0232992731d1bc971268fc3931f4b70ab367ac7..1de3c9e6a6ac8f3029aaa0316c481f04eae2f88b 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -35,7 +35,11 @@ > #include <WebKit2/WKPagePrivate.h> > #include <WebKit2/WKPreferencesPrivate.h> > #include <WebKit2/WKRetainPtr.h> >+#include <algorithm> > #include <cstdio> >+#include <ctype.h> >+#include <stdlib.h> >+#include <string> > #include <wtf/PassOwnPtr.h> > > #if PLATFORM(MAC) >@@ -67,8 +71,7 @@ TestController& TestController::shared() > } > > TestController::TestController(int argc, const char* argv[]) >- : m_dumpPixelsForAllTests(false) >- , m_verbose(false) >+ : m_verbose(false) > , m_printSeparators(false) > , m_usingServerMode(false) > , m_gcBetweenTests(false) >@@ -267,10 +270,6 @@ void TestController::initialize(int argc, const char* argv[]) > continue; > } > >- if (argument == "--pixel-tests") { >- m_dumpPixelsForAllTests = true; >- continue; >- } > if (argument == "--verbose") { > m_verbose = true; > continue; >@@ -504,7 +503,89 @@ bool TestController::resetStateToConsistentValues() > return m_doneResetting; > } > >-bool TestController::runTest(const char* test) >+struct TestCommand { >+ TestCommand() : shouldDumpPixels(false) { } >+ >+ std::string pathOrURL; >+ bool shouldDumpPixels; >+ std::string expectedPixelHash; >+}; >+ >+class CommandTokenizer { >+public: >+ CommandTokenizer(const std::string& input) >+ : m_input(input) >+ , m_posNextSeparator(0) >+ { >+ pump(); >+ } >+ >+ bool hasNext() const; >+ std::string next(); >+ >+private: >+ void pump(); >+ static const char kSeparator = ':'; >+ const std::string& m_input; >+ std::string m_next; >+ size_t m_posNextSeparator; >+}; >+ >+void CommandTokenizer::pump() >+{ >+ if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) { >+ m_next = std::string(); >+ return; >+ } >+ size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0; >+ m_posNextSeparator = m_input.find(kSeparator, start); >+ size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start; >+ m_next = std::string(m_input, start, size); >+} >+ >+std::string CommandTokenizer::next() >+{ >+ ASSERT(hasNext()); >+ >+ std::string oldNext = m_next; >+ pump(); >+ return oldNext; >+} >+ >+bool CommandTokenizer::hasNext() const >+{ >+ return m_next != std::string(); >+} >+ >+NO_RETURN static void die(const std::string& inputLine) >+{ >+ fprintf(stderr, "Unexpected input line: %s\n", inputLine.c_str()); >+ exit(1); >+} >+ >+TestCommand parseInputLine(const std::string& inputLine) >+{ >+ TestCommand result; >+ CommandTokenizer tokenizer(inputLine); >+ if (!tokenizer.hasNext()) >+ die(inputLine); >+ >+ result.pathOrURL = tokenizer.next(); >+ if (!tokenizer.hasNext()) >+ return result; >+ >+ std::string arg = tokenizer.next(); >+ if (arg != std::string("-p") && arg != std::string("--pixel-test")) >+ die(inputLine); >+ result.shouldDumpPixels = true; >+ >+ if (tokenizer.hasNext()) >+ result.expectedPixelHash = tokenizer.next(); >+ >+ return result; >+} >+ >+bool TestController::runTest(const char* inputLine) > { > if (!resetStateToConsistentValues()) { > #if PLATFORM(MAC) >@@ -517,32 +598,13 @@ bool TestController::runTest(const char* test) > return false; > } > >- bool dumpPixelsTest = m_dumpPixelsForAllTests; >- std::string command(test); >- std::string pathOrURL = command; >- std::string expectedPixelHash; >- 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); >- } >+ TestCommand command = parseInputLine(std::string(inputLine)); > > m_state = RunningTest; > >- m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL)); >- if (dumpPixelsTest) >- m_currentInvocation->setIsPixelTest(expectedPixelHash); >+ m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL)); >+ if (command.shouldDumpPixels) >+ m_currentInvocation->setIsPixelTest(command.expectedPixelHash); > > m_currentInvocation->invoke(); > m_currentInvocation.clear(); >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index a99e16ea87027c34f07b8962b098c2334d9421bd..5e20d611b469df187c378ee62ed0cac318daed21 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -104,7 +104,6 @@ private: > > OwnPtr<TestInvocation> m_currentInvocation; > >- bool m_dumpPixelsForAllTests; > bool m_verbose; > bool m_printSeparators; > bool m_usingServerMode;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 92398
:
154700
|
155320
|
155325
|
155474
|
155489
|
155513
|
155519
|
155569
|
155580
|
156011