<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160627] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160627">160627</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-15 20:58:10 -0800 (Sun, 15 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Refactor option handling in WebKitTestRunner.
https://bugs.webkit.org/show_bug.cgi?id=123185
Patch by Tamas Gergely <tgergely.u-szeged@partner.samsung.com> on 2013-12-15
Reviewed by Darin Adler.
Option handling is refactored (according to the FIXME) that allows
to automatically generate the help message.
* WebKitTestRunner/CMakeLists.txt:
* WebKitTestRunner/GNUmakefile.am:
* WebKitTestRunner/Options.cpp: Added.
(WTR::Options::Options):
(WTR::handleOptionTimeout):
(WTR::handleOptionNoTimeout):
(WTR::handleOptionNoTimeoutAtAll):
(WTR::handleOptionVerbose):
(WTR::handleOptionGcBetweenTests):
(WTR::handleOptionPixelTests):
(WTR::handleOptionPrintSupportedFeatures):
(WTR::handleOptionComplexText):
(WTR::handleOptionAcceleratedDrawing):
(WTR::handleOptionRemoteLayerTree):
(WTR::handleOptionUnmatched):
(WTR::OptionsHandler::OptionsHandler):
(WTR::Option::Option):
(WTR::Option::matches):
(WTR::OptionsHandler::parse):
(WTR::OptionsHandler::printHelp):
* WebKitTestRunner/Options.h: Added.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerCMakeListstxt">trunk/Tools/WebKitTestRunner/CMakeLists.txt</a></li>
<li><a href="#trunkToolsWebKitTestRunnerGNUmakefileam">trunk/Tools/WebKitTestRunner/GNUmakefile.am</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj">trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsWebKitTestRunnerOptionscpp">trunk/Tools/WebKitTestRunner/Options.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerOptionsh">trunk/Tools/WebKitTestRunner/Options.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (160626 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-12-16 04:04:10 UTC (rev 160626)
+++ trunk/Tools/ChangeLog        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2013-12-15 Tamas Gergely <tgergely.u-szeged@partner.samsung.com>
+
+ Refactor option handling in WebKitTestRunner.
+ https://bugs.webkit.org/show_bug.cgi?id=123185
+
+ Reviewed by Darin Adler.
+
+ Option handling is refactored (according to the FIXME) that allows
+ to automatically generate the help message.
+
+ * WebKitTestRunner/CMakeLists.txt:
+ * WebKitTestRunner/GNUmakefile.am:
+ * WebKitTestRunner/Options.cpp: Added.
+ (WTR::Options::Options):
+ (WTR::handleOptionTimeout):
+ (WTR::handleOptionNoTimeout):
+ (WTR::handleOptionNoTimeoutAtAll):
+ (WTR::handleOptionVerbose):
+ (WTR::handleOptionGcBetweenTests):
+ (WTR::handleOptionPixelTests):
+ (WTR::handleOptionPrintSupportedFeatures):
+ (WTR::handleOptionComplexText):
+ (WTR::handleOptionAcceleratedDrawing):
+ (WTR::handleOptionRemoteLayerTree):
+ (WTR::handleOptionUnmatched):
+ (WTR::OptionsHandler::OptionsHandler):
+ (WTR::Option::Option):
+ (WTR::Option::matches):
+ (WTR::OptionsHandler::parse):
+ (WTR::OptionsHandler::printHelp):
+ * WebKitTestRunner/Options.h: Added.
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2013-12-15 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> 32-bit build fix.
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (160626 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/CMakeLists.txt        2013-12-16 04:04:10 UTC (rev 160626)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> set(WebKitTestRunner_SOURCES
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/GeolocationProviderMock.cpp
</span><ins>+ ${WEBKIT_TESTRUNNER_DIR}/Options.cpp
</ins><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/PixelDumpSupport.cpp
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/TestController.cpp
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/GNUmakefile.am (160626 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/GNUmakefile.am        2013-12-16 04:04:10 UTC (rev 160626)
+++ trunk/Tools/WebKitTestRunner/GNUmakefile.am        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -21,6 +21,8 @@
</span><span class="cx">         Tools/WebKitTestRunner/CyclicRedundancyCheck.h \
</span><span class="cx">         Tools/WebKitTestRunner/GeolocationProviderMock.cpp \
</span><span class="cx">         Tools/WebKitTestRunner/GeolocationProviderMock.h \
</span><ins>+        Tools/WebKitTestRunner/Options.cpp \
+        Tools/WebKitTestRunner/Options.h \
</ins><span class="cx">         Tools/WebKitTestRunner/PixelDumpSupport.cpp \
</span><span class="cx">         Tools/WebKitTestRunner/PixelDumpSupport.h \
</span><span class="cx">         Tools/WebKitTestRunner/PlatformWebView.h \
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerOptionscpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/Options.cpp (0 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/Options.cpp         (rev 0)
+++ trunk/Tools/WebKitTestRunner/Options.cpp        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+/*
+ * Copyright (C) 2013 University of Szeged. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 "Options.h"
+
+#include <string.h>
+
+namespace WTR {
+
+Options::Options(double defaultLongTimeout, double defaultShortTimeout)
+ : longTimeout(defaultLongTimeout)
+ , shortTimeout(defaultShortTimeout)
+ , useWaitToDumpWatchdogTimer(true)
+ , forceNoTimeout(false)
+ , verbose(false)
+ , gcBetweenTests(false)
+ , shouldDumpPixelsForAllTests(false)
+ , printSupportedFeatures(false)
+ , forceComplexText(false)
+ , shouldUseAcceleratedDrawing(false)
+ , shouldUseRemoteLayerTree(false)
+ , defaultLongTimeout(defaultLongTimeout)
+ , defaultShortTimeout(defaultShortTimeout)
+{
+}
+
+bool handleOptionTimeout(Options& options, const char*, const char* argument)
+{
+ options.longTimeout = atoi(argument);
+ // Scale up the short timeout to match.
+ options.shortTimeout = options.defaultShortTimeout * options.longTimeout / options.defaultLongTimeout;
+ return true;
+}
+
+bool handleOptionNoTimeout(Options& options, const char*, const char*)
+{
+ options.useWaitToDumpWatchdogTimer = false;
+ return true;
+}
+
+bool handleOptionNoTimeoutAtAll(Options& options, const char*, const char*)
+{
+ options.useWaitToDumpWatchdogTimer = false;
+ options.forceNoTimeout = true;
+ return true;
+}
+
+bool handleOptionVerbose(Options& options, const char*, const char*)
+{
+ options.verbose = true;
+ return true;
+}
+
+bool handleOptionGcBetweenTests(Options& options, const char*, const char*)
+{
+ options.gcBetweenTests = true;
+ return true;
+}
+
+bool handleOptionPixelTests(Options& options, const char*, const char*)
+{
+ options.shouldDumpPixelsForAllTests = true;
+ return true;
+}
+
+bool handleOptionPrintSupportedFeatures(Options& options, const char*, const char*)
+{
+ options.printSupportedFeatures = true;
+ return true;
+}
+
+bool handleOptionComplexText(Options& options, const char*, const char*)
+{
+ options.forceComplexText = true;
+ return true;
+}
+
+bool handleOptionAcceleratedDrawing(Options& options, const char*, const char*)
+{
+ options.shouldUseAcceleratedDrawing = true;
+ return true;
+}
+
+bool handleOptionRemoteLayerTree(Options& options, const char*, const char*)
+{
+ options.shouldUseRemoteLayerTree = true;
+ return true;
+}
+
+bool handleOptionUnmatched(Options& options, const char* option, const char*)
+{
+ if (option[0] && option[1] && option[0] == '-' && option[1] == '-')
+ return true;
+ options.paths.push_back(option);
+ return true;
+}
+
+OptionsHandler::OptionsHandler(Options& o)
+ : options(o)
+{
+ optionList.append(Option("--timeout", "Sets long timeout to <param> and scales short timeout.", handleOptionTimeout, true));
+ optionList.append(Option("--no-timeout", "Disables timeout.", handleOptionNoTimeout));
+ optionList.append(Option("--no-timeout-at-all", "Disables all timeouts.", handleOptionNoTimeoutAtAll));
+ optionList.append(Option("--verbose", "Turns on messages.", handleOptionVerbose));
+ optionList.append(Option("--gc-between-tests", "Garbage collection between tests.", handleOptionGcBetweenTests));
+ optionList.append(Option("--pixel-tests", "Check pixels.", handleOptionPixelTests));
+ optionList.append(Option("-p", "Check pixels.", handleOptionPixelTests));
+ optionList.append(Option("--print-supported-features", "For DumpRenderTree compatibility.", handleOptionPrintSupportedFeatures));
+ optionList.append(Option("--complex-text", "Force complex tests.", handleOptionComplexText));
+ optionList.append(Option("--accelerated-drawing", "Use accelerated drawing.", handleOptionAcceleratedDrawing));
+ optionList.append(Option("--remote-layer-tree", "Use remote layer tree.", handleOptionRemoteLayerTree));
+ optionList.append(Option(0, 0, handleOptionUnmatched));
+}
+
+const char * OptionsHandler::usage = "Usage: WebKitTestRunner [options] filename [filename2..n]";
+const char * OptionsHandler::help = "Displays this help.";
+
+Option::Option(const char* name, const char* description, std::function<bool(Options&, const char*, const char*)> parameterHandler, bool hasArgument)
+ : name(name), description(description), parameterHandler(parameterHandler), hasArgument(hasArgument) { };
+
+bool Option::matches(const char* option)
+{
+ return !name || !strcmp(name, option);
+}
+
+bool OptionsHandler::parse(int argc, const char* argv[])
+{
+ bool status = true;
+ for (int argCounter = 1; argCounter < argc; ++argCounter) {
+ if (!strcmp(argv[argCounter], "--help") || !strcmp(argv[argCounter], "-h")) {
+ printHelp();
+ return false;
+ }
+ const char* currentOption = argv[argCounter];
+ for (Option& option : optionList) {
+ if (option.matches(currentOption)) {
+ if (!option.parameterHandler)
+ status = false;
+ else if (option.hasArgument) {
+ const char * currentArgument = argv[++argCounter];
+ if (currentArgument)
+ status &= option.parameterHandler(options, currentOption, currentArgument);
+ else
+ status = false;
+ } else
+ status &= option.parameterHandler(options, currentOption, 0);
+ break;
+ }
+ }
+ }
+ return status;
+}
+
+void OptionsHandler::printHelp(FILE* channel)
+{
+ fputs(usage, channel);
+ fputs("\n\n -h|--help\n\t", channel);
+ fputs(help, channel);
+ fputs("\n\n", channel);
+ for (Option& option : optionList) {
+ if (!option.name)
+ continue;
+ fputs(" ", channel);
+ fputs(option.name, channel);
+ fputs((option.hasArgument ? " <param>\n\t" : "\n\t"), channel);
+ fputs(option.description, channel);
+ fputs("\n\n", channel);
+ }
+}
+
+} // namespace WTR
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerOptionsh"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/Options.h (0 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/Options.h         (rev 0)
+++ trunk/Tools/WebKitTestRunner/Options.h        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+/*
+ * Copyright (C) 2013 University of Szeged. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 Options_h
+#define Options_h
+
+#include <functional>
+#include <stdio.h>
+#include <string>
+#include <vector>
+#include <wtf/Vector.h>
+
+namespace WTR {
+
+struct Options {
+ Options(double, double);
+ double longTimeout;
+ double shortTimeout;
+ bool useWaitToDumpWatchdogTimer;
+ bool forceNoTimeout;
+ bool verbose;
+ bool gcBetweenTests;
+ bool shouldDumpPixelsForAllTests;
+ bool printSupportedFeatures;
+ bool forceComplexText;
+ bool shouldUseAcceleratedDrawing;
+ bool shouldUseRemoteLayerTree;
+ std::vector<std::string> paths;
+ double defaultLongTimeout;
+ double defaultShortTimeout;
+};
+
+class Option {
+public:
+ Option(const char* name, const char* description, std::function<bool(Options&, const char*, const char*)> parameterHandler, bool hasArgument = false);
+ bool matches(const char*);
+ const char* name;
+ const char* description;
+ std::function<bool(Options&, const char*, const char*)> parameterHandler;
+ bool hasArgument;
+};
+
+class OptionsHandler {
+public:
+ explicit OptionsHandler(Options&);
+ bool parse(int argc, const char* argv[]);
+ void printHelp(FILE* channel = stderr);
+private:
+ Vector<Option> optionList;
+ Options& options;
+ static const char* usage;
+ static const char* help;
+};
+
+} // namespace WTR
+
+#endif // Options_h
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (160626 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2013-12-16 04:04:10 UTC (rev 160626)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "TestController.h"
</span><span class="cx">
</span><span class="cx"> #include "EventSenderProxy.h"
</span><ins>+#include "Options.h"
</ins><span class="cx"> #include "PlatformWebView.h"
</span><span class="cx"> #include "StringFunctions.h"
</span><span class="cx"> #include "TestInvocation.h"
</span><span class="lines">@@ -266,74 +267,29 @@
</span><span class="cx"> {
</span><span class="cx"> platformInitialize();
</span><span class="cx">
</span><ins>+ Options options(defaultLongTimeout, defaultShortTimeout);
+ OptionsHandler optionsHandler(options);
+
</ins><span class="cx"> if (argc < 2) {
</span><del>- fputs("Usage: WebKitTestRunner [options] filename [filename2..n]\n", stderr);
- // FIXME: Refactor option parsing to allow us to print
- // an auto-generated list of options.
</del><ins>+ optionsHandler.printHelp();
</ins><span class="cx"> exit(1);
</span><span class="cx"> }
</span><ins>+ if (!optionsHandler.parse(argc, argv))
+ exit(1);
</ins><span class="cx">
</span><del>- bool printSupportedFeatures = false;
</del><ins>+ m_longTimeout = options.longTimeout;
+ m_shortTimeout = options.shortTimeout;
+ m_useWaitToDumpWatchdogTimer = options.useWaitToDumpWatchdogTimer;
+ m_forceNoTimeout = options.forceNoTimeout;
+ m_verbose = options.verbose;
+ m_gcBetweenTests = options.gcBetweenTests;
+ m_shouldDumpPixelsForAllTests = options.shouldDumpPixelsForAllTests;
+ m_forceComplexText = options.forceComplexText;
+ m_shouldUseAcceleratedDrawing = options.shouldUseAcceleratedDrawing;
+ m_shouldUseRemoteLayerTree = options.shouldUseRemoteLayerTree;
+ m_paths = options.paths;
</ins><span class="cx">
</span><del>- for (int i = 1; i < argc; ++i) {
- std::string argument(argv[i]);
-
- if (argument == "--timeout" && i + 1 < argc) {
- m_longTimeout = atoi(argv[++i]);
- // Scale up the short timeout to match.
- m_shortTimeout = defaultShortTimeout * m_longTimeout / defaultLongTimeout;
- continue;
- }
-
- if (argument == "--no-timeout") {
- m_useWaitToDumpWatchdogTimer = false;
- continue;
- }
-
- if (argument == "--no-timeout-at-all") {
- m_useWaitToDumpWatchdogTimer = false;
- m_forceNoTimeout = true;
- continue;
- }
-
- if (argument == "--verbose") {
- m_verbose = true;
- continue;
- }
- if (argument == "--gc-between-tests") {
- m_gcBetweenTests = true;
- continue;
- }
- if (argument == "--pixel-tests" || argument == "-p") {
- m_shouldDumpPixelsForAllTests = true;
- continue;
- }
- if (argument == "--print-supported-features") {
- printSupportedFeatures = true;
- break;
- }
- if (argument == "--complex-text") {
- m_forceComplexText = true;
- continue;
- }
- if (argument == "--accelerated-drawing") {
- m_shouldUseAcceleratedDrawing = true;
- continue;
- }
- if (argument == "--remote-layer-tree") {
- m_shouldUseRemoteLayerTree = true;
- continue;
- }
-
-
- // Skip any other arguments that begin with '--'.
- if (argument.length() >= 2 && argument[0] == '-' && argument[1] == '-')
- continue;
-
- m_paths.push_back(argument);
- }
-
- if (printSupportedFeatures) {
</del><ins>+ if (options.printSupportedFeatures) {
</ins><span class="cx"> // FIXME: On Windows, DumpRenderTree uses this to expose whether it supports 3d
</span><span class="cx"> // transforms and accelerated compositing. When we support those features, we
</span><span class="cx"> // should match DRT's behavior.
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (160626 => 160627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2013-12-16 04:04:10 UTC (rev 160626)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2013-12-16 04:58:10 UTC (rev 160627)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">                 65EB85A011EC67CC0034D300 /* ActivateFonts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65EB859F11EC67CC0034D300 /* ActivateFonts.mm */; };
</span><span class="cx">                 8034C6621487636400AC32E9 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8034C6611487636400AC32E9 /* AccessibilityControllerMac.mm */; };
</span><span class="cx">                 8097338A14874A5A008156D9 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */; };
</span><ins>+                841CC00F181185BF0042E9B6 /* Options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841CC00D181185BF0042E9B6 /* Options.cpp */; };
</ins><span class="cx">                 8CCDA823151A570B0003F937 /* SampleFont.sfont in Resources */ = {isa = PBXBuildFile; fileRef = 8CCDA822151A570B0003F937 /* SampleFont.sfont */; };
</span><span class="cx">                 A664BC7613A5F3A9009A7B25 /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; };
</span><span class="cx">                 BC14E4DB120E02D000826C0C /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4D9120E02D000826C0C /* GCController.cpp */; };
</span><span class="lines">@@ -174,6 +175,8 @@
</span><span class="cx">                 8034C6611487636400AC32E9 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = "<group>"; };
</span><span class="cx">                 8097338814874A5A008156D9 /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessibilityNotificationHandler.h; path = mac/AccessibilityNotificationHandler.h; sourceTree = "<group>"; };
</span><span class="cx">                 8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityNotificationHandler.mm; path = mac/AccessibilityNotificationHandler.mm; sourceTree = "<group>"; };
</span><ins>+                841CC00D181185BF0042E9B6 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Options.cpp; sourceTree = "<group>"; };
+                841CC00E181185BF0042E9B6 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Options.h; sourceTree = "<group>"; };
</ins><span class="cx">                 8CCDA822151A570B0003F937 /* SampleFont.sfont */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = SampleFont.sfont; path = fonts/SampleFont.sfont; sourceTree = "<group>"; };
</span><span class="cx">                 8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 BC14E4D8120E02D000826C0C /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -280,6 +283,8 @@
</span><span class="cx">                 08FB7795FE84155DC02AAC07 /* TestRunner */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                841CC00D181185BF0042E9B6 /* Options.cpp */,
+                                841CC00E181185BF0042E9B6 /* Options.h */,
</ins><span class="cx">                                 BC9192021333E4CD003011DC /* cg */,
</span><span class="cx">                                 BC7933FE118F7C74005EA8E2 /* mac */,
</span><span class="cx">                                 5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */,
</span><span class="lines">@@ -637,6 +642,7 @@
</span><span class="cx">                                 E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */,
</span><span class="cx">                                 3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */,
</span><span class="cx">                                 4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */,
</span><ins>+                                841CC00F181185BF0042E9B6 /* Options.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre>
</div>
</div>
</body>
</html>