summaryrefslogtreecommitdiffstats
path: root/WebKitTools
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools')
-rw-r--r--WebKitTools/ChangeLog399
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp45
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h14
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm12
-rw-r--r--WebKitTools/DumpRenderTree/mac/UIDelegate.mm4
-rw-r--r--WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp39
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp1
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h4
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp5
-rw-r--r--WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp6
-rw-r--r--WebKitTools/QtLauncher/main.cpp197
-rwxr-xr-xWebKitTools/Scripts/rebaseline-chromium-webkit-tests2
-rwxr-xr-xWebKitTools/Scripts/run-chromium-webkit-tests2
-rwxr-xr-xWebKitTools/Scripts/run-webkit-tests116
-rw-r--r--WebKitTools/Scripts/webkitdirs.pm25
-rw-r--r--WebKitTools/Scripts/webkitpy/committers.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils.py)12
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py)10
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py)10
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py)6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py)8
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server.py)4
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server_base.py)4
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/httpd2.pem (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/httpd2.pem)0
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/lighttpd.conf (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/lighttpd.conf)0
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/path_utils.py)64
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py (renamed from WebKitTools/Scripts/webkitpy/layout_tests/layout_package/websocket_server.py)8
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py6
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py18
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py6
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checker.py168
-rwxr-xr-xWebKitTools/Scripts/webkitpy/style/checker_unittest.py80
-rw-r--r--WebKitTools/Scripts/webkitpy/style/error_handlers.py44
-rw-r--r--WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py62
-rw-r--r--WebKitTools/Scripts/webkitpy/style/filter.py97
-rw-r--r--WebKitTools/Scripts/webkitpy/style/filter_unittest.py84
-rw-r--r--WebKitTools/Scripts/webkitpy/style/processors/common.py59
-rw-r--r--WebKitTools/Scripts/webkitpy/style/processors/common_unittest.py82
-rw-r--r--WebKitTools/Scripts/webkitpy/style/unittests.py2
-rw-r--r--WebKitTools/wx/build/settings.py1
51 files changed, 1348 insertions, 426 deletions
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 38cd459..ed2e4bf 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,402 @@
+2010-01-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Make run-webkit-tests work under Cygwin for the Qt port
+
+ setPathForRunningWebKitApp() is implemented for the Qt port
+ by using qmake to query for the location of the Qt libraries.
+
+ This requires the original environment (%ENV) to be untouched,
+ so launchWithCurrentEnv() was refactored to launchWithEnv(),
+ and the code in openDumpTool() to not use %ENV but a %CLEAN_ENV
+ instead. This has the added benefit of getting rid of the temp
+ variables used for storing the current env.
+
+ openDumpTool() is also refactored a bit into platform-spesific,
+ port-spesific, and generic environment variables.
+
+ Checks for undef was added a few places to fix Perl concat
+ warnings when run-webkit-tests is aborted.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33895
+
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitdirs.pm:
+
+2010-02-04 Yuzo Fujishima <yuzo@google.com>
+
+ Unreviewed.
+
+ Add Yuzo to the committers list.
+
+ * Scripts/webkitpy/committers.py:
+
+2010-02-03 Dirk Pranke <dpranke@chromium.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Change "the Chromium name" to "the name of Google Inc." in the licenses
+
+ https://bugs.webkit.org/show_bug.cgi?id=34511
+
+ * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/metered_stream.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_failures.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_files.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/apache_http_server.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+ * Scripts/webkitpy/layout_tests/port/http_server.py:
+ * Scripts/webkitpy/layout_tests/port/http_server_base.py:
+ * Scripts/webkitpy/layout_tests/port/path_utils.py:
+ * Scripts/webkitpy/layout_tests/port/websocket_server.py:
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+ * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
+2010-02-03 Dirk Pranke <dpranke@chromium.org>
+
+ Rubber-stamped by Eric Siedel.
+
+ Rename files as part of refactoring the layout_tests package. All
+ the platform_utils* module, the path_utils.py module, and
+ the http server and web socket server modules are moved into a new
+ port/ package.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34511
+
+ * Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/http_server.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/http_server_base.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/httpd2.pem: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/lighttpd.conf: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/path_utils.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py: Removed.
+ * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_files.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+ * Scripts/webkitpy/layout_tests/layout_package/websocket_server.py: Removed.
+ * Scripts/webkitpy/layout_tests/port: Added.
+ * Scripts/webkitpy/layout_tests/port/__init__.py: Copied from Scripts/webkitpy/layout_tests/layout_package/platform_utils.py.
+ * Scripts/webkitpy/layout_tests/port/apache_http_server.py: Copied from Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py.
+ * Scripts/webkitpy/layout_tests/port/chromium_linux.py: Copied from Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py.
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py: Copied from Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py.
+ * Scripts/webkitpy/layout_tests/port/chromium_win.py: Copied from Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py.
+ * Scripts/webkitpy/layout_tests/port/http_server.py: Copied from Scripts/webkitpy/layout_tests/layout_package/http_server.py.
+ * Scripts/webkitpy/layout_tests/port/http_server_base.py: Copied from Scripts/webkitpy/layout_tests/layout_package/http_server_base.py.
+ * Scripts/webkitpy/layout_tests/port/httpd2.pem: Copied from Scripts/webkitpy/layout_tests/layout_package/httpd2.pem.
+ * Scripts/webkitpy/layout_tests/port/lighttpd.conf: Copied from Scripts/webkitpy/layout_tests/layout_package/lighttpd.conf.
+ * Scripts/webkitpy/layout_tests/port/path_utils.py: Copied from Scripts/webkitpy/layout_tests/layout_package/path_utils.py.
+ * Scripts/webkitpy/layout_tests/port/websocket_server.py: Copied from Scripts/webkitpy/layout_tests/layout_package/websocket_server.py.
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+ * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
+
+2010-02-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Roll back r53559 and r54084 again, because roll out didn't solve flakeyness on the Windows Test bots
+ https://bugs.webkit.org/show_bug.cgi?id=34399
+
+ * Scripts/run-iexploder-tests:
+ * Scripts/run-webkit-httpd:
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitperl/httpd.pm: Added.
+
+2010-02-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Roll out r53559 and r54084, because it might caused flakeyness on the Windows Test bots
+
+ * Scripts/run-iexploder-tests:
+ * Scripts/run-webkit-httpd:
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitperl/httpd.pm: Removed.
+
+2010-02-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Ariya Hidayat.
+
+ Roll back r53889 again, because roll out didn't solve flakeyness on the Windows Test bots
+ https://bugs.webkit.org/show_bug.cgi?id=34399
+
+ * DumpRenderTree/win/EventSender.cpp:
+ (buildModifierFlags):
+ (mouseDownCallback):
+ (mouseUpCallback):
+ (keyDownCallback):
+
+2010-02-03 Eric Seidel <eric@webkit.org>
+
+ No review, just fixing copyrights.
+
+ Concerns were expressed about "The Chromium Authors" being
+ a valid legal entity for copyright assignment in the WebKit repository,
+ so this change removes all "The Chromium Authors".
+
+ I looked at the svn logs in src.chromium.org and failed to find any
+ non-google contributions to these files, so they are all now
+ marked as copyright "Google Inc" as all Google contributers assign
+ copyright to "Google Inc" as part of their employment agreement.
+
+ * Scripts/rebaseline-chromium-webkit-tests:
+ * Scripts/run-chromium-webkit-tests:
+ * Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py:
+ * Scripts/webkitpy/layout_tests/layout_package/http_server.py:
+ * Scripts/webkitpy/layout_tests/layout_package/http_server_base.py:
+ * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+ * Scripts/webkitpy/layout_tests/layout_package/metered_stream.py:
+ * Scripts/webkitpy/layout_tests/layout_package/path_utils.py:
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils.py:
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py:
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py:
+ * Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_failures.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_files.py:
+ * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+ * Scripts/webkitpy/layout_tests/layout_package/websocket_server.py:
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+ * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+ * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
+2010-02-03 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] QtLauncher, refactor argument handling in preparation of merge
+ with QGVLauncher
+
+ * QtLauncher/main.cpp:
+ (LauncherApplication::urls):
+ (LauncherApplication::isRobotized):
+ (LauncherApplication::applyDefaultSettings):
+ (LauncherApplication::LauncherApplication):
+ (LauncherApplication::formatKeys):
+ (LauncherApplication::enumToKeys):
+ (fail):
+ (LauncherApplication::handleUserOptions):
+ (main):
+
+2010-02-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Ariya Hidayat.
+
+ Rolling out r53889, because it might caused flakeyness on the Windows Test bots
+ https://bugs.webkit.org/show_bug.cgi?id=34399
+
+ * DumpRenderTree/win/EventSender.cpp:
+ (mouseDownCallback):
+ (mouseUpCallback):
+ (keyDownCallback):
+
+2010-02-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Fix pixel tests support.
+ https://bugs.webkit.org/show_bug.cgi?id=27813
+
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ (WebCore::DumpRenderTree::open):
+ (WebCore::DumpRenderTree::processLine):
+ - Hash processing mechanism moved from DumpRenderTree::open to DumpRenderTree::processLine.
+ (WebCore::DumpRenderTree::dump): Fixed and renamed variables.
+
+2010-02-03 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Enable JIT compilation for wx.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34536
+
+ * wx/build/settings.py:
+
+2010-02-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix after introduction of pageNumberForElementById.
+
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::pageNumberForElementById):
+
+2010-02-02 Shu Chang <Chang.Shu@nokia.com>
+
+ Unreviewed.
+
+ Add myself to list of committers.
+
+ * Scripts/webkitpy/committers.py:
+
+2010-02-02 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Moved filter-related check-webkit-style code into a separate
+ filter module.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34408
+
+ This is preparatory refactoring for Bug 33684, which will allow
+ file and folder-specific filter rules.
+
+ * Scripts/webkitpy/style/checker.py:
+ - Removed CategoryFilter class (moved to filter.py).
+
+ * Scripts/webkitpy/style/checker_unittest.py:
+ - Removed CategoryFilter unit tests (moved to filter_unittest.py).
+
+ * Scripts/webkitpy/style/filter.py: Added.
+ - Added CategoryFilter class (moved from checker.py).
+
+ * Scripts/webkitpy/style/filter_unittest.py: Added.
+ - Added CategoryFilter unit tests (moved from checker_unittest.py).
+
+ * Scripts/webkitpy/style/unittests.py:
+ - Added reference to filter_unittest.py.
+
+2010-02-01 Chris Jerdonek <cjerdonek@webkit.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Addressed FIXME in check-webkit-style so that the carriage-return
+ check will work for patches.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34260
+
+ Also added support for limiting the number of errors reported
+ per category, per file.
+
+ * Scripts/webkitpy/style/checker.py:
+ - Added new "whitespace/carriage_return" category from common.py.
+ - Added MAX_REPORTS_PER_CATEGORY dictionary.
+ - Added max_reports_per_category attribute to ProcessorOptions class.
+ - Refactored StyleChecker._process_file().
+
+ * Scripts/webkitpy/style/checker_unittest.py:
+ - Updated ProcessorOptionsTest tests.
+ - Added test to check MAX_REPORTS_PER_CATEGORY.
+
+ * Scripts/webkitpy/style/error_handlers.py:
+ - Added support for suppressing the display of errors after
+ reaching a per-category maximum (from max_reports_per_category).
+
+ * Scripts/webkitpy/style/error_handlers_unittest.py:
+ - Added test for suppressing error display.
+
+ * Scripts/webkitpy/style/processors/common.py: Added.
+ - Moved carriage-return check to new file.
+
+ * Scripts/webkitpy/style/processors/common_unittest.py: Added.
+ - Added unit tests for carriage-return check.
+
+ * Scripts/webkitpy/style/unittests.py:
+ - Added reference to common_unittest.py.
+
+2010-02-01 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Provide a way to get page number with layoutTestController
+ https://bugs.webkit.org/show_bug.cgi?id=33840
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (pageNumberForElementByIdCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::pageNumberForElementById):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::pageNumberForElementById):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::pageNumberForElementById):
+
+2010-02-01 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Unreviewed fix for an invalid function call.
+
+ check-webkit-style: Remove filename parameter from all functions where no longer used
+ https://bugs.webkit.org/show_bug.cgi?id=34249
+
+ * Scripts/webkitpy/style/checker.py:
+
+2010-02-01 Diego Gonzalez <diego.gonzalez@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] DRT Provide global flag ability
+ https://bugs.webkit.org/show_bug.cgi?id=34418
+
+ Add the globalFlag property to the Qt LayoutTestController to allow
+ cross-domain indications.
+
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::reset):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ (LayoutTestController::globalFlag):
+ (LayoutTestController::setGlobalFlag):
+
+2010-02-01 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Crash in Safari opening new tabs to "same page"
+ <rdar://problem/7593857> and https://bugs.webkit.org/show_bug.cgi?id=34444
+
+ Add a mode (Mac-only for now) that exercises the WebView SPI _loadBackForwardListFromOtherView:
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (setNewWindowsCopyBackForwardListCallback):
+ (LayoutTestController::staticFunctions):
+
+ * DumpRenderTree/LayoutTestController.h:
+ (LayoutTestController::newWindowsCopyBackForwardList):
+ (LayoutTestController::setNewWindowsCopyBackForwardList):
+
+ * DumpRenderTree/mac/UIDelegate.mm:
+ (-[UIDelegate webView:createWebViewWithRequest:]):
+
+2010-02-01 Carol Szabo <carol.szabo@nokia.com>
+
+ Unreviewed.
+
+ Add myself to list of committers.
+
+ * Scripts/webkitpy/committers.py:
+
+2010-02-01 Nate Chapin <japhet@chromium.org>
+
+ Rubber-stamped by David Levin.
+
+ Add myself to reviewer list.
+
+ * Scripts/webkitpy/committers.py:
+
2010-01-31 Chris Jerdonek <cjerdonek@webkit.org>
Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index e71cd29..0537d7c 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -61,6 +61,7 @@ LayoutTestController::LayoutTestController(const std::string& testPathOrURL, con
, m_callCloseOnWebViews(true)
, m_canOpenWindows(false)
, m_closeRemainingWindowsWhenComplete(true)
+ , m_newWindowsCopyBackForwardList(false)
, m_stopProvisionalFrameLoads(false)
, m_testOnscreen(false)
, m_testRepaint(false)
@@ -464,6 +465,36 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}
+static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // FIXME: These values should sync with maxViewWidth/Height in
+ // DumpRenderTree.mm. Factor these values out to somewhere.
+ float pageWidthInPixels = 800;
+ float pageHeightInPixels = 600;
+ switch (argumentCount) {
+ case 1:
+ break;
+ case 3:
+ pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
+ if (*exception)
+ return JSValueMakeUndefined(context);
+ pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[2], exception));
+ if (*exception)
+ return JSValueMakeUndefined(context);
+ break;
+ default:
+ return JSValueMakeUndefined(context);
+ }
+
+ JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+ if (*exception)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ int pageNumber = controller->pageNumberForElementById(elementId.get(), pageWidthInPixels, pageHeightInPixels);
+ return JSValueMakeNumber(context, pageNumber);
+}
+
static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -743,6 +774,18 @@ static JSValueRef setMockGeolocationErrorCallback(JSContextRef context, JSObject
return JSValueMakeUndefined(context);
}
+static JSValueRef setNewWindowsCopyBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setNewWindowsCopyBackForwardList(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setGeolocationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac implementation
@@ -1289,6 +1332,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -1324,6 +1368,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index c8da6ab..76e7cb3 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -57,6 +57,7 @@ public:
void keepWebHistory();
void notifyDone();
void overridePreference(JSStringRef key, JSStringRef value);
+ int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
void queueBackNavigation(int howFarBackward);
void queueForwardNavigation(int howFarForward);
@@ -66,28 +67,29 @@ public:
void queueReload();
void removeAllVisitedLinks();
void setAcceptsEditing(bool acceptsEditing);
- void setAppCacheMaximumSize(unsigned long long quota);
void setAllowUniversalAccessFromFileURLs(bool);
+ void setAppCacheMaximumSize(unsigned long long quota);
void setAuthorAndUserStylesEnabled(bool);
void setCacheModel(int);
void setCustomPolicyDelegate(bool setDelegate, bool permissive);
void setDatabaseQuota(unsigned long long quota);
void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme);
- void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
- void setMockGeolocationError(int code, JSStringRef message);
void setIconDatabaseEnabled(bool iconDatabaseEnabled);
void setJavaScriptProfilingEnabled(bool profilingEnabled);
void setMainFrameIsFirstResponder(bool flag);
+ void setMockGeolocationError(int code, JSStringRef message);
+ void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setPersistentUserStyleSheetLocation(JSStringRef path);
void setPopupBlockingEnabled(bool flag);
void setPrivateBrowsingEnabled(bool flag);
- void setXSSAuditorEnabled(bool flag);
void setSelectTrailingWhitespaceEnabled(bool flag);
void setSmartInsertDeleteEnabled(bool flag);
void setTabKeyCyclesThroughElements(bool cycles);
void setUseDashboardCompatibilityMode(bool flag);
void setUserStyleSheetEnabled(bool flag);
void setUserStyleSheetLocation(JSStringRef path);
+ void setXSSAuditorEnabled(bool flag);
+
void waitForPolicyDelegate();
size_t webHistoryItemCount();
unsigned workerThreadCount() const;
@@ -161,6 +163,9 @@ public:
bool closeRemainingWindowsWhenComplete() const { return m_closeRemainingWindowsWhenComplete; }
void setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete) { m_closeRemainingWindowsWhenComplete = closeRemainingWindowsWhenComplete; }
+ bool newWindowsCopyBackForwardList() const { return m_newWindowsCopyBackForwardList; }
+ void setNewWindowsCopyBackForwardList(bool newWindowsCopyBackForwardList) { m_newWindowsCopyBackForwardList = newWindowsCopyBackForwardList; }
+
bool stopProvisionalFrameLoads() const { return m_stopProvisionalFrameLoads; }
void setStopProvisionalFrameLoads(bool stopProvisionalFrameLoads) { m_stopProvisionalFrameLoads = stopProvisionalFrameLoads; }
@@ -248,6 +253,7 @@ private:
bool m_callCloseOnWebViews;
bool m_canOpenWindows;
bool m_closeRemainingWindowsWhenComplete;
+ bool m_newWindowsCopyBackForwardList;
bool m_stopProvisionalFrameLoads;
bool m_testOnscreen;
bool m_testRepaint;
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index a74f7ad..bad09fb 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -140,6 +140,12 @@ void LayoutTestController::keepWebHistory()
// FIXME: implement
}
+int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
+{
+ // FIXME: implement
+ return -1;
+}
+
size_t LayoutTestController::webHistoryItemCount()
{
// FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 5f020fa..67c8c91 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -176,6 +176,18 @@ void LayoutTestController::keepWebHistory()
}
}
+int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels)
+{
+ RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, id));
+ NSString *idNS = (NSString *)idCF.get();
+
+ DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS];
+ if (!element)
+ return -1;
+
+ return [mainFrame pageNumberForElement:element:pageWidthInPixels:pageHeightInPixels];
+}
+
size_t LayoutTestController::webHistoryItemCount()
{
return [[[WebHistory optionalSharedHistory] allItems] count];
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
index 81c03d2..19ceb95 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
@@ -38,6 +38,7 @@
#import <WebKit/WebSecurityOriginPrivate.h>
#import <WebKit/WebUIDelegatePrivate.h>
#import <WebKit/WebView.h>
+#import <WebKit/WebViewPrivate.h>
#import <wtf/Assertions.h>
DumpRenderTreeDraggingInfo *draggingInfo = nil;
@@ -122,6 +123,9 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
WebView *webView = createWebViewAndOffscreenWindow();
+ if (gLayoutTestController->newWindowsCopyBackForwardList())
+ [webView _loadBackForwardListFromOtherView:sender];
+
return [webView autorelease];
}
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index 9916f24..c16a786 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -412,23 +412,10 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting()
setlocale(LC_ALL, "");
}
-void DumpRenderTree::open(const QUrl& aurl)
+void DumpRenderTree::open(const QUrl& url)
{
resetToConsistentStateBeforeTesting();
- QUrl url = aurl;
- m_expectedHash = QString();
- if (m_dumpPixels) {
- // single quote marks the pixel dump hash
- QString str = url.toString();
- int i = str.indexOf('\'');
- if (i > -1) {
- m_expectedHash = str.mid(i + 1, str.length());
- str.remove(i, str.length());
- url = QUrl(str);
- }
- }
-
// W3C SVG tests expect to be 480x360
bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1");
int width = isW3CTest ? 480 : maxViewWidth;
@@ -477,6 +464,16 @@ void DumpRenderTree::processLine(const QString &input)
{
QString line = input;
+ m_expectedHash = QString();
+ if (m_dumpPixels) {
+ // single quote marks the pixel dump hash
+ int i = line.indexOf('\'');
+ if (i > -1) {
+ m_expectedHash = line.mid(i + 1, line.length());
+ line.remove(i, line.length());
+ }
+ }
+
if (line.startsWith(QLatin1String("http:"))
|| line.startsWith(QLatin1String("https:"))
|| line.startsWith(QLatin1String("file:"))) {
@@ -720,14 +717,16 @@ void DumpRenderTree::dump()
printf("Content-Type: %s\n", "image/png");
printf("Content-Length: %lu\n", static_cast<unsigned long>(data.length()));
+ const quint32 bytesToWriteInOneChunk = 1 << 15;
+ quint32 dataRemainingToWrite = data.length();
const char *ptr = data.data();
- for(quint32 left = data.length(); left; ) {
- quint32 block = qMin(left, quint32(1 << 15));
- quint32 written = fwrite(ptr, 1, block, stdout);
- ptr += written;
- left -= written;
- if (written == block)
+ while (dataRemainingToWrite) {
+ quint32 bytesToWriteInThisChunk = qMin(dataRemainingToWrite, bytesToWriteInOneChunk);
+ quint32 bytesWritten = fwrite(ptr, 1, bytesToWriteInThisChunk, stdout);
+ if (bytesWritten != bytesToWriteInThisChunk)
break;
+ dataRemainingToWrite -= bytesWritten;
+ ptr += bytesWritten;
}
}
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 9430ec7..ca48003 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -73,6 +73,7 @@ void LayoutTestController::reset()
m_waitForPolicy = false;
m_handleErrorPages = false;
m_webHistory = 0;
+ m_globalFlag = false;
qt_dump_editing_callbacks(false);
qt_dump_resource_load_callbacks(false);
emit hidePage();
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 64b3a15..365640d 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -53,6 +53,7 @@ class LayoutTestController : public QObject {
Q_OBJECT
Q_PROPERTY(int webHistoryItemCount READ webHistoryItemCount)
Q_PROPERTY(int workerThreadCount READ workerThreadCount)
+ Q_PROPERTY(bool globalFlag READ globalFlag WRITE setGlobalFlag)
public:
LayoutTestController(WebCore::DumpRenderTree* drt);
@@ -91,6 +92,8 @@ public slots:
void keepWebHistory();
void notifyDone();
void dumpBackForwardList() { m_dumpBackForwardList = true; }
+ bool globalFlag() const { return m_globalFlag; }
+ void setGlobalFlag(bool flag) { m_globalFlag = flag; }
void handleErrorPages() { m_handleErrorPages = true; }
void dumpEditingCallbacks();
void dumpResourceLoadCallbacks();
@@ -160,6 +163,7 @@ private:
bool m_waitForPolicy;
bool m_handleErrorPages;
bool m_loadFinished;
+ bool m_globalFlag;
QUrl m_userStyleSheetLocation;
QBasicTimer m_timeoutTimer;
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index b7a63fc..4f5e925 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -1104,3 +1104,8 @@ JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStri
return counterValueJS;
}
+int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
+{
+ // FIXME: implement
+ return -1;
+}
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 4b811ec..6d3b624 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -359,3 +359,9 @@ JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStri
{
return 0;
}
+
+int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
+{
+ // FIXME: implement
+ return -1;
+}
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index 081b8f0..31bca8e 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -525,8 +525,6 @@ QObject* WebPage::createPlugin(const QString &classId, const QUrl&, const QStrin
}
-#include "main.moc"
-
int launcherMain(const QApplication& app)
{
#ifndef NDEBUG
@@ -539,60 +537,185 @@ int launcherMain(const QApplication& app)
#endif
}
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- QString defaultUrl = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
+class LauncherApplication : public QApplication {
+ Q_OBJECT
- QWebSettings::setMaximumPagesInCache(4);
+public:
+ LauncherApplication(int& argc, char** argv);
+ QStringList urls() const { return m_urls; }
+ bool isRobotized() const { return m_isRobotized; }
+
+private:
+ void handleUserOptions();
+ void applyDefaultSettings();
- app.setApplicationName("QtLauncher");
- app.setApplicationVersion("0.1");
+ QList<QString> enumToKeys(const QMetaObject o, const QString& name, const QString& strip);
+ QString formatKeys(QList<QString> keys);
+
+private:
+ bool m_isRobotized;
+ QStringList m_urls;
+};
+
+void LauncherApplication::applyDefaultSettings()
+{
+ QWebSettings::setMaximumPagesInCache(4);
QWebSettings::setObjectCacheCapacities((16*1024*1024) / 8, (16*1024*1024) / 8, 16*1024*1024);
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebSettings::enablePersistentStorage();
+}
+LauncherApplication::LauncherApplication(int& argc, char** argv)
+ : QApplication(argc, argv)
+ , m_isRobotized(false)
+{
// To allow QWebInspector's configuration persistence
- QCoreApplication::setOrganizationName("Nokia");
- QCoreApplication::setApplicationName("QtLauncher");
+ setOrganizationName("Nokia");
+ setApplicationName("QtLauncher");
+ setApplicationVersion("0.1");
- const QStringList args = app.arguments();
+ applyDefaultSettings();
- if (args.contains(QLatin1String("-r"))) {
- // robotized
- QString listFile = args.at(2);
- if (!(args.count() == 3) && QFile::exists(listFile)) {
- qDebug() << "Usage: QtLauncher -r listfile";
- exit(0);
+ handleUserOptions();
+}
+
+QString LauncherApplication::formatKeys(QList<QString> keys)
+{
+ QString result;
+ for (int i = 0; i < keys.count() - 1; i++)
+ result.append(keys.at(i) + "|");
+ result.append(keys.last());
+ return result;
+}
+
+QList<QString> LauncherApplication::enumToKeys(const QMetaObject o, const QString& name, const QString& strip)
+{
+ QList<QString> list;
+
+ int enumIndex = o.indexOfEnumerator(name.toLatin1().data());
+ QMetaEnum enumerator = o.enumerator(enumIndex);
+
+ if (enumerator.isValid()) {
+ for (int i = 0; i < enumerator.keyCount(); i++) {
+ QString key(enumerator.valueToKey(i));
+ list.append(key.remove(strip));
}
+ }
+
+ return list;
+}
+
+static void fail(const QString& errorMsg)
+{
+ qDebug() << "ERROR:" << errorMsg.toLatin1().data();
+ exit(1);
+}
+
+void LauncherApplication::handleUserOptions()
+{
+ QStringList args = arguments();
+ QFileInfo program(args.at(0));
+ QString programName("QtLauncher");
+ if (program.exists())
+ programName = program.baseName();
+
+ QList<QString> updateModes(enumToKeys(QGraphicsView::staticMetaObject,
+ "ViewportUpdateMode", "ViewportUpdate"));
+
+ if (args.contains("--help")) {
+ qDebug() << "Usage:" << programName.toLatin1().data()
+ << "[--graphicsbased]"
+ << "[--compositing]"
+ << QString("[--viewport-update-mode %1]").arg(formatKeys(updateModes)).toLatin1().data()
+ << "[--cache-webview]"
+ << "[-r list]"
+ << "URLs";
+ exit(0);
+ }
+
+ bool useGraphicsView = false;
+
+ if (args.contains("--graphicsbased"))
+ useGraphicsView = true;
+
+ if (args.contains("--compositing") && useGraphicsView)
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
+
+ if (args.contains("--cache-webview") && useGraphicsView)
+ ; // view->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+
+ int modeIndex = args.indexOf("--viewport-update-mode");
+ if (modeIndex != -1 && ++modeIndex < args.count() && !args.at(modeIndex).startsWith("-")) {
+ QString mode = args.takeAt(modeIndex);
+ if (useGraphicsView) {
+ int idx = updateModes.indexOf(mode);
+ if (idx != -1) {
+ ; // view->setViewportUpdateMode(static_cast<QGraphicsView::ViewportUpdateMode>(idx));
+ } else {
+ fail(QString("--viewport-update-mode value has to be one of [%1]")
+ .arg(formatKeys(updateModes)).toLatin1().data());
+ }
+ }
+ }
+
+ int robotIndex = args.indexOf("-r");
+ if (robotIndex != -1) {
+ if (++robotIndex < args.count() && !args.at(robotIndex).startsWith("-")) {
+ QString listFile = args.takeAt(robotIndex);
+ if (!QFile::exists(listFile))
+ fail(QString("The list file supplied to -r does not exist."));
+ else {
+ m_isRobotized = true;
+ m_urls = QStringList(listFile);
+ return;
+ }
+ }
+ else
+ fail(QString("-r needs a list file to start in robotized mode"));
+ }
+
+ int lastArg = args.lastIndexOf(QRegExp("^-.*"));
+ m_urls = (lastArg != -1) ? args.mid(++lastArg) : args.mid(1);
+}
+
+
+int main(int argc, char **argv)
+{
+ LauncherApplication app(argc, argv);
+
+ if (app.isRobotized()) {
LauncherWindow* window = new LauncherWindow;
QWebView* view = window->webView();
- UrlLoader loader(view->page()->mainFrame(), listFile);
+ UrlLoader loader(view->page()->mainFrame(), app.urls().at(0));
QObject::connect(view->page()->mainFrame(), SIGNAL(loadFinished(bool)), &loader, SLOT(loadNext()));
loader.loadNext();
window->show();
- launcherMain(app);
- } else {
- LauncherWindow* window = 0;
-
- // Look though the args for something we can open
- for (int i = 1; i < args.count(); i++) {
- if (!args.at(i).startsWith("-")) {
- if (!window)
- window = new LauncherWindow(args.at(i));
- else
- window->newWindow(args.at(i));
- }
- }
+ return launcherMain(app);
+ }
- // If not, just open the default URL
- if (!window)
- window = new LauncherWindow(defaultUrl);
+ QStringList urls = app.urls();
- window->show();
- launcherMain(app);
+ if (urls.isEmpty()) {
+ QString defaultUrl = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
+ if (QDir(defaultUrl).exists())
+ urls.append(defaultUrl);
+ else
+ urls.append("");
+ }
+
+ LauncherWindow* window = 0;
+ foreach (QString url, urls) {
+ if (!window)
+ window = new LauncherWindow(url);
+ else
+ window->newWindow(url);
}
+
+ window->show();
+ return launcherMain(app);
}
+
+#include "main.moc"
diff --git a/WebKitTools/Scripts/rebaseline-chromium-webkit-tests b/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
index d22c0c4..9a8a156 100755
--- a/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
+++ b/WebKitTools/Scripts/rebaseline-chromium-webkit-tests
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
diff --git a/WebKitTools/Scripts/run-chromium-webkit-tests b/WebKitTools/Scripts/run-chromium-webkit-tests
index 8712836..9c027b8 100755
--- a/WebKitTools/Scripts/run-chromium-webkit-tests
+++ b/WebKitTools/Scripts/run-chromium-webkit-tests
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests
index bb4fb34..6b21e48 100755
--- a/WebKitTools/Scripts/run-webkit-tests
+++ b/WebKitTools/Scripts/run-webkit-tests
@@ -87,7 +87,7 @@ sub expectedDirectoryForTest($;$;$);
sub fileNameWithNumber($$);
sub htmlForResultsSection(\@$&);
sub isTextOnlyTest($);
-sub launchWithCurrentEnv(@);
+sub launchWithEnv(\@\%);
sub resolveAndMakeTestResultsDirectory();
sub numericcmp($$);
sub openDiffTool();
@@ -659,7 +659,7 @@ for my $test (@tests) {
} else {
$testPath = canonpath($testPath);
}
- print OUT "$testPath$suffixExpectedHash\n";
+ print OUT "$testPath$suffixExpectedHash\n" if defined $testPath;
}
# DumpRenderTree is expected to dump two "blocks" to stdout for each test.
@@ -1027,6 +1027,10 @@ if (isGtk()) {
system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
} elsif (isQt()) {
unshift @configurationArgs, qw(-graphicssystem raster -style windows);
+ if (isCygwin()) {
+ $testResults = "/" . toWindowsPath($testResults);
+ $testResults =~ s/\\/\//g;
+ }
system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
} elsif (isCygwin()) {
system "cygstart", $testResults if $launchSafari;
@@ -1210,20 +1214,20 @@ sub slowestcmp($$)
return pathcmp($testa, $testb);
}
-sub launchWithCurrentEnv(@)
+sub launchWithEnv(\@\%)
{
- my (@args) = @_;
+ my ($args, $env) = @_;
# Dump the current environment as perl code and then put it in quotes so it is one parameter.
- my $environmentDumper = Data::Dumper->new([\%ENV], [qw(*ENV)]);
+ my $environmentDumper = Data::Dumper->new([\%{$env}], [qw(*ENV)]);
$environmentDumper->Indent(0);
$environmentDumper->Purity(1);
my $allEnvVars = $environmentDumper->Dump();
- unshift @args, "\"$allEnvVars\"";
+ unshift @{$args}, "\"$allEnvVars\"";
my $execScript = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts execAppWithEnv));
- unshift @args, $execScript;
- return @args;
+ unshift @{$args}, $execScript;
+ return @{$args};
}
sub resolveAndMakeTestResultsDirectory()
@@ -1238,10 +1242,9 @@ sub openDiffTool()
return if $isDiffToolOpen;
return if !$pixelTests;
- local %ENV;
- $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
- $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithCurrentEnv(@diffToolArgs)) or die "unable to open $imageDiffTool\n";
- $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
+ my %CLEAN_ENV;
+ $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
+ $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die "unable to open $imageDiffTool\n";
$isDiffToolOpen = 1;
}
@@ -1249,56 +1252,53 @@ sub openDumpTool()
{
return if $isDumpToolOpen;
- # Save environment variables required for the linux environment.
- my $homeDir = $ENV{'HOME'};
- my $libraryPath = $ENV{'LD_LIBRARY_PATH'};
- my $dyldLibraryPath = $ENV{'DYLD_LIBRARY_PATH'};
- my $dbusAddress = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
- my $display = $ENV{'DISPLAY'};
- my $xauthority = $ENV{'XAUTHORITY'};
- my $testfonts = $ENV{'WEBKIT_TESTFONTS'};
-
- my $homeDrive = $ENV{'HOMEDRIVE'};
- my $homePath = $ENV{'HOMEPATH'};
-
- local %ENV;
- if (isQt() || isGtk()) {
- if (defined $display) {
- $ENV{DISPLAY} = $display;
+ my %CLEAN_ENV;
+
+ # Generic environment variables
+ if (defined $ENV{'WEBKIT_TESTFONTS'}) {
+ $CLEAN_ENV{WEBKIT_TESTFONTS} = $ENV{'WEBKIT_TESTFONTS'};
+ }
+
+ $CLEAN_ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
+
+ # Platform spesifics
+ if (isLinux()) {
+ if (defined $ENV{'DISPLAY'}) {
+ $CLEAN_ENV{DISPLAY} = $ENV{'DISPLAY'};
} else {
- $ENV{DISPLAY} = ":1";
+ $CLEAN_ENV{DISPLAY} = ":1";
}
- if (defined $xauthority) {
- $ENV{XAUTHORITY} = $xauthority;
+ if (defined $ENV{'XAUTHORITY'}) {
+ $CLEAN_ENV{XAUTHORITY} = $ENV{'XAUTHORITY'};
}
- $ENV{'WEBKIT_TESTFONTS'} = $testfonts if defined($testfonts);
- $ENV{HOME} = $homeDir;
- if (defined $libraryPath) {
- $ENV{LD_LIBRARY_PATH} = $libraryPath;
+
+ $CLEAN_ENV{HOME} = $ENV{'HOME'};
+
+ if (defined $ENV{'LD_LIBRARY_PATH'}) {
+ $CLEAN_ENV{LD_LIBRARY_PATH} = $ENV{'LD_LIBRARY_PATH'};
}
- if (defined $dyldLibraryPath) {
- $ENV{DYLD_LIBRARY_PATH} = $dyldLibraryPath;
+ if (defined $ENV{'DBUS_SESSION_BUS_ADDRESS'}) {
+ $CLEAN_ENV{DBUS_SESSION_BUS_ADDRESS} = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
}
- if (defined $dbusAddress) {
- $ENV{DBUS_SESSION_BUS_ADDRESS} = $dbusAddress;
+ } elsif (isDarwin()) {
+ if (defined $ENV{'DYLD_LIBRARY_PATH'}) {
+ $CLEAN_ENV{DYLD_LIBRARY_PATH} = $ENV{'DYLD_LIBRARY_PATH'};
}
+
+ $CLEAN_ENV{DYLD_FRAMEWORK_PATH} = $productDir;
+ $CLEAN_ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
+ } elsif (isCygwin()) {
+ $CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
+ $CLEAN_ENV{HOMEPATH} = $ENV{'HOMEPATH'};
+
+ setPathForRunningWebKitApp(\%CLEAN_ENV);
}
+
+ # Port spesifics
if (isQt()) {
- $ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
+ $CLEAN_ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
}
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
- $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
- if (isCygwin()) {
- $ENV{HOMEDRIVE} = $homeDrive;
- $ENV{HOMEPATH} = $homePath;
- if ($testfonts) {
- $ENV{WEBKIT_TESTFONTS} = $testfonts;
- }
- setPathForRunningWebKitApp(\%ENV) if isCygwin();
- }
-
my @args = ($dumpTool, @toolArgs);
if (isAppleMacWebKit() and !isTiger()) {
unshift @args, "arch", "-" . architecture();
@@ -1307,10 +1307,10 @@ sub openDumpTool()
if ($useValgrind) {
unshift @args, "valgrind", "--suppressions=$platformBaseDirectory/qt/SuppressedValgrindErrors";
}
-
- $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
- $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithCurrentEnv(@args)) or die "Failed to start tool: $dumpTool\n";
- $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
+
+ $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
+
+ $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
$isDumpToolOpen = 1;
$dumpToolCrashed = 0;
}
@@ -1337,7 +1337,6 @@ sub dumpToolDidCrash()
{
return 1 if $dumpToolCrashed;
return 0 unless $isDumpToolOpen;
-
my $pid = waitpid(-1, WNOHANG);
return 1 if ($pid == $dumpToolPID);
@@ -1617,7 +1616,8 @@ sub convertPathUsingCygpath($$)
local *inFH = $cygpath->{"in"};
local *outFH = $cygpath->{"out"};
print outFH $path . "\n";
- chomp(my $convertedPath = <inFH>);
+ my $convertedPath = <inFH>;
+ chomp($convertedPath) if defined $convertedPath;
return $convertedPath;
}
diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm
index d667a8a..8b2ecc1 100644
--- a/WebKitTools/Scripts/webkitdirs.pm
+++ b/WebKitTools/Scripts/webkitdirs.pm
@@ -541,9 +541,10 @@ sub builtDylibPathForName
if (isDarwin() and -d "$configurationProductDir/lib/$libraryName.framework") {
return "$configurationProductDir/lib/$libraryName.framework/$libraryName";
} elsif (isWindows()) {
- chomp(my $mkspec = `qmake -query QMAKE_MKSPECS`);
+ my $mkspec = `qmake -query QMAKE_MKSPECS`;
+ $mkspec =~ s/[\n|\r]$//g;
my $qtMajorVersion = retrieveQMakespecVar("$mkspec/qconfig.pri", "QT_MAJOR_VERSION");
- if ($qtMajorVersion eq "unknown") {
+ if (not $qtMajorVersion) {
$qtMajorVersion = "";
}
return "$configurationProductDir/lib/$libraryName$qtMajorVersion.dll";
@@ -1328,11 +1329,11 @@ sub retrieveQMakespecVar
my $mkspec = $_[0];
my $varname = $_[1];
- my $compiler = "unknown";
+ my $varvalue = undef;
#print "retrieveMakespecVar " . $mkspec . ", " . $varname . "\n";
local *SPEC;
- open SPEC, "<$mkspec" or return "make";
+ open SPEC, "<$mkspec" or return $varvalue;
while (<SPEC>) {
if ($_ =~ /\s*include\((.+)\)/) {
# open the included mkspec
@@ -1340,15 +1341,15 @@ sub retrieveQMakespecVar
(my $volume, my $directories, my $file) = File::Spec->splitpath($mkspec);
my $newcwd = "$volume$directories";
chdir $newcwd if $newcwd;
- $compiler = retrieveQMakespecVar($1, $varname);
+ $varvalue = retrieveQMakespecVar($1, $varname);
chdir $oldcwd;
} elsif ($_ =~ /$varname\s*=\s*([^\s]+)/) {
- $compiler = $1;
+ $varvalue = $1;
last;
}
}
close SPEC;
- return $compiler;
+ return $varvalue;
}
sub qtMakeCommand($)
@@ -1645,9 +1646,13 @@ sub setPathForRunningWebKitApp
{
my ($env) = @_;
- return unless isAppleWinWebKit();
-
- $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
+ if (isAppleWinWebKit()) {
+ $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
+ } elsif (isQt()) {
+ my $qtLibs = `qmake -query QT_INSTALL_LIBS`;
+ $qtLibs =~ s/[\n|\r]$//g;
+ $env->{PATH} = join(';', $qtLibs, productDir() . "/lib", $env->{PATH} || "");
+ }
}
sub runSafari
diff --git a/WebKitTools/Scripts/webkitpy/committers.py b/WebKitTools/Scripts/webkitpy/committers.py
index 73e4172..0efb4e7 100644
--- a/WebKitTools/Scripts/webkitpy/committers.py
+++ b/WebKitTools/Scripts/webkitpy/committers.py
@@ -80,6 +80,8 @@ committers_unable_to_review = [
Committer("Brett Wilson", "brettw@chromium.org"),
Committer("Brian Weinstein", "bweinstein@apple.com"),
Committer("Cameron McCormack", "cam@webkit.org"),
+ Committer("Carol Szabo", "carol.szabo@nokia.com"),
+ Committer("Chang Shu", "chang.shu@nokia.com"),
Committer("Chris Fleizach", "cfleizach@apple.com"),
Committer("Chris Jerdonek", "cjerdonek@webkit.org"),
Committer("Chris Marrin", "cmarrin@apple.com"),
@@ -131,7 +133,7 @@ committers_unable_to_review = [
Committer("Mike Belshe", ["mbelshe@chromium.org", "mike@belshe.com"]),
Committer("Mike Fenton", ["mike.fenton@torchmobile.com", "mifenton@rim.com"]),
Committer("Mike Thole", ["mthole@mikethole.com", "mthole@apple.com"]),
- Committer("Nate Chapin", "japhet@chromium.org"),
+ Committer("Mikhail Naganov", "mnaganov@chromium.org"),
Committer("Ojan Vafai", "ojan@chromium.org"),
Committer("Pam Greene", "pam@chromium.org"),
Committer("Peter Kasting", ["pkasting@google.com", "pkasting@chromium.org"]),
@@ -153,6 +155,7 @@ committers_unable_to_review = [
Committer("Yong Li", ["yong.li@torchmobile.com", "yong.li.webkit@gmail.com"]),
Committer("Yongjun Zhang", "yongjun.zhang@nokia.com"),
Committer("Yury Semikhatsky", "yurys@chromium.org"),
+ Committer("Yuzo Fujishima", "yuzo@google.com"),
Committer("Zoltan Herczeg", "zherczeg@webkit.org"),
Committer("Zoltan Horvath", "zoltan@webkit.org"),
]
@@ -211,6 +214,7 @@ reviewers_list = [
Reviewer("Laszlo Gombos", "laszlo.1.gombos@nokia.com"),
Reviewer("Maciej Stachowiak", "mjs@apple.com"),
Reviewer("Mark Rowe", "mrowe@apple.com"),
+ Reviewer("Nate Chapin", "japhet@chromium.org"),
Reviewer("Nikolas Zimmermann", ["zimmermann@kde.org", "zimmermann@physik.rwth-aachen.de", "zimmermann@webkit.org"]),
Reviewer("Oliver Hunt", "oliver@apple.com"),
Reviewer("Pavel Feldman", "pfeldman@chromium.org"),
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
index b7b26e9..f38a7ab 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -31,7 +31,7 @@ import logging
import os
from layout_package import json_results_generator
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_expectations
from layout_package import test_failures
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
index 596e1e4..dc24ade 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -35,7 +35,7 @@ import time
import urllib2
import xml.dom.minidom
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_expectations
sys.path.append(path_utils.path_from_base('third_party', 'WebKit',
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
index 6c094e3..72b30a1 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
index f1647f7..5b0d186 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -36,7 +36,7 @@ import os
import re
import sys
import time
-import path_utils
+from port import path_utils
sys.path.append(path_utils.path_from_base('third_party', 'WebKit',
'WebKitTools'))
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py
index 6957dea..56d7b5a 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
index 91fe136..b7e620d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_files.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -36,7 +36,7 @@ under that directory."""
import glob
import os
-import path_utils
+from port import path_utils
# When collecting test cases, we include any file with these extensions.
_supported_file_extensions = set(['.html', '.shtml', '.xml', '.xhtml', '.pl',
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
index 10d0509..9f52686 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -46,7 +46,7 @@ import thread
import threading
import time
-import path_utils
+from port import path_utils
import test_failures
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
index 09e7b4b..1730085 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -30,7 +30,7 @@
"""Platform-specific utilities and pseudo-constants
Any functions whose implementations or values differ from one platform to
-another should be defined in their respective platform_utils_<platform>.py
+another should be defined in their respective <platform>.py
modules. The appropriate one of those will be imported into this module to
provide callers with a common, platform-independent interface.
@@ -43,8 +43,8 @@ import sys
# especially has had problems), but we'll allow the platform utils to be
# included in any case so we don't get an import error.
if sys.platform in ('cygwin', 'win32'):
- from platform_utils_win import *
+ from chromium_win import *
elif sys.platform == 'darwin':
- from platform_utils_mac import *
+ from chromium_mac import *
elif sys.platform in ('linux', 'linux2', 'freebsd7', 'openbsd4'):
- from platform_utils_linux import *
+ from chromium_linux import *
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
index 15f2065..1fb0367 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/apache_http_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/apache_http_server.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -38,7 +38,7 @@ import sys
import http_server_base
import path_utils
-import platform_utils
+import port
class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
@@ -78,7 +78,7 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
error_log = self._cygwin_safe_join(output_dir, "error_log.txt")
document_root = self._cygwin_safe_join(test_dir, "http", "tests")
- executable = platform_utils.apache_executable_path()
+ executable = port.apache_executable_path()
if self._is_cygwin():
executable = self._get_cygwin_path(executable)
@@ -146,7 +146,7 @@ class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
test_dir: absolute path to the LayoutTests directory.
output_dir: absolute path to the layout test results directory.
"""
- httpd_config = platform_utils.apache_config_file_path()
+ httpd_config = port.apache_config_file_path()
httpd_config_copy = os.path.join(output_dir, "httpd.conf")
httpd_conf = open(httpd_config).read()
if self._is_cygwin():
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
index 87b27c7..9ffc401 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_linux.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -27,7 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Linux implementation of the layout_package.platform_utils
+"""This is the Linux implementation of the port
package. This file should only be imported by that package."""
import os
@@ -36,8 +36,8 @@ import subprocess
import sys
import logging
+import chromium_win
import path_utils
-import platform_utils_win
def platform_name():
@@ -75,7 +75,7 @@ def baseline_search_path(platform=None):
"""Returns the list of directories to search for baselines/results, in
order of preference. Paths are relative to the top of the source tree."""
return [baseline_path(platform),
- platform_utils_win.baseline_path('chromium-win'),
+ chromium_win.baseline_path('chromium-win'),
path_utils.webkit_baseline_path('win'),
path_utils.webkit_baseline_path('mac')]
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index 1eaa10c..d0fbc01 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -27,7 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Mac implementation of the layout_package.platform_utils
+"""This is the Mac implementation of the port interface
package. This file should only be imported by that package."""
import os
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
index 3cbbec3..1e0b212 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/platform_utils_win.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -27,14 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""This is the Linux implementation of the layout_package.platform_utils
+"""This is the Linux implementation of the port
package. This file should only be imported by that package."""
import os
-import path_utils
import subprocess
import sys
+import path_utils
def platform_name():
"""Returns the name of the platform we're currently running on."""
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
index dfcb44f..99e2ea1 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
index 2720486..026e070 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/http_server_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server_base.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/httpd2.pem b/WebKitTools/Scripts/webkitpy/layout_tests/port/httpd2.pem
index 6349b78..6349b78 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/httpd2.pem
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/httpd2.pem
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/lighttpd.conf b/WebKitTools/Scripts/webkitpy/layout_tests/port/lighttpd.conf
index d3150dd..d3150dd 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/lighttpd.conf
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/lighttpd.conf
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/path_utils.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py
index 26d062b..70b8c03 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/path_utils.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/path_utils.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -29,9 +29,9 @@
"""This package contains utility methods for manipulating paths and
filenames for test results and baselines. It also contains wrappers
-of a few routines in platform_utils.py so that platform_utils.py can
+of a few routines in port/ so that the port package can
be considered a 'protected' package - i.e., this file should be
-the only file that ever includes platform_utils. This leads to
+the only file that ever includes port. This leads to
us including a few things that don't really have anything to do
with paths, unfortunately."""
@@ -40,10 +40,10 @@ import os
import stat
import sys
-import platform_utils
-import platform_utils_win
-import platform_utils_mac
-import platform_utils_linux
+import port
+import chromium_win
+import chromium_mac
+import chromium_linux
# Cache some values so we don't have to recalculate them. _basedir is
# used by PathFromBase() and caches the full (native) path to the top
@@ -69,20 +69,20 @@ def chromium_baseline_path(platform=None):
baseline results from chromium ports. If |platform| is None, the
currently executing platform is used.
- Note: although directly referencing individual platform_utils_* files is
+ Note: although directly referencing individual port/* files is
usually discouraged, we allow it here so that the rebaselining tool can
pull baselines for platforms other than the host platform."""
# Normalize the platform string.
platform = platform_name(platform)
if platform.startswith('chromium-mac'):
- return platform_utils_mac.baseline_path(platform)
+ return chromium_mac.baseline_path(platform)
elif platform.startswith('chromium-win'):
- return platform_utils_win.baseline_path(platform)
+ return chromium_win.baseline_path(platform)
elif platform.startswith('chromium-linux'):
- return platform_utils_linux.baseline_path(platform)
+ return chromium_linux.baseline_path(platform)
- return platform_utils.baseline_path()
+ return port.baseline_path()
def webkit_baseline_path(platform):
@@ -98,19 +98,19 @@ def baseline_search_path(platform=None):
the source tree. If parameter platform is None, returns the list for the
current platform that the script is running on.
- Note: although directly referencing individual platform_utils_* files is
+ Note: although directly referencing individual port/* files is
usually discouraged, we allow it here so that the rebaselining tool can
pull baselines for platforms other than the host platform."""
# Normalize the platform name.
platform = platform_name(platform)
if platform.startswith('chromium-mac'):
- return platform_utils_mac.baseline_search_path(platform)
+ return chromium_mac.baseline_search_path(platform)
elif platform.startswith('chromium-win'):
- return platform_utils_win.baseline_search_path(platform)
+ return chromium_win.baseline_search_path(platform)
elif platform.startswith('chromium-linux'):
- return platform_utils_linux.baseline_search_path(platform)
- return platform_utils.baseline_search_path()
+ return chromium_linux.baseline_search_path(platform)
+ return port.baseline_search_path()
def expected_baselines(filename, suffix, platform=None, all_baselines=False):
@@ -200,7 +200,7 @@ def _win_path_to_unix(path):
#
# Routines that are arguably platform-specific but have been made
-# generic for now (they used to be in platform_utils_*)
+# generic for now
#
@@ -335,7 +335,7 @@ def remove_directory(*path):
remove_with_retry(os.rmdir, file_path)
#
-# Wrappers around platform_utils
+# Wrappers around port/
#
@@ -345,51 +345,51 @@ def platform_name(platform=None):
currently running system. If |platform| is of the form 'chromium-*',
it is returned unchanged, otherwise 'chromium-' is prepended."""
if platform == None:
- return platform_utils.platform_name()
+ return port.platform_name()
if not platform.startswith('chromium-'):
platform = "chromium-" + platform
return platform
def platform_version():
- return platform_utils.platform_version()
+ return port.platform_version()
def lighttpd_executable_path():
- return platform_utils.lighttpd_executable_path()
+ return port.lighttpd_executable_path()
def lighttpd_module_path():
- return platform_utils.lighttpd_module_path()
+ return port.lighttpd_module_path()
def lighttpd_php_path():
- return platform_utils.lighttpd_php_path()
+ return port.lighttpd_php_path()
def wdiff_path():
- return platform_utils.wdiff_path()
+ return port.wdiff_path()
def test_shell_path(target):
- return platform_utils.test_shell_path(target)
+ return port.test_shell_path(target)
def image_diff_path(target):
- return platform_utils.image_diff_path(target)
+ return port.image_diff_path(target)
def layout_test_helper_path(target):
- return platform_utils.layout_test_helper_path(target)
+ return port.layout_test_helper_path(target)
def fuzzy_match_path():
- return platform_utils.fuzzy_match_path()
+ return port.fuzzy_match_path()
def shut_down_http_server(server_pid):
- return platform_utils.shut_down_http_server(server_pid)
+ return port.shut_down_http_server(server_pid)
def kill_all_test_shells():
- platform_utils.kill_all_test_shells()
+ port.kill_all_test_shells()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/websocket_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
index 7fc47a0..c6c7527 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/websocket_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -40,7 +40,7 @@ import time
import urllib
import path_utils
-import platform_utils
+import port
import http_server
_WS_LOG_PREFIX = 'pywebsocket.ws.log-'
@@ -255,7 +255,7 @@ class PyWebSocket(http_server.Lighttpd):
'Failed to find %s server pid.' % self._server_name)
logging.debug('Shutting down %s server %d.' % (self._server_name, pid))
- platform_utils.kill_process(pid)
+ port.kill_process(pid)
if self._process:
self._process.wait()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
index 1db811f..414baaf 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -54,7 +54,7 @@ import urllib
import webbrowser
import zipfile
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_expectations
from test_types import image_diff
from test_types import text_diff
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
index 88b97f8..571ae3f 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_chromium_webkit_tests.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -59,17 +59,19 @@ import sys
import time
import traceback
-from layout_package import apache_http_server
from layout_package import test_expectations
-from layout_package import http_server
from layout_package import json_layout_results_generator
from layout_package import metered_stream
-from layout_package import path_utils
-from layout_package import platform_utils
from layout_package import test_failures
from layout_package import test_shell_thread
from layout_package import test_files
-from layout_package import websocket_server
+
+import port
+from port import apache_http_server
+from port import http_server
+from port import path_utils
+from port import websocket_server
+
from test_types import fuzzy_image_diff
from test_types import image_diff
from test_types import test_type_base
@@ -1469,7 +1471,7 @@ def main(options, args):
if not options.num_test_shells:
# TODO(ojan): Investigate perf/flakiness impact of using numcores + 1.
- options.num_test_shells = platform_utils.get_num_cores()
+ options.num_test_shells = port.get_num_cores()
write = create_logging_writer(options, 'config')
write("Running %s test_shells in parallel" % options.num_test_shells)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
index 134b507..100fd0d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/fuzzy_image_diff.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -37,7 +37,7 @@ import os
import shutil
import subprocess
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
index b0bf189..86b9659 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -40,7 +40,7 @@ import os
import shutil
import subprocess
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
index 334ae70..79b7e34 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -39,7 +39,7 @@ import logging
import os.path
import subprocess
-from layout_package import path_utils
+from port import path_utils
class TestArguments(object):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
index 8cff9e6..3c895af 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2010 The Chromium Authors. All rights reserved.
+# Copyright (C) 2010 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
@@ -11,7 +11,7 @@
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-# * Neither the Chromium name nor the names of its
+# * 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.
#
@@ -37,7 +37,7 @@ import errno
import logging
import os.path
-from layout_package import path_utils
+from port import path_utils
from layout_package import test_failures
from test_types import test_type_base
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index faf954f..dc14ea3 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -37,6 +37,9 @@ import sys
from .. style_references import parse_patch
from error_handlers import DefaultStyleErrorHandler
from error_handlers import PatchStyleErrorHandler
+from filter import CategoryFilter
+from processors.common import check_no_carriage_return
+from processors.common import categories as CommonCategories
from processors.cpp import CppProcessor
from processors.text import TextProcessor
@@ -106,10 +109,17 @@ SKIPPED_FILES_WITHOUT_WARNING = [
]
+# The maximum number of errors to report per file, per category.
+# If a category is not a key, then it has no maximum.
+MAX_REPORTS_PER_CATEGORY = {
+ "whitespace/carriage_return": 1
+}
+
+
def style_categories():
"""Return the set of all categories used by check-webkit-style."""
- # If other processors had categories, we would take their union here.
- return CppProcessor.categories
+ # Take the union across all processors.
+ return CommonCategories.union(CppProcessor.categories)
def webkit_argument_defaults():
@@ -191,79 +201,6 @@ Syntax: %(program_name)s [--verbose=#] [--git-commit=<SingleCommit>] [--output=v
return usage
-class CategoryFilter(object):
-
- """Filters whether to check style categories."""
-
- def __init__(self, filter_rules=None):
- """Create a category filter.
-
- This method performs argument validation but does not strip
- leading or trailing white space.
-
- Args:
- filter_rules: A list of strings that are filter rules, which
- are strings beginning with the plus or minus
- symbol (+/-). The list should include any
- default filter rules at the beginning.
- Defaults to the empty list.
-
- Raises:
- ValueError: Invalid filter rule if a rule does not start with
- plus ("+") or minus ("-").
-
- """
- if filter_rules is None:
- filter_rules = []
-
- for rule in filter_rules:
- if not (rule.startswith('+') or rule.startswith('-')):
- raise ValueError('Invalid filter rule "%s": every rule '
- 'rule in the --filter flag must start '
- 'with + or -.' % rule)
-
- self._filter_rules = filter_rules
- self._should_check_category = {} # Cached dictionary of category to True/False
-
- def __str__(self):
- return ",".join(self._filter_rules)
-
- # Useful for unit testing.
- def __eq__(self, other):
- """Return whether this CategoryFilter instance is equal to another."""
- return self._filter_rules == other._filter_rules
-
- # Useful for unit testing.
- def __ne__(self, other):
- # Python does not automatically deduce from __eq__().
- return not (self == other)
-
- def should_check(self, category):
- """Return whether the category should be checked.
-
- The rules for determining whether a category should be checked
- are as follows. By default all categories should be checked.
- Then apply the filter rules in order from first to last, with
- later flags taking precedence.
-
- A filter rule applies to a category if the string after the
- leading plus/minus (+/-) matches the beginning of the category
- name. A plus (+) means the category should be checked, while a
- minus (-) means the category should not be checked.
-
- """
- if category in self._should_check_category:
- return self._should_check_category[category]
-
- should_check = True # All categories checked by default.
- for rule in self._filter_rules:
- if not category.startswith(rule[1:]):
- continue
- should_check = rule.startswith('+')
- self._should_check_category[category] = should_check # Update cache.
- return should_check
-
-
# This class should not have knowledge of the flag key names.
class ProcessorOptions(object):
@@ -290,12 +227,19 @@ class ProcessorOptions(object):
"""
- def __init__(self, output_format="emacs", verbosity=1, filter=None,
- git_commit=None, extra_flag_values=None):
- if filter is None:
- filter = CategoryFilter()
+ def __init__(self,
+ output_format="emacs",
+ verbosity=1,
+ filter=None,
+ max_reports_per_category=None,
+ git_commit=None,
+ extra_flag_values=None):
if extra_flag_values is None:
extra_flag_values = {}
+ if filter is None:
+ filter = CategoryFilter()
+ if max_reports_per_category is None:
+ max_reports_per_category = {}
if output_format not in ("emacs", "vs7"):
raise ValueError('Invalid "output_format" parameter: '
@@ -307,24 +251,27 @@ class ProcessorOptions(object):
"value must be an integer between 1-5 inclusive. "
'Value given: "%s".' % verbosity)
- self.output_format = output_format
- self.verbosity = verbosity
+ self.extra_flag_values = extra_flag_values
self.filter = filter
self.git_commit = git_commit
- self.extra_flag_values = extra_flag_values
+ self.max_reports_per_category = max_reports_per_category
+ self.output_format = output_format
+ self.verbosity = verbosity
# Useful for unit testing.
def __eq__(self, other):
"""Return whether this ProcessorOptions instance is equal to another."""
- if self.output_format != other.output_format:
- return False
- if self.verbosity != other.verbosity:
+ if self.extra_flag_values != other.extra_flag_values:
return False
if self.filter != other.filter:
return False
if self.git_commit != other.git_commit:
return False
- if self.extra_flag_values != other.extra_flag_values:
+ if self.max_reports_per_category != other.max_reports_per_category:
+ return False
+ if self.output_format != other.output_format:
+ return False
+ if self.verbosity != other.verbosity:
return False
return True
@@ -568,8 +515,12 @@ class ArgumentParser(object):
filter = CategoryFilter(filter_rules)
- options = ProcessorOptions(output_format, verbosity, filter,
- git_commit, extra_flag_values)
+ options = ProcessorOptions(extra_flag_values=extra_flag_values,
+ filter=filter,
+ git_commit=git_commit,
+ max_reports_per_category=MAX_REPORTS_PER_CATEGORY,
+ output_format=output_format,
+ verbosity=verbosity)
return (filenames, options)
@@ -720,35 +671,36 @@ class StyleChecker(object):
# '\r\n' as in Windows), a warning is issued below if this file
# is processed.
if file_path == '-':
- lines = codecs.StreamReaderWriter(sys.stdin,
- codecs.getreader('utf8'),
- codecs.getwriter('utf8'),
- 'replace').read().split('\n')
+ file = codecs.StreamReaderWriter(sys.stdin,
+ codecs.getreader('utf8'),
+ codecs.getwriter('utf8'),
+ 'replace')
else:
- lines = codecs.open(file_path, 'r', 'utf8', 'replace').read().split('\n')
+ file = codecs.open(file_path, 'r', 'utf8', 'replace')
- carriage_return_found = False
- # Remove trailing '\r'.
- for line_number in range(len(lines)):
- if lines[line_number].endswith('\r'):
- lines[line_number] = lines[line_number].rstrip('\r')
- carriage_return_found = True
+ contents = file.read()
except IOError:
self._stderr_write("Skipping input '%s': Can't open for reading\n" % file_path)
return
- processor.process(lines)
+ lines = contents.split("\n")
- if carriage_return_found and os.linesep != '\r\n':
- # FIXME: Make sure this error also shows up when checking
- # patches, if appropriate.
+ for line_number in range(len(lines)):
+ # FIXME: We should probably use the SVN "eol-style" property
+ # or a white list to decide whether or not to do
+ # the carriage-return check. Originally, we did the
+ # check only if (os.linesep != '\r\n').
#
- # Use 0 for line_number since outputting only one error for
- # potentially several lines.
- handle_style_error(file_path, 0, 'whitespace/newline', 1,
- 'One or more unexpected \\r (^M) found;'
- 'better to use only a \\n')
+ # FIXME: As a minor optimization, we can have
+ # check_no_carriage_return() return whether
+ # the line ends with "\r".
+ check_no_carriage_return(lines[line_number], line_number,
+ handle_style_error)
+ if lines[line_number].endswith("\r"):
+ lines[line_number] = lines[line_number].rstrip("\r")
+
+ processor.process(lines)
def check_file(self, file_path, handle_style_error=None, process_file=None):
"""Check style in the given file.
diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
index 4d6b2e7..814bd41 100755
--- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
@@ -37,67 +37,13 @@
import unittest
import checker as style
-from checker import CategoryFilter
from checker import ProcessorDispatcher
from checker import ProcessorOptions
from checker import StyleChecker
+from filter import CategoryFilter
from processors.cpp import CppProcessor
from processors.text import TextProcessor
-class CategoryFilterTest(unittest.TestCase):
-
- """Tests CategoryFilter class."""
-
- def test_init(self):
- """Test __init__ constructor."""
- self.assertRaises(ValueError, CategoryFilter, ["no_prefix"])
- CategoryFilter() # No ValueError: works
- CategoryFilter(["+"]) # No ValueError: works
- CategoryFilter(["-"]) # No ValueError: works
-
- def test_str(self):
- """Test __str__ "to string" operator."""
- filter = CategoryFilter(["+a", "-b"])
- self.assertEquals(str(filter), "+a,-b")
-
- def test_eq(self):
- """Test __eq__ equality function."""
- filter1 = CategoryFilter(["+a", "+b"])
- filter2 = CategoryFilter(["+a", "+b"])
- filter3 = CategoryFilter(["+b", "+a"])
-
- # == calls __eq__.
- self.assertTrue(filter1 == filter2)
- self.assertFalse(filter1 == filter3) # Cannot test with assertNotEqual.
-
- def test_ne(self):
- """Test __ne__ inequality function."""
- # != calls __ne__.
- # By default, __ne__ always returns true on different objects.
- # Thus, just check the distinguishing case to verify that the
- # code defines __ne__.
- self.assertFalse(CategoryFilter() != CategoryFilter())
-
- def test_should_check(self):
- """Test should_check() method."""
- filter = CategoryFilter()
- self.assertTrue(filter.should_check("everything"))
- # Check a second time to exercise cache.
- self.assertTrue(filter.should_check("everything"))
-
- filter = CategoryFilter(["-"])
- self.assertFalse(filter.should_check("anything"))
- # Check a second time to exercise cache.
- self.assertFalse(filter.should_check("anything"))
-
- filter = CategoryFilter(["-", "+ab"])
- self.assertTrue(filter.should_check("abc"))
- self.assertFalse(filter.should_check("a"))
-
- filter = CategoryFilter(["+", "-ab"])
- self.assertFalse(filter.should_check("abc"))
- self.assertTrue(filter.should_check("a"))
-
class ProcessorOptionsTest(unittest.TestCase):
@@ -110,6 +56,7 @@ class ProcessorOptionsTest(unittest.TestCase):
self.assertEquals(options.extra_flag_values, {})
self.assertEquals(options.filter, CategoryFilter())
self.assertEquals(options.git_commit, None)
+ self.assertEquals(options.max_reports_per_category, {})
self.assertEquals(options.output_format, "emacs")
self.assertEquals(options.verbosity, 1)
@@ -126,11 +73,13 @@ class ProcessorOptionsTest(unittest.TestCase):
options = ProcessorOptions(extra_flag_values={"extra_value" : 2},
filter=CategoryFilter(["+"]),
git_commit="commit",
+ max_reports_per_category={"category": 3},
output_format="vs7",
verbosity=3)
self.assertEquals(options.extra_flag_values, {"extra_value" : 2})
self.assertEquals(options.filter, CategoryFilter(["+"]))
self.assertEquals(options.git_commit, "commit")
+ self.assertEquals(options.max_reports_per_category, {"category": 3})
self.assertEquals(options.output_format, "vs7")
self.assertEquals(options.verbosity, 3)
@@ -143,11 +92,14 @@ class ProcessorOptionsTest(unittest.TestCase):
options = ProcessorOptions(extra_flag_values={"extra_value" : 1},
filter=CategoryFilter(["+"]),
git_commit="commit",
+ max_reports_per_category={"category": 3},
output_format="vs7",
verbosity=1)
self.assertFalse(options == ProcessorOptions(extra_flag_values={"extra_value" : 2}))
self.assertFalse(options == ProcessorOptions(filter=CategoryFilter(["-"])))
self.assertFalse(options == ProcessorOptions(git_commit="commit2"))
+ self.assertFalse(options == ProcessorOptions(max_reports_per_category=
+ {"category": 2}))
self.assertFalse(options == ProcessorOptions(output_format="emacs"))
self.assertFalse(options == ProcessorOptions(verbosity=2))
@@ -173,9 +125,9 @@ class ProcessorOptionsTest(unittest.TestCase):
self.assertFalse(options.is_reportable("xyz", 3))
-class WebKitArgumentDefaultsTest(unittest.TestCase):
+class GlobalVariablesTest(unittest.TestCase):
- """Tests validity of default arguments used by check-webkit-style."""
+ """Tests validity of the global variables."""
def defaults(self):
return style.webkit_argument_defaults()
@@ -206,6 +158,13 @@ class WebKitArgumentDefaultsTest(unittest.TestCase):
# on valid arguments elsewhere.
parser.parse([]) # arguments valid: no error or SystemExit
+ def test_max_reports_per_category(self):
+ """Check that MAX_REPORTS_PER_CATEGORY is valid."""
+ categories = style.style_categories()
+ for category in style.MAX_REPORTS_PER_CATEGORY.iterkeys():
+ self.assertTrue(category in categories,
+ 'Key "%s" is not a category' % category)
+
class ArgumentPrinterTest(unittest.TestCase):
@@ -217,8 +176,11 @@ class ArgumentPrinterTest(unittest.TestCase):
filter_rules=[], git_commit=None,
extra_flag_values={}):
filter = CategoryFilter(filter_rules)
- return style.ProcessorOptions(output_format, verbosity, filter,
- git_commit, extra_flag_values)
+ return style.ProcessorOptions(extra_flag_values=extra_flag_values,
+ filter=filter,
+ git_commit=git_commit,
+ output_format=output_format,
+ verbosity=verbosity)
def test_to_flag_string(self):
options = self._create_options('vs7', 5, ['+foo', '-bar'], 'git',
diff --git a/WebKitTools/Scripts/webkitpy/style/error_handlers.py b/WebKitTools/Scripts/webkitpy/style/error_handlers.py
index 54b1d76..31140de 100644
--- a/WebKitTools/Scripts/webkitpy/style/error_handlers.py
+++ b/WebKitTools/Scripts/webkitpy/style/error_handlers.py
@@ -32,7 +32,9 @@ Methods:
Handle the occurrence of a style error.
- Check whether the error is reportable. If so, report the details.
+ Check whether the error is reportable. If so, increment the total
+ error count and report the details. Note that error reporting can
+ be suppressed after reaching a certain number of reports.
Args:
line_number: The integer line number of the line containing the error.
@@ -79,6 +81,28 @@ class DefaultStyleErrorHandler(object):
self._options = options
self._stderr_write = stderr_write
+ # A string to integer dictionary cache of the number of reportable
+ # errors per category passed to this instance.
+ self._category_totals = { }
+
+ def _add_reportable_error(self, category):
+ """Increment the error count and return the new category total."""
+ self._increment_error_count() # Increment the total.
+
+ # Increment the category total.
+ if not category in self._category_totals:
+ self._category_totals[category] = 1
+ else:
+ self._category_totals[category] += 1
+
+ return self._category_totals[category]
+
+ def _max_reports(self, category):
+ """Return the maximum number of errors to report."""
+ if not category in self._options.max_reports_per_category:
+ return None
+ return self._options.max_reports_per_category[category]
+
def __call__(self, line_number, category, confidence, message):
"""Handle the occurrence of a style error.
@@ -88,13 +112,23 @@ class DefaultStyleErrorHandler(object):
if not self._options.is_reportable(category, confidence):
return
- self._increment_error_count()
+ category_total = self._add_reportable_error(category)
+
+ max_reports = self._max_reports(category)
+
+ if (max_reports is not None) and (category_total > max_reports):
+ # Then suppress displaying the error.
+ return
if self._options.output_format == 'vs7':
format_string = "%s(%s): %s [%s] [%d]\n"
else:
format_string = "%s:%s: %s [%s] [%d]\n"
+ if category_total == max_reports:
+ format_string += ("Suppressing further [%s] reports for this "
+ "file.\n" % category)
+
self._stderr_write(format_string % (self._file_path,
line_number,
message,
@@ -130,7 +164,7 @@ class PatchStyleErrorHandler(object):
if not self._line_numbers:
for line in self._diff.lines:
# When deleted line is not set, it means that
- # the line is newly added.
+ # the line is newly added (or modified).
if not line[0]:
self._line_numbers.add(line[1])
@@ -140,9 +174,9 @@ class PatchStyleErrorHandler(object):
"""Handle the occurrence of a style error.
This function does not report errors occurring in lines not
- modified or added.
+ marked as modified or added in the patch.
- Args: see the DefaultStyleErrorHandler.__call__() documentation.
+ See the docstring of this module for more information.
"""
if line_number not in self._get_line_numbers():
diff --git a/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py b/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
index 6a91ff2..83bdbb9 100644
--- a/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/error_handlers_unittest.py
@@ -50,9 +50,6 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
_category = "whitespace/tab"
- def _options(self, output_format):
- return ProcessorOptions(verbosity=3, output_format=output_format)
-
def _error_handler(self, options):
file_path = "foo.h"
return DefaultStyleErrorHandler(file_path,
@@ -60,29 +57,28 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
self._mock_increment_error_count,
self._mock_stderr_write)
- def _prepare_call(self, output_format="emacs"):
- """Return options after initializing."""
- options = self._options(output_format)
-
- # Test that count is initialized to zero.
+ def _check_initialized(self):
+ """Check that count and error messages are initialized."""
self.assertEquals(0, self._error_count)
self.assertEquals("", self._error_messages)
- return options
-
- def _call_error_handler(self, options, confidence):
- """Handle an error with given confidence."""
- handle_error = self._error_handler(options)
-
+ def _call(self, handle_error, options, confidence):
+ """Handle an error with the given error handler."""
line_number = 100
message = "message"
handle_error(line_number, self._category, confidence, message)
+ def _call_error_handler(self, options, confidence):
+ """Handle an error using a new error handler."""
+ handle_error = self._error_handler(options)
+ self._call(handle_error, options, confidence)
+
def test_call_non_reportable(self):
"""Test __call__() method with a non-reportable error."""
confidence = 1
- options = self._prepare_call()
+ options = ProcessorOptions(verbosity=3)
+ self._check_initialized()
# Confirm the error is not reportable.
self.assertFalse(options.is_reportable(self._category, confidence))
@@ -95,7 +91,8 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
def test_call_reportable_emacs(self):
"""Test __call__() method with a reportable error and emacs format."""
confidence = 5
- options = self._prepare_call("emacs")
+ options = ProcessorOptions(verbosity=3, output_format="emacs")
+ self._check_initialized()
self._call_error_handler(options, confidence)
@@ -106,7 +103,8 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
def test_call_reportable_vs7(self):
"""Test __call__() method with a reportable error and vs7 format."""
confidence = 5
- options = self._prepare_call("vs7")
+ options = ProcessorOptions(verbosity=3, output_format="vs7")
+ self._check_initialized()
self._call_error_handler(options, confidence)
@@ -114,6 +112,36 @@ class DefaultStyleErrorHandlerTest(StyleErrorHandlerTestBase):
self.assertEquals(self._error_messages,
"foo.h(100): message [whitespace/tab] [5]\n")
+ def test_call_max_reports_per_category(self):
+ """Test error report suppression in __call__() method."""
+ confidence = 5
+ options = ProcessorOptions(verbosity=3,
+ max_reports_per_category={self._category: 2})
+ error_handler = self._error_handler(options)
+
+ self._check_initialized()
+
+ # First call: usual reporting.
+ self._call(error_handler, options, confidence)
+ self.assertEquals(1, self._error_count)
+ self.assertEquals(self._error_messages,
+ "foo.h:100: message [whitespace/tab] [5]\n")
+
+ # Second call: suppression message reported.
+ self._error_messages = ""
+ self._call(error_handler, options, confidence)
+ self.assertEquals(2, self._error_count)
+ self.assertEquals(self._error_messages,
+ "foo.h:100: message [whitespace/tab] [5]\n"
+ "Suppressing further [%s] reports for this file.\n"
+ % self._category)
+
+ # Third call: no report.
+ self._error_messages = ""
+ self._call(error_handler, options, confidence)
+ self.assertEquals(3, self._error_count)
+ self.assertEquals(self._error_messages, "")
+
class PatchStyleErrorHandlerTest(StyleErrorHandlerTestBase):
diff --git a/WebKitTools/Scripts/webkitpy/style/filter.py b/WebKitTools/Scripts/webkitpy/style/filter.py
new file mode 100644
index 0000000..1b41424
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/filter.py
@@ -0,0 +1,97 @@
+# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
+#
+# 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+
+"""Contains filter-related code."""
+
+
+class CategoryFilter(object):
+
+ """Filters whether to check style categories."""
+
+ def __init__(self, filter_rules=None):
+ """Create a category filter.
+
+ This method performs argument validation but does not strip
+ leading or trailing white space.
+
+ Args:
+ filter_rules: A list of strings that are filter rules, which
+ are strings beginning with the plus or minus
+ symbol (+/-). The list should include any
+ default filter rules at the beginning.
+ Defaults to the empty list.
+
+ Raises:
+ ValueError: Invalid filter rule if a rule does not start with
+ plus ("+") or minus ("-").
+
+ """
+ if filter_rules is None:
+ filter_rules = []
+
+ for rule in filter_rules:
+ if not (rule.startswith('+') or rule.startswith('-')):
+ raise ValueError('Invalid filter rule "%s": every rule '
+ 'rule in the --filter flag must start '
+ 'with + or -.' % rule)
+
+ self._filter_rules = filter_rules
+ self._should_check_category = {} # Cached dictionary of category to True/False
+
+ def __str__(self):
+ return ",".join(self._filter_rules)
+
+ # Useful for unit testing.
+ def __eq__(self, other):
+ """Return whether this CategoryFilter instance is equal to another."""
+ return self._filter_rules == other._filter_rules
+
+ # Useful for unit testing.
+ def __ne__(self, other):
+ # Python does not automatically deduce from __eq__().
+ return not (self == other)
+
+ def should_check(self, category):
+ """Return whether the category should be checked.
+
+ The rules for determining whether a category should be checked
+ are as follows. By default all categories should be checked.
+ Then apply the filter rules in order from first to last, with
+ later flags taking precedence.
+
+ A filter rule applies to a category if the string after the
+ leading plus/minus (+/-) matches the beginning of the category
+ name. A plus (+) means the category should be checked, while a
+ minus (-) means the category should not be checked.
+
+ """
+ if category in self._should_check_category:
+ return self._should_check_category[category]
+
+ should_check = True # All categories checked by default.
+ for rule in self._filter_rules:
+ if not category.startswith(rule[1:]):
+ continue
+ should_check = rule.startswith('+')
+ self._should_check_category[category] = should_check # Update cache.
+ return should_check
+
diff --git a/WebKitTools/Scripts/webkitpy/style/filter_unittest.py b/WebKitTools/Scripts/webkitpy/style/filter_unittest.py
new file mode 100644
index 0000000..0b12123
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/filter_unittest.py
@@ -0,0 +1,84 @@
+# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
+#
+# 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+
+"""Unit tests for filter.py."""
+
+
+import unittest
+
+from filter import CategoryFilter
+
+
+class CategoryFilterTest(unittest.TestCase):
+
+ """Tests CategoryFilter class."""
+
+ def test_init(self):
+ """Test __init__ constructor."""
+ self.assertRaises(ValueError, CategoryFilter, ["no_prefix"])
+ CategoryFilter() # No ValueError: works
+ CategoryFilter(["+"]) # No ValueError: works
+ CategoryFilter(["-"]) # No ValueError: works
+
+ def test_str(self):
+ """Test __str__ "to string" operator."""
+ filter = CategoryFilter(["+a", "-b"])
+ self.assertEquals(str(filter), "+a,-b")
+
+ def test_eq(self):
+ """Test __eq__ equality function."""
+ filter1 = CategoryFilter(["+a", "+b"])
+ filter2 = CategoryFilter(["+a", "+b"])
+ filter3 = CategoryFilter(["+b", "+a"])
+
+ # == calls __eq__.
+ self.assertTrue(filter1 == filter2)
+ self.assertFalse(filter1 == filter3) # Cannot test with assertNotEqual.
+
+ def test_ne(self):
+ """Test __ne__ inequality function."""
+ # != calls __ne__.
+ # By default, __ne__ always returns true on different objects.
+ # Thus, just check the distinguishing case to verify that the
+ # code defines __ne__.
+ self.assertFalse(CategoryFilter() != CategoryFilter())
+
+ def test_should_check(self):
+ """Test should_check() method."""
+ filter = CategoryFilter()
+ self.assertTrue(filter.should_check("everything"))
+ # Check a second time to exercise cache.
+ self.assertTrue(filter.should_check("everything"))
+
+ filter = CategoryFilter(["-"])
+ self.assertFalse(filter.should_check("anything"))
+ # Check a second time to exercise cache.
+ self.assertFalse(filter.should_check("anything"))
+
+ filter = CategoryFilter(["-", "+ab"])
+ self.assertTrue(filter.should_check("abc"))
+ self.assertFalse(filter.should_check("a"))
+
+ filter = CategoryFilter(["+", "-ab"])
+ self.assertFalse(filter.should_check("abc"))
+ self.assertTrue(filter.should_check("a"))
+
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/common.py b/WebKitTools/Scripts/webkitpy/style/processors/common.py
new file mode 100644
index 0000000..dbf4bea
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/processors/common.py
@@ -0,0 +1,59 @@
+# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
+#
+# 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+
+"""Supports style checking not specific to any one processor."""
+
+
+# FIXME: Test this list in the same way that the list of CppProcessor
+# categories is tested, for example by checking that all of its
+# elements appear in the unit tests. This should probably be done
+# after moving the relevant cpp_unittest.ErrorCollector code
+# into a shared location and refactoring appropriately.
+categories = set([
+ "whitespace/carriage_return",
+])
+
+
+def check_no_carriage_return(line, line_number, error):
+ """Check that a line does not end with a carriage return.
+
+ Returns true if the check is successful (i.e. if the line does not
+ end with a carriage return), and false otherwise.
+
+ Args:
+ line: A string that is the line to check.
+ line_number: The line number.
+ error: The function to call with any errors found.
+
+ """
+
+ if line.endswith("\r"):
+ error(line_number,
+ "whitespace/carriage_return",
+ 1,
+ "One or more unexpected \\r (^M) found; "
+ "better to use only a \\n")
+ return False
+
+ return True
+
+
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/common_unittest.py b/WebKitTools/Scripts/webkitpy/style/processors/common_unittest.py
new file mode 100644
index 0000000..9362b65
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style/processors/common_unittest.py
@@ -0,0 +1,82 @@
+# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
+#
+# 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+
+"""Unit tests for common.py."""
+
+
+import unittest
+
+from common import check_no_carriage_return
+
+
+# FIXME: The unit tests for the cpp, text, and common processors should
+# share supporting test code. This can include, for example, the
+# mock style error handling code and the code to check that all
+# of a processor's categories are covered by the unit tests.
+# Such shared code can be located in a shared test file, perhaps
+# ilke this one.
+class CarriageReturnTest(unittest.TestCase):
+
+ """Tests check_no_carriage_return()."""
+
+ _category = "whitespace/carriage_return"
+ _confidence = 1
+
+ def setUp(self):
+ self._style_errors = [] # The list of accumulated style errors.
+
+ def _mock_style_error_handler(self, line_number, category, confidence,
+ message):
+ """Append the error information to the list of style errors."""
+ error = (line_number, category, confidence, message)
+ self._style_errors.append(error)
+
+ def assert_carriage_return(self, line, is_error):
+ """Call check_no_carriage_return() and assert the result."""
+ line_number = 100
+ handle_style_error = self._mock_style_error_handler
+
+ check_no_carriage_return(line, line_number, handle_style_error)
+
+ expected_message = ("One or more unexpected \\r (^M) found; "
+ "better to use only a \\n")
+
+ if is_error:
+ expected_errors = [(line_number, self._category, self._confidence,
+ expected_message)]
+ self.assertEquals(self._style_errors, expected_errors)
+ else:
+ self.assertEquals(self._style_errors, [])
+
+ def test_ends_with_carriage(self):
+ self.assert_carriage_return("carriage return\r", is_error=True)
+
+ def test_ends_with_nothing(self):
+ self.assert_carriage_return("no carriage return", is_error=False)
+
+ def test_ends_with_newline(self):
+ self.assert_carriage_return("no carriage return\n", is_error=False)
+
+ def test_ends_with_carriage_newline(self):
+ # Check_no_carriage_return only() checks the final character.
+ self.assert_carriage_return("carriage\r in a string", is_error=False)
+
diff --git a/WebKitTools/Scripts/webkitpy/style/unittests.py b/WebKitTools/Scripts/webkitpy/style/unittests.py
index 11c10e7..f8e3f71 100644
--- a/WebKitTools/Scripts/webkitpy/style/unittests.py
+++ b/WebKitTools/Scripts/webkitpy/style/unittests.py
@@ -37,5 +37,7 @@ import unittest
from checker_unittest import *
from error_handlers_unittest import *
+from filter_unittest import *
+from processors.common_unittest import *
from processors.cpp_unittest import *
from processors.text_unittest import *
diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py
index 9b8165d..60a4db6 100644
--- a/WebKitTools/wx/build/settings.py
+++ b/WebKitTools/wx/build/settings.py
@@ -92,6 +92,7 @@ jscore_dirs = [
'wtf',
'wtf/unicode',
'wtf/unicode/icu',
+ 'yarr',
]
webcore_dirs = [