From 65f03d4f644ce73618e5f4f50dd694b26f55ae12 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 13 May 2011 16:23:25 +0100 Subject: Merge WebKit at r75993: Initial merge by git. Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3 --- .../build.webkit.org-config/master.cfg | 8 +- Tools/ChangeLog | 1053 ++++++++++++++++++++ Tools/DumpRenderTree/LayoutTestController.cpp | 53 +- Tools/DumpRenderTree/LayoutTestController.h | 6 + .../TestNetscapePlugIn/win/TestNetscapePlugin.rc | 5 +- Tools/DumpRenderTree/WorkQueueItem.h | 8 + Tools/DumpRenderTree/chromium/DumpRenderTree.cpp | 7 + Tools/DumpRenderTree/chromium/EventSender.cpp | 6 +- .../chromium/LayoutTestController.cpp | 42 +- Tools/DumpRenderTree/chromium/TestEventPrinter.h | 5 + .../chromium/TestNetscapePlugIn/Info.plist | 60 -- Tools/DumpRenderTree/chromium/TestShell.cpp | 2 +- Tools/DumpRenderTree/chromium/TestShell.h | 4 +- Tools/DumpRenderTree/chromium/WebPreferences.h | 2 +- .../DumpRenderTree/chromium/WebThemeEngineDRTMac.h | 2 +- .../chromium/WebThemeEngineDRTMac.mm | 4 +- Tools/DumpRenderTree/chromium/WebViewHost.cpp | 19 +- Tools/DumpRenderTree/chromium/WebViewHost.h | 12 +- Tools/DumpRenderTree/chromium/fonts.conf | 74 ++ Tools/DumpRenderTree/gtk/DumpRenderTree.cpp | 2 +- Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp | 3 +- Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp | 6 + .../mac/InternalHeaders/WebKit/WebTypesInternal.h | 2 +- Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm | 5 +- Tools/DumpRenderTree/mac/WorkQueueItemMac.mm | 6 + Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | 4 +- Tools/DumpRenderTree/qt/DumpRenderTreeQt.h | 2 +- Tools/DumpRenderTree/qt/GCControllerQt.cpp | 2 +- Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | 2 +- Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp | 2 +- Tools/DumpRenderTree/qt/TextInputControllerQt.cpp | 2 +- Tools/DumpRenderTree/win/WorkQueueItemWin.cpp | 10 + Tools/DumpRenderTree/wscript | 2 +- Tools/GNUmakefile.am | 13 +- Tools/MiniBrowser/mac/BrowserWindowController.m | 3 +- Tools/MiniBrowser/qt/BrowserView.cpp | 10 +- Tools/MiniBrowser/qt/BrowserView.h | 2 +- Tools/MiniBrowser/qt/BrowserWindow.cpp | 8 +- Tools/MiniBrowser/qt/BrowserWindow.h | 2 +- Tools/MiniBrowser/qt/MiniBrowser.pro | 8 +- Tools/MiniBrowser/win/BrowserView.cpp | 3 +- Tools/QtTestBrowser/launcherwindow.cpp | 14 + Tools/QtTestBrowser/launcherwindow.h | 4 +- Tools/QtTestBrowser/locationedit.cpp | 4 + Tools/QtTestBrowser/locationedit.h | 2 + Tools/QtTestBrowser/mainwindow.cpp | 19 +- Tools/QtTestBrowser/webpage.cpp | 13 +- Tools/QtTestBrowser/webpage.h | 31 +- Tools/QtTestBrowser/webview.cpp | 4 + Tools/Scripts/VCSUtils.pm | 5 +- Tools/Scripts/build-webkit | 10 +- Tools/Scripts/check-inspector-strings | 115 +++ Tools/Scripts/do-file-rename | 2 +- Tools/Scripts/do-webcore-rename | 2 +- Tools/Scripts/old-run-webkit-tests | 31 +- Tools/Scripts/test-webkitpy | 2 +- Tools/Scripts/update-webkit-auxiliary-libs | 17 +- Tools/Scripts/update-webkit-chromium | 2 +- Tools/Scripts/update-webkit-support-libs | 9 +- Tools/Scripts/webkitdirs.pm | 21 +- Tools/Scripts/webkitpy/common/checkout/api.py | 17 +- .../webkitpy/common/checkout/api_unittest.py | 26 +- Tools/Scripts/webkitpy/common/checkout/scm.py | 60 +- .../webkitpy/common/checkout/scm_unittest.py | 19 +- Tools/Scripts/webkitpy/common/config/committers.py | 5 +- .../webkitpy/common/net/bugzilla/bugzilla.py | 7 +- .../webkitpy/common/net/buildbot/buildbot.py | 1 - .../common/net/buildbot/buildbot_unittest.py | 1 - Tools/Scripts/webkitpy/common/system/executive.py | 14 +- .../webkitpy/common/system/executive_unittest.py | 17 + Tools/Scripts/webkitpy/common/system/filesystem.py | 3 + .../webkitpy/common/system/filesystem_mock.py | 3 + Tools/Scripts/webkitpy/common/system/workspace.py | 61 ++ .../webkitpy/common/system/workspace_unittest.py | 55 + .../layout_tests/layout_package/test_failures.py | 4 +- .../Scripts/webkitpy/layout_tests/port/chromium.py | 2 + .../webkitpy/layout_tests/run_webkit_tests.py | 4 + Tools/Scripts/webkitpy/style/checker.py | 8 +- Tools/Scripts/webkitpy/style/checkers/cpp.py | 150 +-- .../webkitpy/style/checkers/cpp_unittest.py | 169 +++- Tools/Scripts/webkitpy/style_references.py | 3 +- Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py | 23 +- .../webkitpy/tool/bot/commitqueuetask_unittest.py | 38 +- Tools/Scripts/webkitpy/tool/bot/feeders.py | 5 + .../Scripts/webkitpy/tool/bot/feeders_unittest.py | 10 + .../Scripts/webkitpy/tool/bot/flakytestreporter.py | 48 +- .../tool/bot/flakytestreporter_unittest.py | 24 +- Tools/Scripts/webkitpy/tool/commands/queues.py | 24 +- .../webkitpy/tool/commands/queues_unittest.py | 24 +- Tools/Scripts/webkitpy/tool/main.py | 17 +- Tools/Scripts/webkitpy/tool/mocktool.py | 15 +- .../webkitpy/tool/steps/preparechangelog.py | 2 + .../webkitpy/tool/steps/validatechangelogs.py | 3 + .../tool/steps/validatechangelogs_unittest.py | 18 +- Tools/WebKitTestRunner/DerivedSources.pro | 4 +- .../InjectedBundle/InjectedBundle.cpp | 2 + .../InjectedBundle/InjectedBundlePage.cpp | 2 +- .../InjectedBundle/InjectedBundlePage.h | 2 +- .../InjectedBundle/qt/InjectedBundle.pro | 10 +- Tools/WebKitTestRunner/TestController.cpp | 29 +- Tools/WebKitTestRunner/TestController.h | 3 + Tools/WebKitTestRunner/mac/TestControllerMac.mm | 4 +- Tools/WebKitTestRunner/qt/WebKitTestRunner.pro | 10 +- 103 files changed, 2306 insertions(+), 418 deletions(-) delete mode 100644 Tools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist create mode 100755 Tools/Scripts/check-inspector-strings create mode 100644 Tools/Scripts/webkitpy/common/system/workspace.py create mode 100644 Tools/Scripts/webkitpy/common/system/workspace_unittest.py (limited to 'Tools') diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg b/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg index 5d0d6c0..1ce5b88 100644 --- a/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg @@ -127,7 +127,7 @@ class UploadBuiltProduct(transfer.FileUpload): haltOnFailure = True def __init__(self): - transfer.FileUpload.__init__(self, self.slavesrc, self.masterdest) + transfer.FileUpload.__init__(self, self.slavesrc, self.masterdest, mode=0644) class DownloadBuiltProduct(transfer.FileDownload): @@ -193,7 +193,7 @@ class RunWebKitTests(shell.Test): descriptionDone = ["layout-tests"] command = ["perl", "./Tools/Scripts/run-webkit-tests", "--no-launch-safari", "--no-new-test-results", "--no-sample-on-timeout", "--results-directory", "layout-test-results", "--use-remote-links-to-tests", - WithProperties("--%(configuration)s"), "--exit-after-n-crashes-or-timeouts", "20"] + WithProperties("--%(configuration)s"), "--exit-after-n-crashes-or-timeouts", "20", "--exit-after-n-failures", "500"] def __init__(self, skipBuild=False, *args, **kwargs): self.skipBuild = skipBuild @@ -319,7 +319,7 @@ class RunQtAPITests(shell.Test): descriptionDone = ["API tests"] command = ["python", "./Tools/Scripts/run-qtwebkit-tests", "--output-file=qt-unit-tests.html", "--do-not-open-results", "--timeout=30", - WithProperties("WebKitBuild/%(configuration_pretty)s/WebKit/qt/tests/")] + WithProperties("WebKitBuild/%(configuration_pretty)s/Source/WebKit/qt/tests/")] def start(self): self.setProperty("configuration_pretty", self.getProperty("configuration").title()) @@ -393,7 +393,7 @@ class UploadTestResults(transfer.FileUpload): masterdest = WithProperties("public_html/results/%(buildername)s/r%(got_revision)s (%(buildnumber)s).zip") def __init__(self): - transfer.FileUpload.__init__(self, self.slavesrc, self.masterdest) + transfer.FileUpload.__init__(self, self.slavesrc, self.masterdest, mode=0644) class ExtractTestResults(master.MasterShellCommand): diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 364e941..9c81c47 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,1056 @@ +2011-01-17 Tony Gentilcore + + Reviewed by Alexey Proskuryakov. + + Fix some headers with missing or misspelled #ifndef guards + https://bugs.webkit.org/show_bug.cgi?id=52545 + + * DumpRenderTree/chromium/TestEventPrinter.h: + * DumpRenderTree/chromium/WebPreferences.h: + +2011-01-17 Jessie Berlin + + Reviewed by Anders Carlsson. + + REGRESSION: Assertion failure in FrameLoader::continueLoadAfterWillSubmitForm() when + navigating back to an unreachable URL + https://bugs.webkit.org/show_bug.cgi?id=52388 + + Add a third parameter (unreachableURL) to queueLoadHTMLString. + + * DumpRenderTree/LayoutTestController.cpp: + (queueLoadHTMLStringCallback): + (LayoutTestController::queueLoadHTMLString): + (LayoutTestController::queueLoadAlternateHTMLString): + * DumpRenderTree/LayoutTestController.h: + + * DumpRenderTree/WorkQueueItem.h: + (LoadHTMLStringItem::LoadHTMLStringItem): + + * DumpRenderTree/chromium/LayoutTestController.cpp: + (WorkItemLoadHTMLString::WorkItemLoadHTMLString): + (WorkItemLoadHTMLString::run): + (LayoutTestController::queueLoadHTMLString): + + * DumpRenderTree/gtk/WorkQueueItemGtk.cpp: + (LoadHTMLStringItem::invoke): + * DumpRenderTree/mac/WorkQueueItemMac.mm: + (LoadHTMLStringItem::invoke): + * DumpRenderTree/win/WorkQueueItemWin.cpp: + (LoadHTMLStringItem::invoke): + +2011-01-17 Dan Bernstein + + Rubber-stamped by Mark Rowe. + + Update xcodeproj svn:ignore to include xcuserdata. + + * DumpRenderTree/DumpRenderTree.xcodeproj: Modified property svn:ignore. + * MiniBrowser/MiniBrowser.xcodeproj: Modified property svn:ignore. + * TestWebKitAPI/TestWebKitAPI.xcodeproj: Modified property svn:ignore. + * WebKitLauncher/WebKitLauncher.xcodeproj: Modified property svn:ignore. + * WebKitTestRunner/WebKitTestRunner.xcodeproj: Modified property svn:ignore. + +2011-01-17 Csaba Osztrogonác + + Unreviewed fix after r75908. + + Move WebKit into Source + https://bugs.webkit.org/show_bug.cgi?id=52530 + + * BuildSlaveSupport/build.webkit.org-config/master.cfg: Add Source to the path for Qt API tests. + +2011-01-17 Csaba Osztrogonác + + Unreviewed. + + Remove accidentally committed debug printing after r75908. + + * Scripts/webkitdirs.pm: + +2011-01-17 John Knottenbelt + + Unreviewed. + + Add myself to committers list + https://bugs.webkit.org/show_bug.cgi?id=52566 + + * Scripts/webkitpy/common/config/committers.py: + +2011-01-17 John Knottenbelt + + Reviewed by Jeremy Orlow. + + GeolocationController should call stopUpdating on destruction + https://bugs.webkit.org/show_bug.cgi?id=52216 + + fast/dom/Geolocation/window-close-crash.html requires that a + Geolocation watch be started in a secondary window. Consequently, + we need to allow geolocation permission and provide a mock + geolocation position for the secondary window's + GeolocationClientMock. + + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::setGeolocationPermission): + (LayoutTestController::setMockGeolocationPosition): + (LayoutTestController::setMockGeolocationError): + * DumpRenderTree/chromium/TestShell.h: + (TestShell::windowList): + +2011-01-16 Adam Barth + + Update more include paths to reflect WebKit move. + + * DumpRenderTree/chromium/EventSender.cpp: + (EventSender::keyDown): + (EventSender::needsShiftModifier): + * DumpRenderTree/chromium/WebThemeEngineDRTMac.h: + * DumpRenderTree/chromium/WebThemeEngineDRTMac.mm: + +2011-01-16 Kent Tamura + + Unreviewed, Chromium build fix. + + * Scripts/update-webkit-chromium: Webkit/chromium -> Source/WebKit/chromium + +2011-01-16 Martin Robinson + + Build fix for GTK+ after source directory movement. + + * GNUmakefile.am: Correct include paths. + +2011-01-16 Adam Barth + + Teach svn-apply about WebKit move. + + * Scripts/VCSUtils.pm: + +2011-01-16 Adam Barth + + Rubber-stamped by Eric Seidel. + + Move WebKit into Source + https://bugs.webkit.org/show_bug.cgi?id=52530 + + * DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h: + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + * DumpRenderTree/qt/DumpRenderTreeQt.h: + * DumpRenderTree/qt/GCControllerQt.cpp: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + * DumpRenderTree/qt/PlainTextControllerQt.cpp: + * DumpRenderTree/qt/TextInputControllerQt.cpp: + * DumpRenderTree/wscript: + * QtTestBrowser/launcherwindow.h: + * Scripts/build-webkit: + * Scripts/webkitdirs.pm: + +2011-01-15 Adam Barth + + Teach svn-apply about WebKit2 move. + + * Scripts/VCSUtils.pm: + +2011-01-15 Adam Barth + + Rubber-stamped by Eric Seidel. + + Move WebKit2 into Source + https://bugs.webkit.org/show_bug.cgi?id=52438 + + * MiniBrowser/qt/MiniBrowser.pro: + * Scripts/build-webkit: + * Scripts/do-file-rename: + * Scripts/do-webcore-rename: + * Scripts/test-webkitpy: + * Scripts/webkitdirs.pm: + * Scripts/webkitpy/style/checker.py: + * WebKitTestRunner/DerivedSources.pro: + * WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro: + * WebKitTestRunner/qt/WebKitTestRunner.pro: + +2011-01-15 Jochen Eisinger + + Reviewed by David Levin. + + [chromium] remove obsolete createView method + https://bugs.webkit.org/show_bug.cgi?id=52437 + + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::createView): + * DumpRenderTree/chromium/WebViewHost.h: + +2011-01-14 Brian Weinstein + + Reviewed by Geoff Garen. + + ShouldLoadResourceForFrame should use strings, not URLs. + https://bugs.webkit.org/show_bug.cgi?id=52476 + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::shouldLoadResourceForFrame): Update to use a WKStringRef. + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: + +2011-01-14 Tony Gentilcore + + Reviewed by David Levin. + + Add Tony Gentilcore as a reviewer + https://bugs.webkit.org/show_bug.cgi?id=52480 + + * Scripts/webkitpy/common/config/committers.py: + +2011-01-14 David Levin + + Reviewed by Eric Seidel. + + check-webkit-style: _FunctionState should keep track of where the function name starts. + https://bugs.webkit.org/show_bug.cgi?id=52454 + + * Scripts/webkitpy/style/checkers/cpp.py: Added function_name_start_position to + _FunctionState and logic for setting it correctly. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added tests. + +2011-01-14 Vincent Scheib + + Reviewed by David Levin. + + Add support to DumpRenderTree to use the GPU rather than software renderer + https://bugs.webkit.org/show_bug.cgi?id=52333 + + * DumpRenderTree/chromium/DumpRenderTree.cpp: + (main): + * Scripts/webkitpy/layout_tests/port/chromium.py: + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + +2011-01-14 Tony Chang + + Reviewed by Kent Tamura. + + [chromium] update fonts.conf to fix 6 linux tests in drt + https://bugs.webkit.org/show_bug.cgi?id=52411 + + * DumpRenderTree/chromium/fonts.conf: Update to match the copy in + chromium's src/webkit/tools/test_shell/resources/fonts.conf + +2011-01-14 Eric Seidel + + Original patch from Peter Gal + + Reviewed by Adam Barth. + + Fix when running Tools/Scripts/check-webkit-style without arguments. + https://bugs.webkit.org/show_bug.cgi?id=52261#c16 + + * Scripts/webkitpy/common/checkout/scm.py: Handle None for changed_files argument better in Git.create_patch method. + * Scripts/webkitpy/common/checkout/scm_unittest.py: + +2011-01-04 Jochen Eisinger + + Reviewed by David Levin. + + Store the tempdir object in a variable so it doesn't get deleted too early. + https://bugs.webkit.org/show_bug.cgi?id=51875 + + * Scripts/update-webkit-auxiliary-libs: + * Scripts/update-webkit-support-libs: + +2011-01-14 Eric Seidel + + Unreviewed. Make it work in python 2.5. + + webkit-patch suggest-reviewers dies when ChangeLogs are missing + https://bugs.webkit.org/show_bug.cgi?id=49158 + + * Scripts/webkitpy/common/checkout/api_unittest.py: + +2011-01-14 Sheriff Bot + + Unreviewed, rolling out r75774. + http://trac.webkit.org/changeset/75774 + https://bugs.webkit.org/show_bug.cgi?id=52431 + + gtk builds were broken (Requested by loislo2 on #webkit). + + * Scripts/webkitpy/common/checkout/scm.py: + +2011-01-14 David Levin + + Reviewed by Shinichiro Hamaji. + + check-webkit-style: _FunctionState should detect pure functions. + https://bugs.webkit.org/show_bug.cgi?id=52428 + + * Scripts/webkitpy/style/checkers/cpp.py: Added detection for if a function declaration + is a pure virtual function. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added tests for verifying that pure + virtual functions are correctly detected. + +2011-01-13 Ilya Tikhonovsky + + Reviewed by Yury Semikhatsky. + + Just small fix for problem with check-webkit-style. + It just didn't work for this patch. + Old code can't concatenate a list of strings with None. + + * Scripts/webkitpy/common/checkout/scm.py: + +2011-01-13 David Levin + + Reviewed by Shinichiro Hamaji. + + check-webkit-style: _FunctionState should use Position to know where items are. + https://bugs.webkit.org/show_bug.cgi?id=52424 + + * Scripts/webkitpy/style/checkers/cpp.py: + (_FunctionState.*): Changed _FunctionState to use Position instead of line numbers. + (detect_functions): Changed to pass Position's to _FunctionState.begin and + did some minor clean-up. + (*): Other changes are simply about converting to use the Position's in_FunctionState + instead of line numbers. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: Changed the test code + to verify the positions stored in _FunctionState. + +2011-01-13 Eric Seidel + + Reviewed by David Levin. + + webkit-patch suggest-reviewers dies when ChangeLogs are missing + https://bugs.webkit.org/show_bug.cgi?id=49158 + + This is not the most elegant, but it is a very safe fix to this bug. + One advantage of catching ScriptError like this instead of adding a + new added_or_modified_files or fixing all changed_files callers + to use a more specific change_files variant, is that we catch + all kinds of ScriptErrors which might cause our (non-essential) + suggest-reviewers code to fail out. This should make passing + --suggest-reviewers to webkit-patch upload much more robust + and may even make it possible for us to make it default. + + The root of the problem here is that SCM.changed_files includes + deleted ChangeLog paths (from moves, etc) which then when we ask + SVN/Git for the contents of the file at that revision, the command + errors out and Executive.run_command raises a ScriptError. + + In the future we might fix this differently by making all current + callers of chagned_files use a more specific method for requesting + what types of changes they're interested in (adds, modifies, deletes, etc.) + + * Scripts/webkitpy/common/checkout/api.py: + * Scripts/webkitpy/common/checkout/api_unittest.py: + +2011-01-13 Dan Bernstein + + Reviewed by Alexey Proskuryakov. + + REGRESSION (r71884): Cross-origin XHR fails if willSendRequest changes the URL + https://bugs.webkit.org/show_bug.cgi?id=52419 + + Allow to further control the behavior of the willSendRequest delegate callback by making it + set a different URL in the new request. + + * DumpRenderTree/LayoutTestController.cpp: + (addURLToRedirectCallback): Added. + (LayoutTestController::staticFunctions): Added addURLToRedirect. + (LayoutTestController::addURLToRedirect): Added. Adds the redirection to the map. + (LayoutTestController::redirectionDestinationForURL): Added this getter. + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/mac/ResourceLoadDelegate.mm: + (-[ResourceLoadDelegate webView:resource:willSendRequest:redirectResponse:fromDataSource:]): Check + if there is a redirection for the request’s URL, established by addURLToRedirect(), and if so, + change the URL in the new request to the redirect destination. + +2011-01-13 Eric Seidel + + Reviewed by Mihai Parparita. + + webkit-patch suggest-reviewers fails due to invalid utf8 in ChangeLog files + https://bugs.webkit.org/show_bug.cgi?id=52416 + + Example: webkit-patch suggest-reviewers -g ca3890fe74d94d85d6bfa48f9ea497b094d8e717 + UnicodeDecodeError: 'utf8' codec can't decode bytes in position 536-538: invalid data + + I also added FIXMEs about the changed_files returning deleted files problem + which is causing the other most common exception for suggest-reviewers + (and is probably breaking sheriff-bots blame detection). + + * Scripts/webkitpy/common/checkout/api.py: + * Scripts/webkitpy/common/checkout/api_unittest.py: + * Scripts/webkitpy/common/checkout/scm.py: + +2011-01-13 Eric Seidel + + Reviewed by Adam Barth. + + results archives from commit-queue are too large to upload + https://bugs.webkit.org/show_bug.cgi?id=52405 + + * Scripts/webkitpy/common/system/filesystem.py: + * Scripts/webkitpy/common/system/filesystem_mock.py: + * Scripts/webkitpy/tool/commands/queues.py: + +2011-01-13 Alejandro G. Castro + + Reviewed by Martin Robinson. + + [gtk] Zero-sized font does not yet work + https://bugs.webkit.org/show_bug.cgi?id=49793 + + Set minimum-font-size to 0 for the DRT. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (resetDefaultsToConsistentValues): + +2011-01-13 Csaba Osztrogonác + + Reviewed by Darin Adler. + + Make old-run-webkit-tests more robust on buildbots + https://bugs.webkit.org/show_bug.cgi?id=52364 + + * BuildSlaveSupport/build.webkit.org-config/master.cfg: Pass --exit-after-n-failures 500 to old-run-webkit-tests script. + +2011-01-13 Csaba Osztrogonác + + Reviewed by Darin Adler. + + Make old-run-webkit-tests more robust on buildbots + https://bugs.webkit.org/show_bug.cgi?id=52364 + + * Scripts/old-run-webkit-tests: Ensure that testResultsDirectory is empty. + +2011-01-13 Tony Chang + + Reviewed by Kent Tamura. + + [chromium] fix plugins/plugin-javascript-access.html on Linux and Mac + https://bugs.webkit.org/show_bug.cgi?id=52332 + + Forked Info.plist is not longer needed. + + * DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist: Removed. + +2011-01-13 Mikhail Naganov + + Reviewed by Timothy Hatcher. + + Web Inspector: Cleanup after r75613 -- make all UI-facing strings + to be passed directly to WebInspector.UIString + + https://bugs.webkit.org/show_bug.cgi?id=52365 + + * Scripts/check-inspector-strings: + +2011-01-13 Sheriff Bot + + Unreviewed, rolling out r74881. + http://trac.webkit.org/changeset/74881 + https://bugs.webkit.org/show_bug.cgi?id=52357 + + The EFL builder has been red for days (Requested by abarth on + #webkit). + + * Scripts/webkitpy/common/net/buildbot/buildbot.py: + * Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py: + +2011-01-12 Maciej Stachowiak + + Reviewed by David Levin. + + Add beforeunload support to WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=52353 + + This makes a number of currently failing tests pass. + + * WebKitTestRunner/TestController.cpp: + (WTR::runBeforeUnloadConfirmPanel): + (WTR::createOtherPage): + (WTR::TestController::initialize): + +2011-01-12 Maciej Stachowiak + + Reviewed by Sam Weinig. + + Detect, identify and recover from WebProcess crashes in run-webkit-tests + https://bugs.webkit.org/show_bug.cgi?id=52330 + + * Scripts/old-run-webkit-tests: Detect when the regression test tool reports + a web process crash. + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): Set up a processDidCrash + callback. + (WTR::TestController::processDidCrash): Report that the Web process + crashed. + * WebKitTestRunner/TestController.h: + +2011-01-12 David Levin + + Reviewed by Shinichiro Hamaji. + + check-webkit-style -- close_expression function doesn't work correctly. + https://bugs.webkit.org/show_bug.cgi?id=52272 + + * Scripts/webkitpy/style/checkers/cpp.py: + (Position.__str__): Added a way to convert it to a string which is useful in tests. + (Position.__cmp__): Added a way to compare Position which is useful in tests and + generally useful (for upcoming code changes). + (close_expression): Changed to use Position for input and output. + Also, fixed many bugs such as only working correctly for parenthesis, + not working correctly if given an offset in a line and not finding + the real closing element if there were multiple closing elements in + the same line. + (detect_functions): Adjusted due to the change in arguments for + close_expression. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + (CppStyleTestBase.assert_positions_equal): Added a way to verify that + two positions are the same. + (CppStyleTest.test_position): Added tests for the __str_ and __cmp__ methods. + (CppStyleTest.test_close_expression): Added tests to catch the issues + that were fixed. + +2011-01-12 Sheriff Bot + + Unreviewed, rolling out r75576. + http://trac.webkit.org/changeset/75576 + https://bugs.webkit.org/show_bug.cgi?id=52304 + + broke rebaseline-chromium-webkit-test (Requested by thakis on + #webkit). + + * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py: + * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py: + * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py: + * Scripts/webkitpy/layout_tests/layout_package/test_runner.py: + * Scripts/webkitpy/layout_tests/port/base.py: + * Scripts/webkitpy/layout_tests/port/chromium.py: + * Scripts/webkitpy/layout_tests/port/port_testcase.py: + * Scripts/webkitpy/layout_tests/port/test.py: + * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py: + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + * Scripts/webkitpy/style/checkers/test_expectations.py: + * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: + +2011-01-12 Maciej Stachowiak + + Reviewed by Darin Adler. + + Add a no-build option to run-webkit-tests, to avoid building DRT/WKTR + https://bugs.webkit.org/show_bug.cgi?id=52307 + + * Scripts/old-run-webkit-tests: + +2011-01-12 Koan-Sin Tan + + Reviewed by Martin Robinson. + + [Gtk] WebKitGtk+ doesn't build on Mac OS X 10.6 + https://bugs.webkit.org/show_bug.cgi?id=50867 + + Fixed library extention for Mac in webkitdirs.pm and type conflict in + TestNetscapePlugin.cpp + + * GNUmakefile.am: Don't use AppKit when compiling TestNetscapePlugin for GTK+ + * Scripts/webkitdirs.pm: + +2011-01-12 Mikhail Naganov + + Reviewed by Pavel Feldman. + + Add check-inspector-strings script. + + https://bugs.webkit.org/show_bug.cgi?id=52295 + + * Scripts/check-inspector-strings: Added. + +2011-01-12 Adam Roben + + Advertise the .testnetscape file extension on Windows + + Fixes + plugins/no-mime-with-valid-extension.html fails on Windows + + Reviewed by Dan Bernstein. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc: Added a + FileExtents field to map the .testnetscape file extension to the + application/x-webkit-test-netscape MIME type, just as we do on Mac. + +2011-01-12 Adam Barth + + Reviewed by Eric Seidel. + + Make webkit-patch support subdirectories for SVN checkouts + https://bugs.webkit.org/show_bug.cgi?id=52261 + + os.relpath does not exist on Python 2.5, so we need to call our version + of the API. + + * Scripts/webkitpy/common/checkout/scm.py: + +2011-01-11 Maciej Stachowiak + + Reviewed by Eric Seidel. + + Close additional pages opened during a test once the test completes. + https://bugs.webkit.org/show_bug.cgi?id=52276 + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::done): + +2011-01-11 David Levin + + Reviewed by Eric Seidel. + + Errors should be separated from the command line in bot messages. + https://bugs.webkit.org/show_bug.cgi?id=52275 + + * Scripts/webkitpy/common/system/executive.py: + (ScriptError.message_with_output): Added a newline to separate the command + line from the errors. + * Scripts/webkitpy/common/system/executive_unittest.py: + (ScriptErrorTest.test_message_with_output): Added tests for the various code + paths in message_with_output. + +2011-01-11 Eric Seidel + + Unreviewed. + + commit-queue should know how to upload archived results (for test flakes or general failures) + https://bugs.webkit.org/show_bug.cgi?id=52048 + + The zips are mostly empty due to forgetting -r. + Expected diffs were not being pulled from the archive due + to the archive having longer paths than I realized. + + * Scripts/webkitpy/common/system/workspace.py: + * Scripts/webkitpy/common/system/workspace_unittest.py: + * Scripts/webkitpy/tool/bot/flakytestreporter.py: + * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py: + +2011-01-11 Dirk Pranke + + Reviewed by Ojan Vafai. + + The current modifier parsing code in test_expectations is + fragile and hard-coded, so it's not easy to understand the logic + or easily add new types of modifiers (like GPU vs. CPU testing + for graphics tests, or 32-bit vs. 64-bit differences). + + This is the first of two patches that will add in more generic + support and then eliminate the GPU-specific test expectations + files for Chromium. + + This patch adds two standalone objects for handling modifiers. The + rules for interpreting modifiers, precedence, and conflicts are + given in the docstring to the ModifierMatcher class, which + returns ModifierMatchResult objects. + + This patch also adds routines to the Port interface and a + default set of values in the base object, in order to obtain the + values needed on a given test run. These values are then passed + to the expectation parser. This also allows us to clean up the + logic used to lint all of the different configurations in a + single test_expectations.txt file. + + The next patch will merge in the separate GPU expectations file. + + https://bugs.webkit.org/show_bug.cgi?id=51222 + + * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py: + * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py: + * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py: + * Scripts/webkitpy/layout_tests/port/base.py: + * Scripts/webkitpy/layout_tests/port/base_unittest.py: + * Scripts/webkitpy/layout_tests/port/chromium.py: + * Scripts/webkitpy/layout_tests/port/port_testcase.py: + * Scripts/webkitpy/layout_tests/port/test.py: + * Scripts/webkitpy/layout_tests/run_webkit_tests.py: + * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py: + +2011-01-11 Maciej Stachowiak + + Reviewed by Adam Barth. + + Make webkit-patch support subdirectories for SVN checkouts + https://bugs.webkit.org/show_bug.cgi?id=52261 + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/style_references.py: + * Scripts/webkitpy/tool/main.py: + * Scripts/webkitpy/tool/steps/preparechangelog.py: + +2011-01-11 Eric Seidel + + Unreviewed. + + commit-queue should know how to upload archived results (for test flakes or general failures) + https://bugs.webkit.org/show_bug.cgi?id=52048 + + I changed the API for archive_last_layout_test_results w/o updating the implementation. Oops. + This fixes an exception seen on the commit-queue when attempting to report flaky tests. + + * Scripts/webkitpy/common/system/workspace.py: + * Scripts/webkitpy/common/system/workspace_unittest.py: + * Scripts/webkitpy/tool/commands/queues.py: + +2011-01-11 Sam Weinig + + Roll r75474 back in. + +2011-01-11 Jocelyn Turcotte + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove uses of QFuture since it isn't supported on all platforms. + https://bugs.webkit.org/show_bug.cgi?id=51204 + + * QtTestBrowser/webpage.h: + (QtNAMThread::QtNAMThread): + (QtNAMThread::networkAccessManager): + (QtNAMThread::run): + +2011-01-11 Peter Varga + + Unreviewed. + + Add myself to committers' list. + + * Scripts/webkitpy/common/config/committers.py: + +2011-01-11 Eric Seidel + + Reviewed by Adam Barth. + + commit-queue should know how to upload archived results (for test flakes or general failures) + https://bugs.webkit.org/show_bug.cgi?id=52048 + + Now the queue will always upload results. Either the entire zip, or just + the diffs.txt in the case of text failures. + + This should make understanding flakes much easier, and paves the way + for having the EWS run layout tests (and upload failures). + + In order to upload .zip files I had to teach bugzilla.py to autodetect + mime types from the filename. Since mimetypes.py doesn't include a mapping + for .patch files, I have it add one before calling guess_type. + + We may find that always uploading the whole zip instead of just the -diffs.txt + file is preferable, but for now I'm keeping the old behavior because it makes + quickly understanding text failures easy. + + * Scripts/webkitpy/common/net/bugzilla/bugzilla.py: + * Scripts/webkitpy/common/system/workspace.py: Added. + * Scripts/webkitpy/common/system/workspace_unittest.py: Added. + * Scripts/webkitpy/tool/bot/commitqueuetask.py: + * Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py: + * Scripts/webkitpy/tool/bot/flakytestreporter.py: + * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py: + * Scripts/webkitpy/tool/commands/queues.py: + * Scripts/webkitpy/tool/commands/queues_unittest.py: + +2011-01-10 Sheriff Bot + + Unreviewed, rolling out r75464. + http://trac.webkit.org/changeset/75464 + https://bugs.webkit.org/show_bug.cgi?id=52193 + + Followup rollout for 75474 (Requested by Ossy on #webkit). + + * MiniBrowser/mac/BrowserWindowController.m: + (-[BrowserWindowController awakeFromNib]): + * MiniBrowser/win/BrowserView.cpp: + (BrowserView::create): + * WebKitTestRunner/TestController.cpp: + (WTR::createOtherPage): + (WTR::TestController::initialize): + +2011-01-10 Laszlo Gombos + + Reviewed by Csaba Osztrogonác. + + [Qt] Baseline qt_minimal configuration + https://bugs.webkit.org/show_bug.cgi?id=51313 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting): Add + QT_NO_UNDOSTACK guard. + + * QtTestBrowser/launcherwindow.cpp: + (LauncherWindow::createChrome): Add QT_NO_SHORTCUT and QT_NO_PRINTER + guards. + (LauncherWindow::applyZoom): Add QT_NO_ANIMATION guard. + (LauncherWindow::screenshot): Add QT_NO_FILEDIALOG guard. + (LauncherWindow::selectElements): Add QT_NO_INPUTDIALOG guard. + (LauncherWindow::showUserAgentDialog): Add QT_NO_COMBOBOX guard. + + * QtTestBrowser/launcherwindow.h: + * QtTestBrowser/locationedit.cpp: Add QT_NO_INPUTDIALOG guard. + * QtTestBrowser/locationedit.h: Ditto. + + * QtTestBrowser/mainwindow.cpp: + (MainWindow::buildUI): Add QT_NO_INPUTDIALOG, QT_NO_SHORTCUT and + QT_NO_UNDOSTACK guards. + (MainWindow::setAddressUrl): Add QT_NO_INPUTDIALOG guard. + (MainWindow::changeLocation): Ditto. + (MainWindow::openFile): Add QT_NO_FILEDIALOG guard. + (MainWindow::openLocation): Add QT_NO_INPUTDIALOG guard. + + * QtTestBrowser/webpage.cpp: + (WebPage::openUrlInDefaultBrowser): Add QT_NO_DESKTOPSERVICES guard. + (WebPage::authenticationRequired): Add QT_NO_LINEEDIT guard. + + * QtTestBrowser/webview.cpp: + (WebViewGraphicsBased::animatedFlip): Add QT_NO_ANIMATION guard. + (WebViewGraphicsBased::animatedYFlip): Ditto. + +2011-01-10 Sam Weinig + + Fix build. + + * MiniBrowser/mac/BrowserWindowController.m: + (-[BrowserWindowController awakeFromNib]): + * MiniBrowser/win/BrowserView.cpp: + (BrowserView::create): + * WebKitTestRunner/TestController.cpp: + (WTR::createOtherPage): + (WTR::TestController::initialize): + +2011-01-10 Eric Seidel + + Reviewed by Ojan Vafai. + + style-queue messages are way too long for big patches + https://bugs.webkit.org/show_bug.cgi?id=52161 + + We definitely could build much fancier list-to-string-with-limit functions + but this should be sufficient for our needs at the moment. + + * Scripts/webkitpy/common/system/executive.py: + * Scripts/webkitpy/common/system/executive_unittest.py: + +2011-01-10 Tony Chang + + Unreviewed, rolling out r75398. + http://trac.webkit.org/changeset/75398 + https://bugs.webkit.org/show_bug.cgi?id=52008 + + Some layout tests are crashing on Chromium Win. + + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::updatePaintRect): + * DumpRenderTree/chromium/WebViewHost.h: + +2011-01-10 Adam Roben + + Roll out r75392 + + It isn't needed now that r75289 has been rolled out. + + * Scripts/run-javascriptcore-tests: + +2011-01-10 Maciej Stachowiak + + Reviewed by Anders Carlsson. + + WebKitTestRunner uses crazy amounts of CPU, making layout tests slow and flaky + https://bugs.webkit.org/show_bug.cgi?id=52160 + + * WebKitTestRunner/mac/TestControllerMac.mm: + (WTR::TestController::platformRunUntil): Instead of busy-looping, wait for the timeout. + Anything that can make runUntil() conditions turn true will happen on a run loop cycle + anyway. + +2011-01-10 Tony Chang + + Reviewed by Mihai Parparita. + + [chromium] fix for animated gif layout tests + https://bugs.webkit.org/show_bug.cgi?id=52008 + + * DumpRenderTree/chromium/WebViewHost.cpp: Schedule a paint when we update the paint rect + to trigger gif animations. + (WebViewHostPaintTask::WebViewHostPaintTask): + (WebViewHostPaintTask::runIfValid): + (WebViewHost::updatePaintRect): + * DumpRenderTree/chromium/WebViewHost.h: + (WebViewHost::taskList): + +2011-01-10 Alejandro G. Castro + + Reviewed by Xan Lopez. + + [GTK] Fix gtk2 compilation for master + https://bugs.webkit.org/show_bug.cgi?id=51885 + + * DumpRenderTree/gtk/PixelDumpSupportGtk.cpp: + (createBitmapContextFromWebView): Replaced the old + gdk_drawable_get_size with gdk_pixmap_get_size. + +2011-01-10 Patrick Gansterer + + Reviewed by Laszlo Gombos. + + [WINCE] Reenable NPAPI after r75203 + https://bugs.webkit.org/show_bug.cgi?id=52109 + + Remove the !isWinCE() check for ENABLE_NETSCAPE_PLUGIN_API and replace + it with !isEfl(), because EFL port does not support NPAPI (yet). + + * Scripts/build-webkit: + +2011-01-10 Adam Roben + + Skip some asserting JS tests + + See . + + * Scripts/run-javascriptcore-tests: + +2011-01-10 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] build-webkit disable Blob support via arguments passed to automake + https://bugs.webkit.org/show_bug.cgi?id=52097 + + * Scripts/build-webkit: Enable Blob support when building WebKitGTK+ via + build-webkit. + +2011-01-10 Adam Roben + + Use the same name and description for TestNetscapePlugin on Windows and + Mac + + Fixes + fast/frames/iframe-reparenting-plugins.html fails on Windows + + Reviewed by Steve Falkenburg. + + * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc: Copied + the name and description from Mac's Info.plist. + +2011-01-10 Siddharth Mathur + + Reviewed by Laszlo Gombos. + + [Qt][WK2] Guard gcc-specific syntax + + Non-gcc based compliers choke on the "-include" + syntax for preinclude, place guard around it. + + * WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro: + * WebKitTestRunner/qt/WebKitTestRunner.pro: + +2011-01-10 Andreas Kling + + Reviewed by Simon Hausmann. + + [Qt] [WK2] MiniBrowser does not load pages opened in new windows + https://bugs.webkit.org/show_bug.cgi?id=52111 + + When getting a createNewPage() callback from QWKPage, create the + new page with the same QWKContext as the page that is passed to + the callback. + + * MiniBrowser/qt/BrowserView.h: + * MiniBrowser/qt/BrowserWindow.cpp: + (newPageFunction): + (BrowserWindow::BrowserWindow): + * MiniBrowser/qt/BrowserWindow.h: + +2011-01-10 Andreas Kling + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] MiniBrowser: Remove superfluous createNewPage() callback + + BrowserView set its own useless createNewPage() callback on QWKPage. + This was immediately overridden by BrowserWindow anyway, so remove + the BrowserView one. + + * MiniBrowser/qt/BrowserView.cpp: + (BrowserView::BrowserView): + +2011-01-10 John Knottenbelt + + Reviewed by Jeremy Orlow. + + [Chromium] Remove non-client-based Geolocation code + https://bugs.webkit.org/show_bug.cgi?id=50921 + + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::setGeolocationPermission): + (LayoutTestController::setMockGeolocationPosition): + (LayoutTestController::setMockGeolocationError): + * DumpRenderTree/chromium/WebViewHost.cpp: + (WebViewHost::geolocationClientMock): + (WebViewHost::reset): + * DumpRenderTree/chromium/WebViewHost.h: + +2011-01-10 Eric Seidel + + Reviewed by Adam Barth. + + Commit bot tried to land r? cq+ patch + https://bugs.webkit.org/show_bug.cgi?id=36638 + + It should now be possible to post a patch with r? and cq+ and the + commit-queue will correctly wait for the r+ before attempting to land the patch. + (This was a feature requested by several users.) + + One caveat: We don't actually reject r-, cq+ patches from the queue + (we just ignore them), but I think that's OK for now. + + I also noticed that setting r- once a commit-queue node had grabbed + a patch would not properly cancel the landing. That's fixed and + tested in this patch. + + * Scripts/webkitpy/tool/bot/commitqueuetask.py: + * Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py: + * Scripts/webkitpy/tool/bot/feeders.py: + * Scripts/webkitpy/tool/bot/feeders_unittest.py: + +2011-01-08 Benjamin Poulain + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtWebKit crashes when using XMLHttpRequest from the unload event + https://bugs.webkit.org/show_bug.cgi?id=51934 + + When accessing the network from the destructor of QWebPage, the network access manager + was already deleted because the object WebPage was already destructed. + + This solve the problem by linking the lifetime of the network access manager to WebPage's QObject. + The object is now destructed in the destructor of QObject. + + * QtTestBrowser/webpage.cpp: + (WebPage::WebPage): + (WebPage::setQnamThreaded): + * QtTestBrowser/webpage.h: + (QtNAMThread::QtNAMThread): + +2011-01-08 Eric Seidel + + Reviewed by Ojan Vafai. + + test_failures.py should not mention TestShell (long live DumpRenderTree!) + https://bugs.webkit.org/show_bug.cgi?id=52067 + + I ran test-webkitpy, but didn't bother adding a unit test for this string change. + https://bugs.webkit.org/show_bug.cgi?id=51138#c3 is an example of why this is needed. + + * Scripts/webkitpy/layout_tests/layout_package/test_failures.py: + +2011-01-08 Eric Seidel + + Reviewed by Mihai Parparita. + + commit-queue hangs when the ChangeLog diff is bad + https://bugs.webkit.org/show_bug.cgi?id=52072 + + * Scripts/webkitpy/tool/steps/validatechangelogs.py: + * Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py: + 2011-01-08 Adam Barth Teach svn-apply how to re-write WebCore to Source/WebCore. diff --git a/Tools/DumpRenderTree/LayoutTestController.cpp b/Tools/DumpRenderTree/LayoutTestController.cpp index 16a3149..1133a88 100644 --- a/Tools/DumpRenderTree/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/LayoutTestController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. * Copyright (C) 2010 Joone Hur * * Redistribution and use in source and binary forms, with or without @@ -335,6 +335,31 @@ static JSValueRef addDisallowedURLCallback(JSContextRef context, JSObjectRef fun return JSValueMakeUndefined(context); } +static JSValueRef addURLToRedirectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 2) + return JSValueMakeUndefined(context); + + JSRetainPtr origin(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + JSRetainPtr destination(Adopt, JSValueToStringCopy(context, arguments[1], exception)); + ASSERT(!*exception); + + size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get()); + char* originBuffer = new char[maxLength + 1]; + JSStringGetUTF8CString(origin.get(), originBuffer, maxLength + 1); + + maxLength = JSStringGetMaximumUTF8CStringSize(destination.get()); + char* destinationBuffer = new char[maxLength + 1]; + JSStringGetUTF8CString(destination.get(), destinationBuffer, maxLength + 1); + + LayoutTestController* controller = static_cast(JSObjectGetPrivate(thisObject)); + controller->addURLToRedirect(originBuffer, destinationBuffer); + + return JSValueMakeUndefined(context); +} + static JSValueRef callShouldCloseOnWebViewCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -833,8 +858,16 @@ static JSValueRef queueLoadHTMLStringCallback(JSContextRef context, JSObjectRef baseURL.adopt(JSStringCreateWithUTF8CString("")); LayoutTestController* controller = static_cast(JSObjectGetPrivate(thisObject)); - controller->queueLoadHTMLString(content.get(), baseURL.get()); + if (argumentCount >= 3) { + JSRetainPtr unreachableURL; + unreachableURL.adopt(JSValueToStringCopy(context, arguments[2], exception)); + ASSERT(!*exception); + controller->queueLoadAlternateHTMLString(content.get(), baseURL.get(), unreachableURL.get()); + return JSValueMakeUndefined(context); + } + + controller->queueLoadHTMLString(content.get(), baseURL.get()); return JSValueMakeUndefined(context); } @@ -1930,6 +1963,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() static JSStaticFunction staticFunctions[] = { { "abortModal", abortModalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "addURLToRedirect", addURLToRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserScript", addUserScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserStyleSheet", addUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "apiTestNewWindowDataLoadBaseURL", apiTestNewWindowDataLoadBaseURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -2077,6 +2111,11 @@ void LayoutTestController::queueLoadHTMLString(JSStringRef content, JSStringRef WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL)); } +void LayoutTestController::queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL) +{ + WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, unreachableURL)); +} + void LayoutTestController::queueBackNavigation(int howFarBack) { WorkQueue::shared()->queue(new BackItem(howFarBack)); @@ -2140,5 +2179,15 @@ void LayoutTestController::setPOSIXLocale(JSStringRef locale) setlocale(LC_ALL, localeBuf); } +void LayoutTestController::addURLToRedirect(std::string origin, std::string destination) +{ + m_URLsToRedirect[origin] = destination; +} + +const std::string& LayoutTestController::redirectionDestinationForURL(std::string origin) +{ + return m_URLsToRedirect[origin]; +} + const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/Tools/DumpRenderTree/LayoutTestController.h b/Tools/DumpRenderTree/LayoutTestController.h index 026de13..b80d805 100644 --- a/Tools/DumpRenderTree/LayoutTestController.h +++ b/Tools/DumpRenderTree/LayoutTestController.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -45,6 +46,8 @@ public: void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception); void addDisallowedURL(JSStringRef url); + void addURLToRedirect(std::string origin, std::string destination); + const std::string& redirectionDestinationForURL(std::string); void clearAllApplicationCaches(); void clearAllDatabases(); void clearBackForwardList(); @@ -74,6 +77,7 @@ public: void queueForwardNavigation(int howFarForward); void queueLoad(JSStringRef url, JSStringRef target); void queueLoadHTMLString(JSStringRef content, JSStringRef baseURL); + void queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL); void queueLoadingScript(JSStringRef script); void queueNonLoadingScript(JSStringRef script); void queueReload(); @@ -361,6 +365,8 @@ private: // origins which have been granted desktop notification access std::vector m_desktopNotificationAllowedOrigins; + + std::map m_URLsToRedirect; static JSClassRef getJSClass(); static JSStaticValue* staticValues(); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc index a8fbbcd..5a02f9d 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc @@ -70,12 +70,13 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "Apple Inc." - VALUE "FileDescription", "TestNetscapePlugIn" + VALUE "FileDescription", "Simple Netscape plug-in that handles test content for WebKit" + VALUE "FileExtents", "testnetscape" VALUE "FileOpenName", "test netscape content" VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2009" VALUE "MIMEType", "application/x-webkit-test-netscape" VALUE "OriginalFilename", "npTestNetscapePlugin.dll" - VALUE "ProductName", "TestNetscapePlugIn" + VALUE "ProductName", "WebKit Test PlugIn" END END BLOCK "VarFileInfo" diff --git a/Tools/DumpRenderTree/WorkQueueItem.h b/Tools/DumpRenderTree/WorkQueueItem.h index 34276c8..a5823c1 100644 --- a/Tools/DumpRenderTree/WorkQueueItem.h +++ b/Tools/DumpRenderTree/WorkQueueItem.h @@ -61,11 +61,19 @@ public: { } + LoadHTMLStringItem(const JSStringRef content, const JSStringRef baseURL, const JSStringRef unreachableURL) + : m_content(content) + , m_baseURL(baseURL) + , m_unreachableURL(unreachableURL) + { + } + private: virtual bool invoke() const; JSRetainPtr m_content; JSRetainPtr m_baseURL; + JSRetainPtr m_unreachableURL; }; class ReloadItem : public WorkQueueItem { diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 6522450..bd5075c 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -50,6 +50,8 @@ static const char optionTestShell[] = "--test-shell"; static const char optionAllowExternalPages[] = "--allow-external-pages"; static const char optionStartupDialog[] = "--testshell-startup-dialog"; static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps"; + +static const char optionHardwareAcceleratedGL[] = "--enable-hardware-gpu"; static const char optionEnableAcceleratedCompositing[] = "--enable-accelerated-compositing"; static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas"; @@ -119,6 +121,7 @@ int main(int argc, char* argv[]) bool accelerated2DCanvasEnabled = false; bool stressOpt = false; bool stressDeopt = false; + bool hardwareAcceleratedGL = false; string javaScriptFlags; for (int i = 1; i < argc; ++i) { string argument(argv[i]); @@ -140,6 +143,8 @@ int main(int argc, char* argv[]) startupDialog = true; else if (argument == optionCheckLayoutTestSystemDeps) exit(checkLayoutTestSystemDependencies() ? EXIT_SUCCESS : EXIT_FAILURE); + else if (argument == optionHardwareAcceleratedGL) + hardwareAcceleratedGL = true; else if (argument == optionEnableAcceleratedCompositing) acceleratedCompositingEnabled = true; else if (argument == optionEnableAccelerated2DCanvas) @@ -164,6 +169,8 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } + webkit_support::SetUpGLBindings(hardwareAcceleratedGL ? webkit_support::GL_BINDING_DEFAULT : webkit_support::GL_BINDING_SOFTWARE_RENDERER); + if (startupDialog) openStartupDialog(); diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp index 6104a90..77760ba 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/EventSender.cpp @@ -553,7 +553,7 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) } // For one generated keyboard event, we need to generate a keyDown/keyUp - // pair; refer to EventSender.cpp in WebKit/WebKitTools/DumpRenderTree/win. + // pair; refer to EventSender.cpp in Tools/DumpRenderTree/win. // On Windows, we might also need to generate a char event to mimic the // Windows event flow; on other platforms we create a merged event and test // the event flow that that platform provides. @@ -590,7 +590,7 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result) // the command will be dispatched to the renderer just before dispatching // the keyboard event, and then it will be executed in the // RenderView::handleCurrentKeyboardEvent() method, which is called from - // third_party/WebKit/WebKit/chromium/src/EditorClientImpl.cpp. + // third_party/WebKit/Source/WebKit/chromium/src/EditorClientImpl.cpp. // We just simulate the same behavior here. string editCommand; if (getEditCommand(eventDown, &editCommand)) @@ -637,7 +637,7 @@ bool EventSender::needsShiftModifier(int keyCode) { // If code is an uppercase letter, assign a SHIFT key to // eventDown.modifier, this logic comes from - // WebKit/WebKitTools/DumpRenderTree/Win/EventSender.cpp + // Tools/DumpRenderTree/win/EventSender.cpp return (keyCode & 0xFF) >= 'A' && (keyCode & 0xFF) <= 'Z'; } diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index 83e2389..529019b 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -43,11 +43,7 @@ #include "WebDocument.h" #include "WebElement.h" #include "WebFrame.h" -#if ENABLE(CLIENT_BASED_GEOLOCATION) #include "WebGeolocationClientMock.h" -#else -#include "WebGeolocationServiceMock.h" -#endif #include "WebInputElement.h" #include "WebKit.h" #include "WebNotificationPresenter.h" @@ -488,15 +484,20 @@ public: WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL) : m_html(html) , m_baseURL(baseURL) {} + WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL, const WebURL& unreachableURL) + : m_html(html) + , m_baseURL(baseURL) + , m_unreachableURL(unreachableURL) {} bool run(TestShell* shell) { shell->webView()->mainFrame()->loadHTMLString( - WebKit::WebData(m_html.data(), m_html.length()), m_baseURL); + WebKit::WebData(m_html.data(), m_html.length()), m_baseURL, m_unreachableURL); return true; } private: std::string m_html; WebURL m_baseURL; + WebURL m_unreachableURL; }; void LayoutTestController::queueLoadHTMLString(const CppArgumentList& arguments, CppVariant* result) @@ -506,7 +507,10 @@ void LayoutTestController::queueLoadHTMLString(const CppArgumentList& arguments, WebURL baseURL; if (arguments.size() > 1 && arguments[1].isString()) baseURL = WebURL(GURL(arguments[1].toString())); - m_workQueue.addWork(new WorkItemLoadHTMLString(html, baseURL)); + if (arguments.size() > 2 && arguments[2].isString()) + m_workQueue.addWork(new WorkItemLoadHTMLString(html, baseURL, WebURL(GURL(arguments[2].toString())))); + else + m_workQueue.addWork(new WorkItemLoadHTMLString(html, baseURL)); } result->setNull(); } @@ -1519,16 +1523,16 @@ void LayoutTestController::setMockDeviceOrientation(const CppArgumentList& argum m_shell->webViewHost()->deviceOrientationClientMock()->setOrientation(orientation); } +// FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually. +// https://bugs.webkit.org/show_bug.cgi?id=52368 void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); if (arguments.size() < 1 || !arguments[0].isBool()) return; -#if ENABLE(CLIENT_BASED_GEOLOCATION) - m_shell->webViewHost()->geolocationClientMock()->setPermission(arguments[0].toBoolean()); -#else - WebGeolocationServiceMock::setMockGeolocationPermission(arguments[0].toBoolean()); -#endif + Vector windowList = m_shell->windowList(); + for (size_t i = 0; i < windowList.size(); i++) + windowList[i]->geolocationClientMock()->setPermission(arguments[0].toBoolean()); } void LayoutTestController::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result) @@ -1536,11 +1540,9 @@ void LayoutTestController::setMockGeolocationPosition(const CppArgumentList& arg result->setNull(); if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber()) return; -#if ENABLE(CLIENT_BASED_GEOLOCATION) - m_shell->webViewHost()->geolocationClientMock()->setPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble()); -#else - WebGeolocationServiceMock::setMockGeolocationPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble()); -#endif + Vector windowList = m_shell->windowList(); + for (size_t i = 0; i < windowList.size(); i++) + windowList[i]->geolocationClientMock()->setPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble()); } void LayoutTestController::setMockGeolocationError(const CppArgumentList& arguments, CppVariant* result) @@ -1548,11 +1550,9 @@ void LayoutTestController::setMockGeolocationError(const CppArgumentList& argume result->setNull(); if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isString()) return; -#if ENABLE(CLIENT_BASED_GEOLOCATION) - m_shell->webViewHost()->geolocationClientMock()->setError(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); -#else - WebGeolocationServiceMock::setMockGeolocationError(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); -#endif + Vector windowList = m_shell->windowList(); + for (size_t i = 0; i < windowList.size(); i++) + windowList[i]->geolocationClientMock()->setError(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); } void LayoutTestController::abortModal(const CppArgumentList& arguments, CppVariant* result) diff --git a/Tools/DumpRenderTree/chromium/TestEventPrinter.h b/Tools/DumpRenderTree/chromium/TestEventPrinter.h index fdbfd02..337aa1c 100644 --- a/Tools/DumpRenderTree/chromium/TestEventPrinter.h +++ b/Tools/DumpRenderTree/chromium/TestEventPrinter.h @@ -28,6 +28,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef TestEventPrinter_h +#define TestEventPrinter_h + class TestEventPrinter { public: static TestEventPrinter* createDRTPrinter(); @@ -41,3 +44,5 @@ public: virtual void handleImageFooter() const = 0; virtual void handleTestFooter(bool dumpedAnything) const = 0; }; + +#endif // TestEventPrinter_h diff --git a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist b/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist deleted file mode 100644 index 663f058..0000000 --- a/Tools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist +++ /dev/null @@ -1,60 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - WebKitTestNetscapePlugIn - CFBundleGetInfoString - 420+, Copyright 2006-2009 Apple Inc. - CFBundleIconFile - - CFBundleIdentifier - com.apple.testnetscapeplugin - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BRPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - CFPlugInDynamicRegisterFunction - - CFPlugInDynamicRegistration - NO - CFPlugInFactories - - 00000000-0000-0000-0000-000000000000 - MyFactoryFunction - - CFPlugInTypes - - 00000000-0000-0000-0000-000000000000 - - 00000000-0000-0000-0000-000000000000 - - - CFPlugInUnloadFunction - - WebPluginDescription - Simple Netscape plug-in that handles test content for WebKit - WebPluginMIMETypes - - application/x-webkit-test-netscape - - WebPluginExtensions - - testnetscape - - WebPluginTypeDescription - test netscape content - - - WebPluginName - WebKit Test PlugIn - - diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index 14fcdc7..ec6a502 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -571,7 +571,7 @@ WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url) WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent) { WebViewHost* host = new WebViewHost(this); - WebView* view = WebView::create(host, devToolsAgent); + WebView* view = WebView::create(host, devToolsAgent, 0); host->setWebWidget(view); m_prefs.applyTo(view); view->initializeMainFrame(host); diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 486f9ea..ef9be7f 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -166,6 +166,9 @@ public: static const int virtualWindowBorder = 3; + typedef Vector WindowList; + WindowList windowList() const { return m_windowList; } + private: WebViewHost* createNewWindow(const WebKit::WebURL&, DRTDevToolsAgent*); void createMainWindow(); @@ -207,7 +210,6 @@ private: // List of all windows in this process. // The main window should be put into windowList[0]. - typedef Vector WindowList; WindowList m_windowList; #if defined(OS_WIN) diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h index 46877c0..50bb8cc 100644 --- a/Tools/DumpRenderTree/chromium/WebPreferences.h +++ b/Tools/DumpRenderTree/chromium/WebPreferences.h @@ -29,7 +29,7 @@ */ #ifndef WebPreferences_h -#define WebPerferences_h +#define WebPreferences_h #include "WebSettings.h" #include "WebString.h" diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h index a59e207..5b54394 100644 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h +++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.h @@ -30,7 +30,7 @@ #ifndef WebThemeEngineDRTMac_h #define WebThemeEngineDRTMac_h -#include "third_party/WebKit/WebKit/chromium/public/mac/WebThemeEngine.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebThemeEngine.h" class WebThemeEngineDRTMac : public WebKit::WebThemeEngine { public: diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm index 6333a37..2165f0d 100644 --- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm +++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm @@ -30,8 +30,8 @@ #include "WebThemeEngineDRTMac.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" #import #import #import diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index 849312c..62df390 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -43,11 +43,7 @@ #include "WebDragData.h" #include "WebElement.h" #include "WebFrame.h" -#if ENABLE(CLIENT_BASED_GEOLOCATION) #include "WebGeolocationClientMock.h" -#else -#include "WebGeolocationServiceMock.h" -#endif #include "WebHistoryItem.h" #include "WebNode.h" #include "WebRange.h" @@ -231,7 +227,7 @@ static string textAffinityDescription(WebTextAffinity affinity) // WebViewClient ------------------------------------------------------------- -WebView* WebViewHost::createView(WebFrame*, const WebWindowFeatures&, const WebString&) +WebView* WebViewHost::createView(WebFrame*, const WebURLRequest&, const WebWindowFeatures&, const WebString&) { if (!layoutTestController()->canOpenWindows()) return 0; @@ -571,7 +567,6 @@ WebNotificationPresenter* WebViewHost::notificationPresenter() return m_shell->notificationPresenter(); } -#if ENABLE(CLIENT_BASED_GEOLOCATION) WebKit::WebGeolocationClient* WebViewHost::geolocationClient() { return geolocationClientMock(); @@ -583,14 +578,6 @@ WebKit::WebGeolocationClientMock* WebViewHost::geolocationClientMock() m_geolocationClientMock.set(WebGeolocationClientMock::create()); return m_geolocationClientMock.get(); } -#else -WebKit::WebGeolocationService* WebViewHost::geolocationService() -{ - if (!m_geolocationServiceMock) - m_geolocationServiceMock.set(WebGeolocationServiceMock::createWebGeolocationServiceMock()); - return m_geolocationServiceMock.get(); -} -#endif WebSpeechInputController* WebViewHost::speechInputController(WebKit::WebSpeechInputListener* listener) { @@ -1177,12 +1164,8 @@ void WebViewHost::reset() m_editCommandName.clear(); m_editCommandValue.clear(); -#if ENABLE(CLIENT_BASED_GEOLOCATION) if (m_geolocationClientMock.get()) m_geolocationClientMock->resetMock(); -#else - m_geolocationServiceMock.clear(); -#endif if (m_speechInputControllerMock.get()) m_speechInputControllerMock->clearResults(); diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index 20b29c0..0a36aec 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -104,7 +104,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual bool navigate(const TestNavigationEntry&, bool reload); // WebKit::WebViewClient - virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebWindowFeatures&, const WebKit::WebString&); + virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&); virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType); virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&); virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota); @@ -139,11 +139,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual int historyForwardListCount(); virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification); virtual WebKit::WebNotificationPresenter* notificationPresenter(); -#if ENABLE(CLIENT_BASED_GEOLOCATION) virtual WebKit::WebGeolocationClient* geolocationClient(); -#else - virtual WebKit::WebGeolocationService* geolocationService(); -#endif virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*); virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); @@ -210,10 +206,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock(); MockSpellCheck* mockSpellCheck(); -#if ENABLE(CLIENT_BASED_GEOLOCATION) // Geolocation client mocks for LayoutTestController WebKit::WebGeolocationClientMock* geolocationClientMock(); -#endif private: LayoutTestController* layoutTestController() const; @@ -317,11 +311,7 @@ private: OwnPtr m_lastContextMenuData; // Geolocation -#if ENABLE(CLIENT_BASED_GEOLOCATION) OwnPtr m_geolocationClientMock; -#else - OwnPtr m_geolocationServiceMock; -#endif OwnPtr m_deviceOrientationClientMock; OwnPtr m_speechInputControllerMock; diff --git a/Tools/DumpRenderTree/chromium/fonts.conf b/Tools/DumpRenderTree/chromium/fonts.conf index be214c6..b75a932 100644 --- a/Tools/DumpRenderTree/chromium/fonts.conf +++ b/Tools/DumpRenderTree/chromium/fonts.conf @@ -2,6 +2,10 @@ + + false + + Times @@ -152,4 +156,74 @@ false + + + + AutohintedSerif + + + Arial + + + true + + + hintmedium + + + + + + HintedSerif + + + Arial + + + false + + + hintmedium + + + + + + FullAndAutoHintedSerif + + + Arial + + + true + + + hintfull + + + + + + SubpixelEnabledArial + + + Arial + + + rgb + + + + + + SubpixelDisabledArial + + + Arial + + + none + + + diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp index 32a41c3..ff90d81 100644 --- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -408,7 +408,7 @@ static void resetDefaultsToConsistentValues() "fantasy-font-family", "fantasy", "default-font-size", 16, "default-monospace-font-size", 13, - "minimum-font-size", 1, + "minimum-font-size", 0, "enable-caret-browsing", FALSE, "enable-page-cache", FALSE, "auto-resize-window", TRUE, diff --git a/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp b/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp index 4073403..32bc600 100644 --- a/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp +++ b/Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "DumpRenderTree.h" +#include "GtkVersioning.h" #include "PixelDumpSupportCairo.h" #include @@ -39,7 +40,7 @@ PassRefPtr createBitmapContextFromWebView(bool, bool, bool, bool) gint width, height; #ifdef GTK_API_VERSION_2 GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0); - gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height); + gdk_pixmap_get_size(pixmap, &width, &height); #else width = gtk_widget_get_allocated_width(GTK_WIDGET(view)); height = gtk_widget_get_allocated_height(GTK_WIDGET(view)); diff --git a/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp b/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp index 0f44f54..d10b193 100644 --- a/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp +++ b/Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp @@ -61,6 +61,12 @@ bool LoadHTMLStringItem::invoke() const { GOwnPtr content(JSStringCopyUTF8CString(m_content.get())); GOwnPtr baseURL(JSStringCopyUTF8CString(m_baseURL.get())); + + if (m_unreachableURL) { + GOwnPtr unreachableURL(JSStringCopyUTF8CString(m_unreachableURL.get())); + webkit_web_frame_load_alternate_string(mainFrame, content.get(), baseURL.get(), unreachableURL.get()); + return true; + } webkit_web_frame_load_string(mainFrame, content.get(), 0, 0, baseURL.get()); return true; } diff --git a/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h b/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h index 58049c2..ae1371f 100644 --- a/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h +++ b/Tools/DumpRenderTree/mac/InternalHeaders/WebKit/WebTypesInternal.h @@ -1 +1 @@ -#include "../../../../WebKit/mac/Misc/WebTypesInternal.h" +#include "../../../../Source/WebKit/mac/Misc/WebTypesInternal.h" diff --git a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm index 0855b83..2854ca4 100644 --- a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm +++ b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, Apple Inc. All rights reserved. + * Copyright (C) 2007, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -165,6 +165,9 @@ using namespace std; [newRequest setValue:nil forHTTPHeaderField:nsHeader]; [nsHeader release]; } + const std::string& destination = gLayoutTestController->redirectionDestinationForURL([[url absoluteString] UTF8String]); + if (destination.length()) + [newRequest setURL:[NSURL URLWithString:[NSString stringWithUTF8String:destination.data()]]]; return [newRequest autorelease]; } diff --git a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm b/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm index 797afb7..c28e991 100644 --- a/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm +++ b/Tools/DumpRenderTree/mac/WorkQueueItemMac.mm @@ -59,6 +59,12 @@ bool LoadHTMLStringItem::invoke() const RetainPtr contentCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_content.get())); RetainPtr baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get())); + if (m_unreachableURL) { + RetainPtr unreachableURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_unreachableURL.get())); + [mainFrame loadAlternateHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()] forUnreachableURL:[NSURL URLWithString:(NSString *)unreachableURLCF.get()]]; + return true; + } + [mainFrame loadHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()]]; return true; } diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 935a307..fe37958 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -32,7 +32,7 @@ #include "config.h" #include "DumpRenderTreeQt.h" -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" #include "GCControllerQt.h" #include "LayoutTestControllerQt.h" @@ -540,7 +540,9 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting() closeRemainingWindows(); m_page->resetSettings(); +#ifndef QT_NO_UNDOSTACK m_page->undoStack()->clear(); +#endif m_page->mainFrame()->setZoomFactor(1.0); clearHistory(m_page); DumpRenderTreeSupportQt::clearFrameName(m_page->mainFrame()); diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index ef95bfc..8cb5efb 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -40,7 +40,7 @@ #include #endif -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include #include #include diff --git a/Tools/DumpRenderTree/qt/GCControllerQt.cpp b/Tools/DumpRenderTree/qt/GCControllerQt.cpp index 3aa507f..2a30ba8 100644 --- a/Tools/DumpRenderTree/qt/GCControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/GCControllerQt.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "GCControllerQt.h" -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index b8cc9be..56406c2 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -28,7 +28,7 @@ */ #include "config.h" #include "LayoutTestControllerQt.h" -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include "DumpRenderTreeQt.h" #include "WorkQueue.h" diff --git a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp index 441a37c..729ccd0 100644 --- a/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/PlainTextControllerQt.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "PlainTextControllerQt.h" -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include #include #include diff --git a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp index 08d8850..9112674 100644 --- a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp @@ -28,7 +28,7 @@ */ #include "config.h" #include "TextInputControllerQt.h" -#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include #include diff --git a/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp b/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp index a24ca37..49f0667 100644 --- a/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ b/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp @@ -89,6 +89,16 @@ bool LoadHTMLStringItem::invoke() const BSTR contentBSTR = SysAllocString(content.c_str()); BSTR baseURLBSTR = SysAllocString(baseURL.c_str()); + if (m_unreachableURL) { + wstring unreachableURL = jsStringRefToWString(m_unreachableURL.get()); + BSTR unreachableURLBSTR = SysAllocString(unreachableURL.c_str()); + frame->loadAlternateHTMLString(contentBSTR, baseURLBSTR, unreachableURLBSTR); + SysFreeString(contentBSTR); + SysFreeString(baseURLBSTR); + SysFreeString(unreachableURLBSTR); + return true; + } + frame->loadHTMLString(contentBSTR, baseURLBSTR); SysFreeString(contentBSTR); diff --git a/Tools/DumpRenderTree/wscript b/Tools/DumpRenderTree/wscript index d583f1a..67efe9f 100644 --- a/Tools/DumpRenderTree/wscript +++ b/Tools/DumpRenderTree/wscript @@ -34,7 +34,7 @@ include_paths = [ os.path.join(wk_root, 'Source', 'JavaScriptCore'), os.path.join(wk_root, 'Source', 'WebCore'), os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'wx'), - os.path.join(wk_root, 'WebKit', 'wx'), + os.path.join(wk_root, 'Source', 'WebKit', 'wx'), '.', 'wx' ] diff --git a/Tools/GNUmakefile.am b/Tools/GNUmakefile.am index 4813346..3db766f 100644 --- a/Tools/GNUmakefile.am +++ b/Tools/GNUmakefile.am @@ -5,9 +5,9 @@ noinst_PROGRAMS += \ # GtkLauncher Programs_GtkLauncher_CPPFLAGS = \ - -I$(srcdir)/WebKit/gtk \ + -I$(srcdir)/Source/WebKit/gtk \ -I$(srcdir)/Source/WebCore/platform/network/soup/cache/ \ - -I$(top_builddir)/WebKit/gtk \ + -I$(top_builddir)/Source/WebKit/gtk \ -I$(top_builddir)/DerivedSources \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -37,10 +37,10 @@ dumprendertree_cppflags := \ -I$(srcdir)/Tools/DumpRenderTree \ -I$(srcdir)/Tools/DumpRenderTree/cairo \ -I$(srcdir)/Tools/DumpRenderTree/gtk \ - -I$(srcdir)/WebKit/gtk \ + -I$(srcdir)/Source/WebKit/gtk \ -I$(srcdir)/Source/WebCore/platform/gtk \ -I$(srcdir)/Source/WebCore/platform/network/soup/cache/ \ - -I$(top_builddir)/WebKit/gtk \ + -I$(top_builddir)/Source/WebKit/gtk \ -I$(top_builddir)/DerivedSources \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -162,6 +162,11 @@ TestNetscapePlugin_libtestnetscapeplugin_la_CPPFLAGS = \ $(global_cppflags) \ $(javascriptcore_cppflags) +# For the Gtk port we want to use XP_UNIX both on X11 and Mac +if !TARGET_WIN32 +TestNetscapePlugin_libtestnetscapeplugin_la_CPPFLAGS += -DXP_UNIX +endif + TestNetscapePlugin_libtestnetscapeplugin_la_SOURCES = \ Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npapi.h \ Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h \ diff --git a/Tools/MiniBrowser/mac/BrowserWindowController.m b/Tools/MiniBrowser/mac/BrowserWindowController.m index ad3fcab..e761624 100644 --- a/Tools/MiniBrowser/mac/BrowserWindowController.m +++ b/Tools/MiniBrowser/mac/BrowserWindowController.m @@ -637,7 +637,8 @@ static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParameters 0, /* didDraw */ 0, /* pageDidScroll */ 0, /* exceededDatabaseQuota */ - runOpenPanel + runOpenPanel, + 0, /* decidePolicyForGeolocationPermissionRequest */ }; WKPageSetPageUIClient(_webView.pageRef, &uiClient); } diff --git a/Tools/MiniBrowser/qt/BrowserView.cpp b/Tools/MiniBrowser/qt/BrowserView.cpp index e6548ab..6118f79 100644 --- a/Tools/MiniBrowser/qt/BrowserView.cpp +++ b/Tools/MiniBrowser/qt/BrowserView.cpp @@ -30,15 +30,10 @@ #include -static QWKPage* createNewPage(QWKPage* page) -{ - return page; -} - -BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWidget* parent) +BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWKContext* context, QWidget* parent) : QGraphicsView(parent) , m_item(0) - , m_context(new QWKContext(this)) + , m_context(context ? context : new QWKContext(this)) { m_item = new QGraphicsWKView(m_context, backingStoreType, 0); setScene(new QGraphicsScene(this)); @@ -49,7 +44,6 @@ BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWi setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(m_item, SIGNAL(titleChanged(QString)), this, SLOT(setWindowTitle(QString))); - m_item->page()->setCreateNewPageFunction(createNewPage); } void BrowserView::resizeEvent(QResizeEvent* event) diff --git a/Tools/MiniBrowser/qt/BrowserView.h b/Tools/MiniBrowser/qt/BrowserView.h index 7680aa7..e19cc59 100644 --- a/Tools/MiniBrowser/qt/BrowserView.h +++ b/Tools/MiniBrowser/qt/BrowserView.h @@ -37,7 +37,7 @@ class BrowserView : public QGraphicsView { Q_OBJECT public: - BrowserView(QGraphicsWKView::BackingStoreType, QWidget* parent = 0); + BrowserView(QGraphicsWKView::BackingStoreType, QWKContext*, QWidget* parent = 0); virtual ~BrowserView() { delete m_item; } void load(const QString&); diff --git a/Tools/MiniBrowser/qt/BrowserWindow.cpp b/Tools/MiniBrowser/qt/BrowserWindow.cpp index be08cae..c63c9d6 100644 --- a/Tools/MiniBrowser/qt/BrowserWindow.cpp +++ b/Tools/MiniBrowser/qt/BrowserWindow.cpp @@ -28,20 +28,20 @@ #include "BrowserWindow.h" -static QWKPage* newPageFunction(QWKPage*) +static QWKPage* newPageFunction(QWKPage* page) { - BrowserWindow* window = new BrowserWindow(); + BrowserWindow* window = new BrowserWindow(page->context()); return window->page(); } QGraphicsWKView::BackingStoreType BrowserWindow::backingStoreTypeForNewWindow = QGraphicsWKView::Simple; -BrowserWindow::BrowserWindow() +BrowserWindow::BrowserWindow(QWKContext* context) { setAttribute(Qt::WA_DeleteOnClose); m_menu = new QMenuBar(); - m_browser = new BrowserView(backingStoreTypeForNewWindow); + m_browser = new BrowserView(backingStoreTypeForNewWindow, context); m_addressBar = new QLineEdit(); m_menu->addAction("New Window", this, SLOT(newWindow())); diff --git a/Tools/MiniBrowser/qt/BrowserWindow.h b/Tools/MiniBrowser/qt/BrowserWindow.h index 0010fbe..f984309 100644 --- a/Tools/MiniBrowser/qt/BrowserWindow.h +++ b/Tools/MiniBrowser/qt/BrowserWindow.h @@ -38,7 +38,7 @@ class BrowserWindow : public QMainWindow { Q_OBJECT public: - BrowserWindow(); + BrowserWindow(QWKContext* = 0); ~BrowserWindow(); void load(const QString& url); diff --git a/Tools/MiniBrowser/qt/MiniBrowser.pro b/Tools/MiniBrowser/qt/MiniBrowser.pro index 2cdd3b5..c297207 100644 --- a/Tools/MiniBrowser/qt/MiniBrowser.pro +++ b/Tools/MiniBrowser/qt/MiniBrowser.pro @@ -16,10 +16,10 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../.. include(../../../WebKit.pri) INCLUDEPATH += \ - $$PWD/../../../WebKit2/ \ - $$PWD/../../../WebKit2/UIProcess/API/cpp \ - $$PWD/../../../WebKit2/UIProcess/API/C \ - $$PWD/../../../WebKit2/UIProcess/API/qt \ + $$PWD/../../../Source/WebKit2/ \ + $$PWD/../../../Source/WebKit2/UIProcess/API/cpp \ + $$PWD/../../../Source/WebKit2/UIProcess/API/C \ + $$PWD/../../../Source/WebKit2/UIProcess/API/qt \ $$OUTPUT_DIR/include diff --git a/Tools/MiniBrowser/win/BrowserView.cpp b/Tools/MiniBrowser/win/BrowserView.cpp index a93ca96..b9aaadc 100644 --- a/Tools/MiniBrowser/win/BrowserView.cpp +++ b/Tools/MiniBrowser/win/BrowserView.cpp @@ -118,7 +118,8 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow) 0, /* didDraw */ 0, /* pageDidScroll */ 0, /* exceededDatabaseQuota */ - 0 /* runOpenPanel */ + 0, /* runOpenPanel */ + 0, /* decidePolicyForGeolocationPermissionRequest */ }; WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient); diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 1a4d28f..8a4b884 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -163,6 +163,7 @@ void LauncherWindow::applyPrefs() void LauncherWindow::createChrome() { +#ifndef QT_NO_SHORTCUT QMenu* fileMenu = menuBar()->addMenu("&File"); fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New); fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open); @@ -170,7 +171,9 @@ void LauncherWindow::createChrome() fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close); fileMenu->addSeparator(); fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot())); +#ifndef QT_NO_PRINTER fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print); +#endif fileMenu->addSeparator(); fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q)); @@ -368,6 +371,7 @@ void LauncherWindow::createChrome() showFPS->setEnabled(isGraphicsBased()); showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); showFPS->setChecked(m_windowOptions.showFrameRate); +#endif } bool LauncherWindow::isGraphicsBased() const @@ -547,6 +551,7 @@ void LauncherWindow::zoomAnimationFinished() void LauncherWindow::applyZoom() { +#ifndef QT_NO_ANIMATION if (isGraphicsBased() && page()->settings()->testAttribute(QWebSettings::TiledBackingStoreEnabled)) { QGraphicsWebView* view = static_cast(m_view)->graphicsWebView(); view->setTiledBackingStoreFrozen(true); @@ -564,6 +569,7 @@ void LauncherWindow::applyZoom() m_zoomAnimation->start(); return; } +#endif page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0); } @@ -620,12 +626,14 @@ void LauncherWindow::screenshot() label->show(); #endif +#ifndef QT_NO_FILEDIALOG QString fileName = QFileDialog::getSaveFileName(label, "Screenshot"); if (!fileName.isEmpty()) { pixmap.save(fileName, "png"); if (label) label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName)); } +#endif #if defined(QT_CONFIGURED_WITH_OPENGL) toggleQGLWidgetViewport(m_windowOptions.useQGLWidgetViewport); @@ -657,6 +665,7 @@ void LauncherWindow::dumpHtml() void LauncherWindow::selectElements() { +#ifndef QT_NO_INPUTDIALOG bool ok; QString str = QInputDialog::getText(this, "Select elements", "Choose elements", QLineEdit::Normal, "a", &ok); @@ -669,6 +678,7 @@ void LauncherWindow::selectElements() statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000); #endif } +#endif } void LauncherWindow::setTouchMocking(bool on) @@ -821,6 +831,7 @@ void LauncherWindow::showUserAgentDialog() QVBoxLayout* layout = new QVBoxLayout(dialog); dialog->setLayout(layout); +#ifndef QT_NO_COMBOBOX QComboBox* combo = new QComboBox(dialog); combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); combo->setEditable(true); @@ -829,6 +840,7 @@ void LauncherWindow::showUserAgentDialog() int index = combo->findText(page()->userAgentForUrl(QUrl())); combo->setCurrentIndex(index); +#endif QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, dialog); @@ -836,11 +848,13 @@ void LauncherWindow::showUserAgentDialog() connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); layout->addWidget(buttonBox); +#ifndef QT_NO_COMBOBOX if (dialog->exec() && !combo->currentText().isEmpty()) { page()->setUserAgent(combo->currentText()); if (!items.contains(combo->currentText())) settings.setValue("CustomUserAgent", combo->currentText()); } +#endif delete dialog; } diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index e35e7fd..849b15d 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -67,7 +67,7 @@ #include "webinspector.h" #include "webpage.h" #include "webview.h" -#include "../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include "../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #ifdef Q_WS_MAEMO_5 #include @@ -75,6 +75,8 @@ #undef KeyPress #endif +class QPropertyAnimation; + class WindowOptions { public: WindowOptions() diff --git a/Tools/QtTestBrowser/locationedit.cpp b/Tools/QtTestBrowser/locationedit.cpp index a97f148..85bd222 100644 --- a/Tools/QtTestBrowser/locationedit.cpp +++ b/Tools/QtTestBrowser/locationedit.cpp @@ -27,6 +27,8 @@ #include "locationedit.h" +#ifndef QT_NO_INPUTDIALOG + LocationEdit::LocationEdit(QWidget* parent) : QLineEdit(parent) , m_progress(0) @@ -78,3 +80,5 @@ void LocationEdit::focusInEvent(QFocusEvent* ev) QTimer::singleShot(0, this, SLOT(selectAll())); #endif } + +#endif diff --git a/Tools/QtTestBrowser/locationedit.h b/Tools/QtTestBrowser/locationedit.h index e82920c..752497e 100644 --- a/Tools/QtTestBrowser/locationedit.h +++ b/Tools/QtTestBrowser/locationedit.h @@ -28,6 +28,7 @@ #ifndef locationedit_h #define locationedit_h +#ifndef QT_NO_INPUTDIALOG #include class LocationEdit : public QLineEdit { @@ -52,3 +53,4 @@ private: }; #endif +#endif diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp index 756c3c2..9f4aec5 100644 --- a/Tools/QtTestBrowser/mainwindow.cpp +++ b/Tools/QtTestBrowser/mainwindow.cpp @@ -66,6 +66,7 @@ void MainWindow::buildUI() m_toolBar->addAction(reloadAction); m_toolBar->addAction(page()->action(QWebPage::Stop)); +#ifndef QT_NO_INPUTDIALOG urlEdit = new LocationEdit(m_toolBar); urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy()); connect(urlEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); @@ -79,19 +80,24 @@ void MainWindow::buildUI() m_toolBar->addWidget(urlEdit); #endif - connect(page()->mainFrame(), SIGNAL(titleChanged(const QString&)), - this, SLOT(setWindowTitle(const QString&))); connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), this, SLOT(setAddressUrl(QUrl))); connect(page(), SIGNAL(loadProgress(int)), urlEdit, SLOT(setProgress(int))); +#endif + + connect(page()->mainFrame(), SIGNAL(titleChanged(const QString&)), + this, SLOT(setWindowTitle(const QString&))); connect(page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); +#ifndef QT_NO_SHORTCUT // short-cuts page()->action(QWebPage::Back)->setShortcut(QKeySequence::Back); page()->action(QWebPage::Stop)->setShortcut(Qt::Key_Escape); page()->action(QWebPage::Forward)->setShortcut(QKeySequence::Forward); page()->action(QWebPage::Reload)->setShortcut(QKeySequence::Refresh); +#ifndef QT_NO_UNDOSTACK page()->action(QWebPage::Undo)->setShortcut(QKeySequence::Undo); page()->action(QWebPage::Redo)->setShortcut(QKeySequence::Redo); +#endif page()->action(QWebPage::Cut)->setShortcut(QKeySequence::Cut); page()->action(QWebPage::Copy)->setShortcut(QKeySequence::Copy); page()->action(QWebPage::Paste)->setShortcut(QKeySequence::Paste); @@ -100,6 +106,7 @@ void MainWindow::buildUI() page()->action(QWebPage::ToggleBold)->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_B)); page()->action(QWebPage::ToggleItalic)->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_I)); page()->action(QWebPage::ToggleUnderline)->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_U)); +#endif } void MainWindow::setPage(WebPage* page) @@ -125,8 +132,10 @@ void MainWindow::setAddressUrl(const QUrl& url) void MainWindow::setAddressUrl(const QString& url) { +#ifndef QT_NO_INPUTDIALOG if (!url.contains("about:")) urlEdit->setText(url); +#endif } void MainWindow::addCompleterEntry(const QUrl& url) @@ -164,6 +173,7 @@ void MainWindow::load(const QUrl& url) void MainWindow::changeLocation() { +#ifndef QT_NO_INPUTDIALOG QString string = urlEdit->text(); QUrl mainFrameURL = page()->mainFrame()->url(); @@ -173,10 +183,12 @@ void MainWindow::changeLocation() } load(string); +#endif } void MainWindow::openFile() { +#ifndef QT_NO_FILEDIALOG static const QString filter("HTML Files (*.htm *.html);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;All Files (*)"); QFileDialog fileDialog(this, tr("Open"), QString(), filter); @@ -189,10 +201,13 @@ void MainWindow::openFile() if (!selectedFile.isEmpty()) load(QUrl::fromLocalFile(selectedFile)); } +#endif } void MainWindow::openLocation() { +#ifndef QT_NO_INPUTDIALOG urlEdit->selectAll(); urlEdit->setFocus(); +#endif } diff --git a/Tools/QtTestBrowser/webpage.cpp b/Tools/QtTestBrowser/webpage.cpp index 15f6db0..400355e 100644 --- a/Tools/QtTestBrowser/webpage.cpp +++ b/Tools/QtTestBrowser/webpage.cpp @@ -45,6 +45,7 @@ WebPage::WebPage(QObject* parent) : QWebPage(parent) , m_userAgent() , m_interruptingJavaScriptEnabled(false) + , m_qnamThread(0) { applyProxy(); @@ -106,10 +107,12 @@ bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& r void WebPage::openUrlInDefaultBrowser(const QUrl& url) { +#ifndef QT_NO_DESKTOPSERVICES if (QAction* action = qobject_cast(sender())) QDesktopServices::openUrl(action->data().toUrl()); else QDesktopServices::openUrl(url); +#endif } QString WebPage::userAgentForUrl(const QUrl& url) const @@ -126,12 +129,14 @@ void WebPage::setQnamThreaded(bool threaded) return; if (threaded) { - m_qnamThread.reset(new QtNAMThread); + if (!m_qnamThread) + m_qnamThread = new QtNAMThread(this); m_qnamThread->start(); setNetworkAccessManager(m_qnamThread->networkAccessManager()); } else { setNetworkAccessManager(0); - m_qnamThread.reset(); + delete m_qnamThread; + m_qnamThread = 0; } Qt::ConnectionType connectionType = threaded ? Qt::BlockingQueuedConnection : Qt::DirectConnection; @@ -162,6 +167,7 @@ void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authe messageLabel->setText(messageStr.arg(reply->url().toString())); layout->addWidget(messageLabel, 0, 1); +#ifndef QT_NO_LINEEDIT QLabel* userLabel = new QLabel("Username:", dialog); layout->addWidget(userLabel, 1, 0); QLineEdit* userInput = new QLineEdit(dialog); @@ -172,6 +178,7 @@ void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authe QLineEdit* passInput = new QLineEdit(dialog); passInput->setEchoMode(QLineEdit::Password); layout->addWidget(passInput, 2, 1); +#endif QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, dialog); @@ -180,8 +187,10 @@ void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authe layout->addWidget(buttonBox, 3, 1); if (dialog->exec() == QDialog::Accepted) { +#ifndef QT_NO_LINEEDIT authenticator->setUser(userInput->text()); authenticator->setPassword(passInput->text()); +#endif } delete dialog; diff --git a/Tools/QtTestBrowser/webpage.h b/Tools/QtTestBrowser/webpage.h index e62402b..3b856c9 100644 --- a/Tools/QtTestBrowser/webpage.h +++ b/Tools/QtTestBrowser/webpage.h @@ -33,9 +33,10 @@ #ifndef webpage_h #define webpage_h -#include +#include #include #include +#include #include #include @@ -70,15 +71,16 @@ private: void applyProxy(); QString m_userAgent; bool m_interruptingJavaScriptEnabled; - QScopedPointer m_qnamThread; + QtNAMThread* m_qnamThread; }; class QtNAMThread : public QThread { public: - QtNAMThread() + QtNAMThread(QObject *parent = 0) + : QThread(parent) + , m_qnam(0) { - m_qnamFuture.reportStarted(); } ~QtNAMThread() { @@ -86,20 +88,29 @@ public: wait(); } - QFuture networkAccessManager() + QNetworkAccessManager* networkAccessManager() { - return m_qnamFuture.future(); + QMutexLocker lock(&m_mutex); + while (!m_qnam) + m_waitCondition.wait(&m_mutex); + return m_qnam; } protected: void run() { - QNetworkAccessManager qnam; - m_qnamFuture.reportResult(&qnam); - m_qnamFuture.reportFinished(); + Q_ASSERT(!m_qnam); + { + QMutexLocker lock(&m_mutex); + m_qnam = new QNetworkAccessManager; + m_waitCondition.wakeAll(); + } exec(); + delete m_qnam; } private: - QFutureInterface m_qnamFuture; + QNetworkAccessManager* m_qnam; + QMutex m_mutex; + QWaitCondition m_waitCondition; }; #endif diff --git a/Tools/QtTestBrowser/webview.cpp b/Tools/QtTestBrowser/webview.cpp index 2a541fb..8e33620 100644 --- a/Tools/QtTestBrowser/webview.cpp +++ b/Tools/QtTestBrowser/webview.cpp @@ -169,6 +169,7 @@ void WebViewGraphicsBased::updateFrameRate() void WebViewGraphicsBased::animatedFlip() { +#ifndef QT_NO_ANIMATION QSizeF center = graphicsWebView()->boundingRect().size() / 2; QPointF centerPoint = QPointF(center.width(), center.height()); graphicsWebView()->setTransformOriginPoint(centerPoint); @@ -182,10 +183,12 @@ void WebViewGraphicsBased::animatedFlip() animation->setEndValue(rotation + 180 - (rotation % 180)); animation->start(QAbstractAnimation::DeleteWhenStopped); +#endif } void WebViewGraphicsBased::animatedYFlip() { +#ifndef QT_NO_ANIMATION if (!m_machine) { m_machine = new QStateMachine(this); @@ -217,6 +220,7 @@ void WebViewGraphicsBased::animatedYFlip() } m_machine->start(); +#endif } void WebViewGraphicsBased::paintEvent(QPaintEvent* event) diff --git a/Tools/Scripts/VCSUtils.pm b/Tools/Scripts/VCSUtils.pm index e61774c..70e9acd 100644 --- a/Tools/Scripts/VCSUtils.pm +++ b/Tools/Scripts/VCSUtils.pm @@ -398,7 +398,10 @@ sub adjustPathForRecentRenamings($) { my ($fullPath) = @_; - if ($fullPath =~ m|^WebCore/| || $fullPath =~ m|^JavaScriptCore/|) { + if ($fullPath =~ m|^WebCore/| + || $fullPath =~ m|^JavaScriptCore/| + || $fullPath =~ m|^WebKit/| + || $fullPath =~ m|^WebKit2/|) { return "Source/$fullPath"; } return $fullPath; diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit index c300da1..0b58113 100755 --- a/Tools/Scripts/build-webkit +++ b/Tools/Scripts/build-webkit @@ -126,7 +126,7 @@ my @features = ( define => "ENABLE_ACCELERATED_2D_CANVAS", default => 0, value => \$accelerated2dCanvasSupport }, { option => "blob", desc => "Toggle Blob support", - define => "ENABLE_BLOB", default => (isAppleMacWebKit()), value => \$blobSupport }, + define => "ENABLE_BLOB", default => (isAppleMacWebKit() || isGtk()), value => \$blobSupport }, { option => "channel-messaging", desc => "Toggle MessageChannel and MessagePort support", define => "ENABLE_CHANNEL_MESSAGING", default => 1, value => \$channelMessagingSupport }, @@ -198,7 +198,7 @@ my @features = ( define => "ENABLE_METER_TAG", default => !isGtk() && !isAppleWinWebKit(), value => \$meterTagSupport }, { option => "netscape-plugin", desc => "Netscape Plugin support", - define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isWinCE(), value => \$netscapePluginSupport }, + define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isEfl(), value => \$netscapePluginSupport }, { option => "notifications", desc => "Toggle Desktop Notifications Support", define => "ENABLE_NOTIFICATIONS", default => 0, value => \$notificationsSupport }, @@ -377,7 +377,7 @@ sub unlinkZeroFiles () } # Check that all the project directories are there. -my @projects = ("Source/JavaScriptCore", "Source/WebCore", "WebKit"); +my @projects = ("Source/JavaScriptCore", "Source/WebCore", "Source/WebKit"); my @otherDirs = ("WebKitLibraries"); for my $dir (@projects, @otherDirs) { @@ -422,7 +422,7 @@ if (isGtk()) { splice @projects, 0, 0, "Source/ThirdParty/ANGLE"; # WebKit2 is only supported in SnowLeopard and later at present. - push @projects, ("WebKit2", "Tools/MiniBrowser") if osXVersion()->{"minor"} >= 6 and !$noWebKit2; + push @projects, ("Source/WebKit2", "Tools/MiniBrowser") if osXVersion()->{"minor"} >= 6 and !$noWebKit2; # Copy library and header from WebKitLibraries to a findable place in the product directory. my @librariesToCopy = ( @@ -542,7 +542,7 @@ for my $dir (@projects) { my $result = 0; # For Gtk and Qt the WebKit project builds all others - if ((isGtk() || isQt()) && $dir ne "WebKit") { + if ((isGtk() || isQt()) && $dir ne "Source/WebKit") { chdirWebKit(); next; } diff --git a/Tools/Scripts/check-inspector-strings b/Tools/Scripts/check-inspector-strings new file mode 100755 index 0000000..82c08d7 --- /dev/null +++ b/Tools/Scripts/check-inspector-strings @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011 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 +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * 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. +# * 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import codecs +import logging +import re +import sys + +from webkitpy.style_references import detect_checkout +from webkitpy.common.system.logutils import configure_logging +from webkitpy.style.checker import ProcessorBase +from webkitpy.style.filereader import TextFileReader +from webkitpy.style.main import change_directory + +_inspector_directory = "Source/WebCore/inspector/front-end" +_localized_strings = "Source/WebCore/English.lproj/localizedStrings.js" + +_log = logging.getLogger("check-inspector-strings") + +class StringsExtractor(ProcessorBase): + def __init__(self, patterns): + self._patterns = patterns + self.strings = [] + for p in self._patterns: + self.strings.append([]) + + def should_process(self, file_path): + return file_path.endswith(".js") and (not file_path.endswith("InjectedScript.js")) + + def process(self, lines, file_path, line_numbers=None): + for line in lines: + comment_start = line.find("//") + if comment_start != -1: + line = line[:comment_start] + index = 0 + for pattern in self._patterns: + line_strings = re.findall(pattern, line) + for string in line_strings: + self.strings[index].append(string) + index += 1 + +class LocalizedStringsExtractor: + def __init__(self): + self.localized_strings = [] + + def process_file(self, file_path): + localized_strings_file = codecs.open(file_path, encoding="utf-16", mode="r") + try: + contents = localized_strings_file.read() + lines = contents.split("\n") + for line in lines: + match = re.match(r"localizedStrings\[\"((?:[^\"\\]|\\.)*?)\"", line) + if match: + self.localized_strings.append(match.group(1)) + finally: + localized_strings_file.close() + +if __name__ == "__main__": + configure_logging() + + checkout = detect_checkout() + if checkout is None: + _log.error("WebKit checkout not found: You must run this script " + "from within a WebKit checkout.") + sys.exit(1) + checkout_root = checkout.root_path() + _log.debug("WebKit checkout found with root: %s" % checkout_root) + change_directory(checkout_root=checkout_root, paths=None) + + strings_extractor = StringsExtractor([r"WebInspector\.(?:UIString|formatLocalized)\(\"((?:[^\"\\]|\\.)*?)\"", r"\"((?:[^\"\\]|\\.)*?)\""]) + file_reader = TextFileReader(strings_extractor) + file_reader.process_paths([_inspector_directory]) + localized_strings_extractor = LocalizedStringsExtractor() + localized_strings_extractor.process_file(_localized_strings) + ui_strings = frozenset(strings_extractor.strings[0]) + strings = frozenset(strings_extractor.strings[1]) + localized_strings = frozenset(localized_strings_extractor.localized_strings) + + new_strings = ui_strings - localized_strings + for s in new_strings: + _log.info("New: \"%s\"" % (s)) + old_strings = localized_strings - ui_strings + suspicious_strings = strings & old_strings + for s in suspicious_strings: + _log.info("Suspicious: \"%s\"" % (s)) + unused_strings = old_strings - strings + for s in unused_strings: + _log.info("Unused: \"%s\"" % (s)) diff --git a/Tools/Scripts/do-file-rename b/Tools/Scripts/do-file-rename index 6ad9331..afb72d8 100755 --- a/Tools/Scripts/do-file-rename +++ b/Tools/Scripts/do-file-rename @@ -47,7 +47,7 @@ find(\&wanted, "Source/JavaScriptCore"); find(\&wanted, "Source/JavaScriptGlue"); find(\&wanted, "Source/WebCore"); find(\&wanted, "WebKit"); -find(\&wanted, "WebKit2"); +find(\&wanted, "Source/WebKit2"); sub wanted { diff --git a/Tools/Scripts/do-webcore-rename b/Tools/Scripts/do-webcore-rename index 0f84ad7..aaa1eee 100755 --- a/Tools/Scripts/do-webcore-rename +++ b/Tools/Scripts/do-webcore-rename @@ -73,7 +73,7 @@ find(\&wanted, "Source/JavaScriptCore"); find(\&wanted, "Source/JavaScriptGlue"); find(\&wanted, "Source/WebCore"); find(\&wanted, "WebKit"); -find(\&wanted, "WebKit2"); +find(\&wanted, "Source/WebKit2"); find(\&wanted, "Tools/DumpRenderTree"); sub wanted diff --git a/Tools/Scripts/old-run-webkit-tests b/Tools/Scripts/old-run-webkit-tests index ab41e9b..892b5a4 100755 --- a/Tools/Scripts/old-run-webkit-tests +++ b/Tools/Scripts/old-run-webkit-tests @@ -113,7 +113,7 @@ sub splitpath($); sub stopRunningTestsEarlyIfNeeded(); sub stripExtension($); sub stripMetrics($$); -sub testCrashedOrTimedOut($$$$$); +sub testCrashedOrTimedOut($$$$$$); sub toCygwinPath($); sub toURL($); sub toWindowsPath($); @@ -170,6 +170,7 @@ my $useValgrind = 0; my $verbose = 0; my $shouldWaitForHTTPD = 0; my $useWebKitTestRunner = 0; +my $noBuildDumpTool = 0; my @leaksFilenames; @@ -329,6 +330,7 @@ my $getOptionsResult = GetOptions( 'leaks|l' => \$shouldCheckLeaks, 'merge-leak-depth|m:5' => \$mergeDepth, 'new-test-results!' => \$generateNewResults, + 'no-build' => \$noBuildDumpTool, 'nthly=i' => \$testsPerDumpTool, 'pixel-tests|p' => \$pixelTests, 'platform=s' => \$platform, @@ -405,7 +407,7 @@ $productDir .= "/Programs" if isGtk(); chdirWebKit(); -if (!defined($root)) { +if (!defined($root) && !$noBuildDumpTool) { # FIXME: We build both DumpRenderTree and WebKitTestRunner for # WebKitTestRunner runs becuase DumpRenderTree still includes # the DumpRenderTreeSupport module and the TestNetscapePlugin. @@ -446,6 +448,8 @@ my @platformTestHierarchy = buildPlatformTestHierarchy(@platformResultHierarchy) $expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"}; $testResultsDirectory = File::Spec->rel2abs($testResultsDirectory); +# $testResultsDirectory must be empty before testing. +rmtree $testResultsDirectory; my $testResults = File::Spec->catfile($testResultsDirectory, "results.html"); if (isAppleMacWebKit()) { @@ -804,8 +808,9 @@ for my $test (@tests) { unless ($readResults->{status} eq "success") { my $crashed = $readResults->{status} eq "crashed"; - testCrashedOrTimedOut($test, $base, $crashed, $actual, $error); - countFinishedTest($test, $base, $crashed ? "crash" : "timedout", 0); + my $webProcessCrashed = $readResults->{status} eq "webProcessCrashed"; + testCrashedOrTimedOut($test, $base, $crashed, $webProcessCrashed, $actual, $error); + countFinishedTest($test, $base, $webProcessCrashed ? "webProcessCrash" : $crashed ? "crash" : "timedout", 0); last if stopRunningTestsEarlyIfNeeded(); next; } @@ -914,7 +919,7 @@ for my $test (@tests) { if (dumpToolDidCrash()) { $result = "crash"; - testCrashedOrTimedOut($test, $base, 1, $actual, $error); + testCrashedOrTimedOut($test, $base, 1, 0, $actual, $error); } elsif (!defined $expected) { if ($verbose) { print "new " . ($resetResults ? "result" : "test"); @@ -1137,6 +1142,7 @@ if ($ignoreMetrics) { print HTML htmlForResultsSection(@{$tests{mismatch}}, "Tests where results did not match expected results", \&linksForMismatchTest); print HTML htmlForResultsSection(@{$tests{timedout}}, "Tests that timed out", \&linksForErrorTest); print HTML htmlForResultsSection(@{$tests{crash}}, "Tests that caused the DumpRenderTree tool to crash", \&linksForErrorTest); +print HTML htmlForResultsSection(@{$tests{webProcessCrash}}, "Tests that caused the Web process to crash", \&linksForErrorTest); print HTML htmlForResultsSection(@{$tests{error}}, "Tests that had stderr output", \&linksForErrorTest); print HTML htmlForResultsSection(@{$tests{new}}, "Tests that had no expected results (probably new)", \&linksForNewTest); @@ -1700,13 +1706,13 @@ sub countFinishedTest($$$$) push @{$tests{$result}}, $test; } -sub testCrashedOrTimedOut($$$$$) +sub testCrashedOrTimedOut($$$$$$) { - my ($test, $base, $didCrash, $actual, $error) = @_; + my ($test, $base, $didCrash, $webProcessCrashed, $actual, $error) = @_; - printFailureMessageForTest($test, $didCrash ? "crashed" : "timed out"); + printFailureMessageForTest($test, $webProcessCrashed ? "Web process crashed" : $didCrash ? "crashed" : "timed out"); - sampleDumpTool() unless $didCrash; + sampleDumpTool() unless $didCrash || $webProcessCrashed; my $dir = dirname(File::Spec->catdir($testResultsDirectory, $base)); mkpath $dir; @@ -2155,6 +2161,10 @@ sub readFromDumpToolWithTimer(**) } } if (defined($lineError)) { + if ($lineError =~ /#CRASHED - WebProcess/) { + $status = "webProcessCrashed"; + last; + } if ($lineError =~ /#CRASHED/) { $status = "crashed"; last; @@ -2392,10 +2402,11 @@ sub printResults new => "were new", timedout => "timed out", crash => "crashed", + webProcessCrash => "Web process crashed", error => "had stderr output" ); - for my $type ("match", "mismatch", "new", "timedout", "crash", "error") { + for my $type ("match", "mismatch", "new", "timedout", "crash", "webProcessCrash", "error") { my $typeCount = $counts{$type}; next unless $typeCount; my $typeText = $text{$type}; diff --git a/Tools/Scripts/test-webkitpy b/Tools/Scripts/test-webkitpy index 7efacb0..7c11e85 100755 --- a/Tools/Scripts/test-webkitpy +++ b/Tools/Scripts/test-webkitpy @@ -248,7 +248,7 @@ def _test_import(module_path): if __name__ == "__main__": # FIXME: We should probably test each package separately to avoid naming conflicts. external_package_paths = [ - _path_from_webkit_root('WebKit2', 'Scripts', 'webkit2'), + _path_from_webkit_root('Source', 'WebKit2', 'Scripts', 'webkit2'), _path_from_webkit_root('Tools', 'QueueStatusServer'), ] init(sys.argv[1:], external_package_paths) diff --git a/Tools/Scripts/update-webkit-auxiliary-libs b/Tools/Scripts/update-webkit-auxiliary-libs index 19e4ad3..9a6b20f 100755 --- a/Tools/Scripts/update-webkit-auxiliary-libs +++ b/Tools/Scripts/update-webkit-auxiliary-libs @@ -54,11 +54,12 @@ my $file = "WebKitAuxiliaryLibrary"; my $zipFile = "$file.zip"; my $auxiliaryLibsURL = "http://developer.apple.com/opensource/internet/$zipFile"; my $webkitLibrariesDir = toUnixPath($ENV{'WEBKITLIBRARIESDIR'}) || "$sourceDir/WebKitLibraries/win"; -my $tmpDir = File::Spec->rel2abs(File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1)); +my $tmpRelativeDir = File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1); +my $tmpAbsDir = File::Spec->rel2abs($tmpRelativeDir); print "Checking Last-Modified date of $zipFile...\n"; -my $result = system "curl -s -I $auxiliaryLibsURL | grep Last-Modified > \"$tmpDir/$file.headers\""; +my $result = system "curl -s -I $auxiliaryLibsURL | grep Last-Modified > \"$tmpAbsDir/$file.headers\""; if (WEXITSTATUS($result)) { print STDERR "Couldn't check Last-Modified date of new $zipFile.\n"; @@ -73,7 +74,7 @@ if (WEXITSTATUS($result)) { exit 0; } -if (open NEW, "$tmpDir/$file.headers") { +if (open NEW, "$tmpAbsDir/$file.headers") { my $new = lastModifiedToUnixTime(); close NEW; @@ -88,17 +89,17 @@ if (open NEW, "$tmpDir/$file.headers") { } print "Downloading $zipFile...\n\n"; -$result = system "curl -o \"$tmpDir/$zipFile\" $auxiliaryLibsURL"; +$result = system "curl -o \"$tmpAbsDir/$zipFile\" $auxiliaryLibsURL"; die "Couldn't download $zipFile!" if $result; -$result = system "unzip", "-q", "-d", $tmpDir, "$tmpDir/$zipFile"; +$result = system "unzip", "-q", "-d", $tmpAbsDir, "$tmpAbsDir/$zipFile"; die "Couldn't unzip $zipFile." if $result; print "\nInstalling $file...\n"; sub wanted { - my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpDir/$file/win"); + my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpAbsDir/$file/win"); my $destination = "$webkitLibrariesDir/$relativeName"; if (-d $_) { @@ -109,9 +110,9 @@ sub wanted system "cp", $_, $destination; } -File::Find::find(\&wanted, "$tmpDir/$file"); +File::Find::find(\&wanted, "$tmpAbsDir/$file"); -$result = system "mv", "$tmpDir/$file.headers", $webkitLibrariesDir; +$result = system "mv", "$tmpAbsDir/$file.headers", $webkitLibrariesDir; print STDERR "Couldn't move $file.headers to $webkitLibrariesDir" . ".\n" if $result; print "The $file has been sucessfully installed in\n $webkitLibrariesDir\n"; diff --git a/Tools/Scripts/update-webkit-chromium b/Tools/Scripts/update-webkit-chromium index 1db1826..5610487 100755 --- a/Tools/Scripts/update-webkit-chromium +++ b/Tools/Scripts/update-webkit-chromium @@ -34,7 +34,7 @@ use Getopt::Long; use lib $FindBin::Bin; use webkitdirs; -chdir("WebKit/chromium") or die $!; +chdir("Source/WebKit/chromium") or die $!; # Find gclient or install it. my $gclientPath; diff --git a/Tools/Scripts/update-webkit-support-libs b/Tools/Scripts/update-webkit-support-libs index f0c897e..8484f84 100755 --- a/Tools/Scripts/update-webkit-support-libs +++ b/Tools/Scripts/update-webkit-support-libs @@ -49,7 +49,8 @@ my $pathToZip = File::Spec->catfile($zipDirectory, $zipFile); my $webkitLibrariesDir = toUnixPath($ENV{'WEBKITLIBRARIESDIR'}) || "$sourceDir/WebKitLibraries/win"; my $versionFile = $file . "Version"; my $pathToVersionFile = File::Spec->catfile($webkitLibrariesDir, $versionFile); -my $tmpDir = File::Spec->rel2abs(File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1)); +my $tmpRelativeDir = File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1); +my $tmpAbsDir = File::Spec->rel2abs($tmpRelativeDir); my $versionFileURL = "http://developer.apple.com/opensource/internet/$versionFile"; my $extractedVersion = extractedVersion(); @@ -70,14 +71,14 @@ if ($zipFileVersion eq $extractedVersion) { exit; } -my $result = system "unzip", "-q", "-d", $tmpDir, $pathToZip; +my $result = system "unzip", "-q", "-d", $tmpAbsDir, $pathToZip; die "Couldn't unzip $zipFile." if $result; print "\nInstalling $file...\n"; sub wanted { - my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpDir/$file/win"); + my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpAbsDir/$file/win"); my $destination = "$webkitLibrariesDir/$relativeName"; if (-d $_) { @@ -88,7 +89,7 @@ sub wanted system "cp", $_, $destination; } -File::Find::find(\&wanted, "$tmpDir/$file"); +File::Find::find(\&wanted, "$tmpAbsDir/$file"); print "The $file has been sucessfully installed in\n $webkitLibrariesDir\n"; exit; diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index 2525dd7..0ead831 100644 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -87,7 +87,7 @@ sub determineSourceDir # walks up path checking each directory to see if it is the main WebKit project dir, # defined by containing Sources, WebCore, and WebKit - until ((-d "$sourceDir/Source" && -d "$sourceDir/Source/WebCore" && -d "$sourceDir/WebKit") || (-d "$sourceDir/Internal" && -d "$sourceDir/OpenSource")) + until ((-d "$sourceDir/Source" && -d "$sourceDir/Source/WebCore" && -d "$sourceDir/Source/WebKit") || (-d "$sourceDir/Internal" && -d "$sourceDir/OpenSource")) { if ($sourceDir !~ s|/[^/]+$||) { die "Could not find top level webkit directory above source directory using FindBin.\n"; @@ -603,10 +603,11 @@ sub builtDylibPathForName } if (isGtk()) { my $libraryDir = "$configurationProductDir/.libs/"; - if (-e $libraryDir . "libwebkitgtk-3.0.so") { - return $libraryDir . "libwebkitgtk-3.0.so"; + my $extension = isDarwin() ? "dylib" : "so"; + if (-e $libraryDir . "libwebkitgtk-3.0.$extension") { + return $libraryDir . "libwebkitgtk-3.0.$extension"; } - return $libraryDir . "libwebkitgtk-1.0.so"; + return $libraryDir . "libwebkitgtk-1.0.$extension"; } if (isEfl()) { return "$configurationProductDir/$libraryName/../.libs/libewebkit.so"; @@ -1590,9 +1591,9 @@ sub buildQMakeProject($@) my $dsMakefile = "Makefile.DerivedSources"; # Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60 - my @subdirs = ("Source/JavaScriptCore", "Source/WebCore", "WebKit/qt/Api"); + my @subdirs = ("Source/JavaScriptCore", "Source/WebCore", "Source/WebKit/qt/Api"); if (grep { $_ eq "CONFIG+=webkit2"} @buildArgs) { - push @subdirs, "WebKit2"; + push @subdirs, "Source/WebKit2"; push @subdirs, "Tools/WebKitTestRunner"; push @subdirs, "Tools/MiniBrowser"; } @@ -1637,9 +1638,9 @@ sub buildQMakeProject($@) } # Manually create makefiles for the examples so we don't build by default - my $examplesDir = $dir . "/WebKit/qt/examples"; + my $examplesDir = $dir . "/Source/WebKit/qt/examples"; File::Path::mkpath($examplesDir); - $buildArgs[-1] = sourceDir() . "/WebKit/qt/examples/examples.pro"; + $buildArgs[-1] = sourceDir() . "/Source/WebKit/qt/examples/examples.pro"; chdir $examplesDir or die; print "Calling '$qmakebin @buildArgs' in " . $examplesDir . "\n\n"; $result = system "$qmakebin @buildArgs"; @@ -1745,10 +1746,10 @@ sub buildChromium($@) my $result = 1; if (isDarwin()) { # Mac build - builds the root xcode project. - $result = buildXCodeProject("WebKit/chromium/WebKit", $clean, "-configuration", configuration(), @options); + $result = buildXCodeProject("Source/WebKit/chromium/WebKit", $clean, "-configuration", configuration(), @options); } elsif (isCygwin() || isWindows()) { # Windows build - builds the root visual studio solution. - $result = buildChromiumVisualStudioProject("WebKit/chromium/WebKit.sln", $clean); + $result = buildChromiumVisualStudioProject("Source/WebKit/chromium/WebKit.sln", $clean); } elsif (isLinux()) { # Linux build - build using make. $ result = buildChromiumMakefile("all", $clean); diff --git a/Tools/Scripts/webkitpy/common/checkout/api.py b/Tools/Scripts/webkitpy/common/checkout/api.py index 29e43d3..a87bb5a 100644 --- a/Tools/Scripts/webkitpy/common/checkout/api.py +++ b/Tools/Scripts/webkitpy/common/checkout/api.py @@ -54,12 +54,25 @@ class Checkout(object): # contents_at_revision returns a byte array (str()), but we know # that ChangeLog files are utf-8. parse_latest_entry_from_file # expects a file-like object which vends unicode(), so we decode here. - changelog_file = StringIO.StringIO(changelog_contents.decode("utf-8")) + # Old revisions of Sources/WebKit/wx/ChangeLog have some invalid utf8 characters. + changelog_file = StringIO.StringIO(changelog_contents.decode("utf-8", "ignore")) return ChangeLog.parse_latest_entry_from_file(changelog_file) def changelog_entries_for_revision(self, revision): changed_files = self._scm.changed_files_for_revision(revision) - return [self._latest_entry_for_changelog_at_revision(path, revision) for path in changed_files if self.is_path_to_changelog(path)] + # FIXME: This gets confused if ChangeLog files are moved, as + # deletes are still "changed files" per changed_files_for_revision. + # FIXME: For now we hack around this by caching any exceptions + # which result from having deleted files included the changed_files list. + changelog_entries = [] + for path in changed_files: + if not self.is_path_to_changelog(path): + continue + try: + changelog_entries.append(self._latest_entry_for_changelog_at_revision(path, revision)) + except ScriptError: + pass + return changelog_entries @memoized def commit_info_for_revision(self, revision): diff --git a/Tools/Scripts/webkitpy/common/checkout/api_unittest.py b/Tools/Scripts/webkitpy/common/checkout/api_unittest.py index 1f97abd..fdf3fba 100644 --- a/Tools/Scripts/webkitpy/common/checkout/api_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/api_unittest.py @@ -38,6 +38,7 @@ from webkitpy.common.checkout.api import Checkout from webkitpy.common.checkout.changelog import ChangeLogEntry from webkitpy.common.checkout.scm import detect_scm_system, CommitMessage from webkitpy.common.system.outputcapture import OutputCapture +from webkitpy.common.system.executive import ScriptError from webkitpy.thirdparty.mock import Mock @@ -130,12 +131,35 @@ class CheckoutTest(unittest.TestCase): self.assertEqual(revision, "bar") # contents_at_revision is expected to return a byte array (str) # so we encode our unicode ChangeLog down to a utf-8 stream. - return _changelog1.encode("utf-8") + # The ChangeLog utf-8 decoding should ignore invalid codepoints. + invalid_utf8 = "\255" + return _changelog1.encode("utf-8") + invalid_utf8 scm.contents_at_revision = mock_contents_at_revision checkout = Checkout(scm) entry = checkout._latest_entry_for_changelog_at_revision("foo", "bar") self.assertEqual(entry.contents(), _changelog1entry1) + # FIXME: This tests a hack around our current changed_files handling. + # Right now changelog_entries_for_revision tries to fetch deleted files + # from revisions, resulting in a ScriptError exception. Test that we + # recover from those and still return the other ChangeLog entries. + def test_changelog_entries_for_revision(self): + scm = Mock() + scm.changed_files_for_revision = lambda revision: ['foo/ChangeLog', 'bar/ChangeLog'] + checkout = Checkout(scm) + + def mock_latest_entry_for_changelog_at_revision(path, revision): + if path == "foo/ChangeLog": + return 'foo' + raise ScriptError() + + checkout._latest_entry_for_changelog_at_revision = mock_latest_entry_for_changelog_at_revision + + # Even though fetching one of the entries failed, the other should succeed. + entries = checkout.changelog_entries_for_revision(1) + self.assertEqual(len(entries), 1) + self.assertEqual(entries[0], 'foo') + def test_commit_info_for_revision(self): scm = Mock() scm.committer_email_for_revision = lambda revision: "committer@example.com" diff --git a/Tools/Scripts/webkitpy/common/checkout/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm.py index 3f77043..421c0dc 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm.py @@ -36,6 +36,7 @@ import shutil from webkitpy.common.system.executive import Executive, run_command, ScriptError from webkitpy.common.system.deprecated_logging import error, log +import webkitpy.common.system.ospath as ospath from webkitpy.common.memoized import memoized @@ -52,7 +53,7 @@ def find_checkout_root(): return None -def default_scm(): +def default_scm(patch_directories=None): """Return the default SCM object as determined by the CWD and running code. Returns the default SCM object for the current working directory; if the @@ -62,10 +63,10 @@ def default_scm(): """ cwd = os.getcwd() - scm_system = detect_scm_system(cwd) + scm_system = detect_scm_system(cwd, patch_directories) if not scm_system: script_directory = os.path.dirname(os.path.abspath(__file__)) - scm_system = detect_scm_system(script_directory) + scm_system = detect_scm_system(script_directory, patch_directories) if scm_system: log("The current directory (%s) is not a WebKit checkout, using %s" % (cwd, scm_system.checkout_root)) else: @@ -73,11 +74,14 @@ def default_scm(): return scm_system -def detect_scm_system(path): +def detect_scm_system(path, patch_directories=None): absolute_path = os.path.abspath(path) + if patch_directories == []: + patch_directories = None + if SVN.in_working_directory(absolute_path): - return SVN(cwd=absolute_path) + return SVN(cwd=absolute_path, patch_directories=patch_directories) if Git.in_working_directory(absolute_path): return Git(cwd=absolute_path) @@ -141,16 +145,16 @@ class AmbiguousCommitError(Exception): # SCM methods are expected to return paths relative to self.checkout_root. class SCM: - def __init__(self, cwd): + def __init__(self, cwd, executive=None): self.cwd = cwd self.checkout_root = self.find_checkout_root(self.cwd) self.dryrun = False + self._executive = executive or Executive() # A wrapper used by subclasses to create processes. def run(self, args, cwd=None, input=None, error_handler=None, return_exit_code=False, return_stderr=True, decode_output=True): # FIXME: We should set cwd appropriately. - # FIXME: We should use Executive. - return run_command(args, + return self._executive.run_command(args, cwd=cwd, input=input, error_handler=error_handler, @@ -262,7 +266,7 @@ class SCM: def display_name(self): self._subclass_must_implement() - def create_patch(self, git_commit=None, changed_files=[]): + def create_patch(self, git_commit=None, changed_files=None): self._subclass_must_implement() def committer_email_for_revision(self, revision): @@ -315,13 +319,20 @@ class SCM: class SVN(SCM): - # FIXME: We should move these values to a WebKit-specific config. file. + # FIXME: We should move these values to a WebKit-specific config file. svn_server_host = "svn.webkit.org" svn_server_realm = " Mac OS Forge" - def __init__(self, cwd): - SCM.__init__(self, cwd) + def __init__(self, cwd, patch_directories, executive=None): + SCM.__init__(self, cwd, executive) self._bogus_dir = None + if patch_directories == []: + # FIXME: ScriptError is for Executive, this should probably be a normal Exception. + raise ScriptError(script_args=svn_info_args, message='Empty list of patch directories passed to SCM.__init__') + elif patch_directories == None: + self._patch_directories = [ospath.relpath(cwd, self.checkout_root)] + else: + self._patch_directories = patch_directories @staticmethod def in_working_directory(path): @@ -427,7 +438,10 @@ class SVN(SCM): return self.run(["svn", "delete", "--force", base], cwd=parent) def changed_files(self, git_commit=None): - return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("ACDMR")) + status_command = ["svn", "status"] + status_command.extend(self._patch_directories) + # ACDMR: Addded, Conflicted, Deleted, Modified or Replaced + return self.run_status_and_extract_filenames(status_command, self._status_regexp("ACDMR")) def changed_files_for_revision(self, revision): # As far as I can tell svn diff --summarize output looks just like svn status output. @@ -463,10 +477,14 @@ class SVN(SCM): return "svn" # FIXME: This method should be on Checkout. - def create_patch(self, git_commit=None, changed_files=[]): + def create_patch(self, git_commit=None, changed_files=None): """Returns a byte array (str()) representing the patch file. Patch files are effectively binary since they may contain files of multiple different encodings.""" + if changed_files == []: + return "" + elif changed_files == None: + changed_files = [] return self.run([self.script_path("svn-create-patch")] + changed_files, cwd=self.checkout_root, return_stderr=False, decode_output=False) @@ -574,8 +592,8 @@ class SVN(SCM): # All git-specific logic should go here. class Git(SCM): - def __init__(self, cwd): - SCM.__init__(self, cwd) + def __init__(self, cwd, executive=None): + SCM.__init__(self, cwd, executive) self._check_git_architecture() def _machine_is_64bit(self): @@ -688,7 +706,10 @@ class Git(SCM): return self.remote_merge_base() def changed_files(self, git_commit=None): + # FIXME: --diff-filter could be used to avoid the "extract_filenames" step. status_command = ['git', 'diff', '-r', '--name-status', '-C', '-M', "--no-ext-diff", "--full-index", self.merge_base(git_commit)] + # FIXME: I'm not sure we're returning the same set of files that SVN.changed_files is. + # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) return self.run_status_and_extract_filenames(status_command, self._status_regexp("ADM")) def _changes_files_for_commit(self, git_commit): @@ -725,11 +746,14 @@ class Git(SCM): def display_name(self): return "git" - def create_patch(self, git_commit=None, changed_files=[]): + def create_patch(self, git_commit=None, changed_files=None): """Returns a byte array (str()) representing the patch file. Patch files are effectively binary since they may contain files of multiple different encodings.""" - return self.run(['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"] + changed_files, decode_output=False, cwd=self.checkout_root) + command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"] + if changed_files: + command += changed_files + return self.run(command, decode_output=False, cwd=self.checkout_root) def _run_git_svn_find_rev(self, arg): # git svn find-rev always exits 0, even when the revision or commit is not found. diff --git a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py index 8f24beb..64122b4 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py @@ -45,11 +45,12 @@ import shutil from datetime import date from webkitpy.common.checkout.api import Checkout -from webkitpy.common.checkout.scm import detect_scm_system, SCM, SVN, CheckoutNeedsUpdate, commit_error_handler, AuthenticationError, AmbiguousCommitError, find_checkout_root, default_scm +from webkitpy.common.checkout.scm import detect_scm_system, SCM, SVN, Git, CheckoutNeedsUpdate, commit_error_handler, AuthenticationError, AmbiguousCommitError, find_checkout_root, default_scm from webkitpy.common.config.committers import Committer # FIXME: This should not be needed from webkitpy.common.net.bugzilla import Attachment # FIXME: This should not be needed from webkitpy.common.system.executive import Executive, run_command, ScriptError from webkitpy.common.system.outputcapture import OutputCapture +from webkitpy.tool.mocktool import MockExecutive # Eventually we will want to write tests which work for both scms. (like update_webkit, changed_files, etc.) # Perhaps through some SCMTest base-class which both SVNTest and GitTest inherit from. @@ -456,6 +457,7 @@ OcmYex&reD$;sO8*F9L)B self.scm.add("added_dir/added_file") self.assertTrue("added_dir/added_file" in self.scm.added_files()) + class SVNTest(SCMTest): @staticmethod @@ -1316,5 +1318,20 @@ class GitSVNTest(SCMTest): self.assertTrue("+Updated" in cached_diff) self.assertTrue("-more test content" in cached_diff) + +# We need to split off more of these SCM tests to use mocks instead of the filesystem. +# This class is the first part of that. +class GitTestWithMock(unittest.TestCase): + def setUp(self): + executive = MockExecutive(should_log=False) + # We do this should_log dance to avoid logging when Git.__init__ runs sysctl on mac to check for 64-bit support. + self.scm = Git(None, executive=executive) + executive.should_log = True + + def test_create_patch(self): + expected_stderr = "MOCK run_command: ['git', 'merge-base', u'refs/remotes/origin/master', 'HEAD']\nMOCK run_command: ['git', 'diff', '--binary', '--no-ext-diff', '--full-index', '-M', 'MOCK output of child process', '--']\n" + OutputCapture().assert_outputs(self, self.scm.create_patch, kwargs={'changed_files': None}, expected_stderr=expected_stderr) + + if __name__ == '__main__': unittest.main() diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index c7c741b..6a235f5 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -106,6 +106,7 @@ committers_unable_to_review = [ Committer("Enrica Casucci", "enrica@apple.com"), Committer("Erik Arvidsson", "arv@chromium.org", "arv"), Committer("Eric Roman", "eroman@chromium.org", "eroman"), + Committer("Eric Uhrhane", "ericu@chromium.org", "ericu"), Committer("Evan Martin", "evan@chromium.org", "evmar"), Committer("Evan Stade", "estade@chromium.org", "estade"), Committer("Fady Samuel", "fsamuel@chromium.org", "fsamuel"), @@ -134,6 +135,7 @@ committers_unable_to_review = [ Committer("Jochen Eisinger", "jochen@chromium.org", "jochen__"), Committer("John Abd-El-Malek", "jam@chromium.org", "jam"), Committer("John Gregg", ["johnnyg@google.com", "johnnyg@chromium.org"], "johnnyg"), + Committer("John Knottenbelt", ["jknotten@chromium.org"], "jknotten"), Committer("Johnny Ding", ["jnd@chromium.org", "johnnyding.webkit@gmail.com"], "johnnyding"), Committer("Joost de Valk", ["joost@webkit.org", "webkit-dev@joostdevalk.nl"], "Altha"), Committer("Julie Parent", ["jparent@google.com", "jparent@chromium.org"], "jparent"), @@ -173,6 +175,7 @@ committers_unable_to_review = [ Committer("Patrick Gansterer", ["paroga@paroga.com", "paroga@webkit.org"], "paroga"), Committer("Pavel Podivilov", "podivilov@chromium.org", "podivilov"), Committer("Peter Kasting", ["pkasting@google.com", "pkasting@chromium.org"], "pkasting"), + Committer("Peter Varga", ["pvarga@webkit.org", "pvarga@inf.u-szeged.hu"], "stampho"), Committer("Philippe Normand", ["pnormand@igalia.com", "philn@webkit.org"], "philn-tp"), Committer("Pierre d'Herbemont", ["pdherbemont@free.fr", "pdherbemont@apple.com"], "pdherbemont"), Committer("Pierre-Olivier Latour", "pol@apple.com", "pol"), @@ -184,7 +187,6 @@ committers_unable_to_review = [ Committer("Scott Violet", "sky@chromium.org", "sky"), Committer("Sergio Villar Senin", ["svillar@igalia.com", "sergio@webkit.org"], "svillar"), Committer("Stephen White", "senorblanco@chromium.org", "senorblanco"), - Committer("Tony Gentilcore", "tonyg@chromium.org", "tonyg-cr"), Committer("Trey Matteson", "trey@usa.net", "trey"), Committer("Tristan O'Tierney", ["tristan@otierney.net", "tristan@apple.com"]), Committer("Vangelis Kokkevis", "vangelis@chromium.org", "vangelis"), @@ -290,6 +292,7 @@ reviewers_list = [ Reviewer("Tim Omernick", "timo@apple.com"), Reviewer("Timothy Hatcher", ["timothy@apple.com", "timothy@hatcher.name"], "xenon"), Reviewer("Tony Chang", "tony@chromium.org", "tony^work"), + Reviewer("Tony Gentilcore", "tonyg@chromium.org", "tonyg-cr"), Reviewer(u"Tor Arne Vestb\u00f8", ["vestbo@webkit.org", "tor.arne.vestbo@nokia.com"], "torarne"), Reviewer("Vicki Murley", "vicki@apple.com"), Reviewer("Xan Lopez", ["xan.lopez@gmail.com", "xan@gnome.org", "xan@webkit.org"], "xan"), diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py index d6210d5..17a8515 100644 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py @@ -30,6 +30,7 @@ # # WebKit's Python module for interacting with Bugzilla +import mimetypes import os.path import re import StringIO @@ -441,7 +442,11 @@ class Bugzilla(object): self.browser['flag_type-3'] = (self._commit_queue_flag(mark_for_landing, mark_for_commit_queue),) filename = filename or "%s.patch" % timestamp() - mimetype = mimetype or "text/plain" + if not mimetype: + mimetypes.add_type('text/plain', '.patch') # Make sure mimetypes knows about .patch + mimetype, _ = mimetypes.guess_type(filename) + if not mimetype: + mimetype = "text/plain" # Bugzilla might auto-guess for us and we might not need this? self.browser.add_file(file_object, mimetype, filename, 'data') def _file_object_for_upload(self, file_or_string): diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py index 98e2fae..3cb6da5 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py @@ -270,7 +270,6 @@ class BuildBot(object): "Leopard", "Tiger", "Windows.*Build", - "EFL", "GTK.*32", "GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken. "Qt", diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py index ba898ec..57290d1 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py @@ -259,7 +259,6 @@ class BuildBotTest(unittest.TestCase): "Leopard", "Tiger", "Windows.*Build", - "EFL", "GTK.*32", "GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken. "Qt", diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py index 85a683a..02619db 100644 --- a/Tools/Scripts/webkitpy/common/system/executive.py +++ b/Tools/Scripts/webkitpy/common/system/executive.py @@ -53,6 +53,14 @@ _log = logging.getLogger("webkitpy.common.system") class ScriptError(Exception): + # This is a custom List.__str__ implementation to allow size limiting. + def _string_from_args(self, args, limit=100): + args_string = unicode(args) + # We could make this much fancier, but for now this is OK. + if len(args_string) > limit: + return args_string[:limit - 3] + "..." + return args_string + def __init__(self, message=None, script_args=None, @@ -60,7 +68,7 @@ class ScriptError(Exception): output=None, cwd=None): if not message: - message = 'Failed to run "%s"' % script_args + message = 'Failed to run "%s"' % self._string_from_args(script_args) if exit_code: message += " exit_code: %d" % exit_code if cwd: @@ -75,9 +83,9 @@ class ScriptError(Exception): def message_with_output(self, output_limit=500): if self.output: if output_limit and len(self.output) > output_limit: - return u"%s\nLast %s characters of output:\n%s" % \ + return u"%s\n\nLast %s characters of output:\n%s" % \ (self, output_limit, self.output[-output_limit:]) - return u"%s\n%s" % (self, self.output) + return u"%s\n\n%s" % (self, self.output) return unicode(self) def command_name(self): diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py index b8fd82e..a43b4dc 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py @@ -37,6 +37,23 @@ from webkitpy.common.system.executive import Executive, run_command, ScriptError from webkitpy.test import cat, echo +class ScriptErrorTest(unittest.TestCase): + def test_string_from_args(self): + error = ScriptError() + self.assertEquals(error._string_from_args(None), 'None') + self.assertEquals(error._string_from_args([]), '[]') + self.assertEquals(error._string_from_args(map(str, range(30))), "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'...") + + def test_message_with_output(self): + error = ScriptError('My custom message!', '', -1) + self.assertEquals(error.message_with_output(), 'My custom message!') + error = ScriptError('My custom message!', '', -1, 'My output.') + self.assertEquals(error.message_with_output(), 'My custom message!\n\nMy output.') + error = ScriptError('', 'my_command!', -1, 'My output.', '/Users/username/blah') + self.assertEquals(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1 cwd: /Users/username/blah\n\nMy output.') + error = ScriptError('', 'my_command!', -1, 'ab' + '1' * 499) + self.assertEquals(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1\n\nLast 500 characters of output:\nb' + '1' * 499) + def never_ending_command(): """Arguments for a command that will never end (useful for testing process killing). It should be a process that is unlikely to already be running diff --git a/Tools/Scripts/webkitpy/common/system/filesystem.py b/Tools/Scripts/webkitpy/common/system/filesystem.py index 8830ea8..527b6bd 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem.py @@ -124,6 +124,9 @@ class FileSystem(object): if retry_timeout_sec < 0: raise e + def remove_tree(self, path, ignore_errors=False): + shutil.rmtree(path, ignore_errors) + def read_binary_file(self, path): """Return the contents of the file at the given path as a byte string.""" with file(path, 'rb') as f: diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py index c605cb2..809c4c6 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py @@ -116,3 +116,6 @@ class MockFileSystem(object): def remove(self, path): del self.files[path] + + def remove_tree(self, path, ignore_errors=False): + self.files = [file for file in self.files if not file.startswith(path)] diff --git a/Tools/Scripts/webkitpy/common/system/workspace.py b/Tools/Scripts/webkitpy/common/system/workspace.py new file mode 100644 index 0000000..3b755ad --- /dev/null +++ b/Tools/Scripts/webkitpy/common/system/workspace.py @@ -0,0 +1,61 @@ +# 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 +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * 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. +# * 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# A home for file logic which should sit above FileSystem, but +# below more complicated objects. + +import zipfile + +class Workspace(object): + def __init__(self, filesystem, executive): + self._filesystem = filesystem + self._executive = executive # FIXME: Remove if create_zip is moved to python. + + def find_unused_filename(self, directory, name, extension, search_limit=10): + for count in range(search_limit): + if count: + target_name = "%s-%s.%s" % (name, count, extension) + else: + target_name = "%s.%s" % (name, extension) + target_path = self._filesystem.join(directory, target_name) + if not self._filesystem.exists(target_path): + return target_path + # If we can't find an unused name in search_limit tries, just give up. + return None + + def create_zip(self, zip_path, source_path, zip_class=zipfile.ZipFile): + # It's possible to create zips with Python: + # zip_file = ZipFile(zip_path, 'w') + # for root, dirs, files in os.walk(source_path): + # for path in files: + # absolute_path = os.path.join(root, path) + # zip_file.write(os.path.relpath(path, source_path)) + # However, getting the paths, encoding and compression correct could be non-trivial. + # So, for now we depend on the environment having "zip" installed (likely fails on Win32) + self._executive.run_command(['zip', '-r', zip_path, source_path]) + return zip_class(zip_path) diff --git a/Tools/Scripts/webkitpy/common/system/workspace_unittest.py b/Tools/Scripts/webkitpy/common/system/workspace_unittest.py new file mode 100644 index 0000000..e5fbb26 --- /dev/null +++ b/Tools/Scripts/webkitpy/common/system/workspace_unittest.py @@ -0,0 +1,55 @@ +# 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 +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * 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. +# * 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import unittest + +from webkitpy.common.system.filesystem_mock import MockFileSystem +from webkitpy.common.system.outputcapture import OutputCapture +from webkitpy.common.system.workspace import Workspace +from webkitpy.tool.mocktool import MockExecutive + + +class WorkspaceTest(unittest.TestCase): + + def test_find_unused_filename(self): + filesystem = MockFileSystem({ + "dir/foo.jpg": "", + "dir/foo-1.jpg": "", + }) + workspace = Workspace(filesystem, None) + self.assertEqual(workspace.find_unused_filename("bar", "bar", "bar"), "bar/bar.bar") + self.assertEqual(workspace.find_unused_filename("dir", "foo", "jpg"), "dir/foo-2.jpg") + + def test_create_zip(self): + workspace = Workspace(None, MockExecutive(should_log=True)) + expected_stderr = "MOCK run_command: ['zip', '-r', '/zip/path', '/source/path']\n" + class MockZipFile(object): + def __init__(self, path): + self.filename = path + archive = OutputCapture().assert_outputs(self, workspace.create_zip, ["/zip/path", "/source/path", MockZipFile], expected_stderr=expected_stderr) + self.assertEqual(archive.filename, "/zip/path") diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py index 5dd0114..2b8190b 100644 --- a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py +++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py @@ -187,11 +187,11 @@ class FailureTimeout(TestFailure): class FailureCrash(TestFailure): - """Test shell crashed.""" + """DumpRenderTree crashed.""" @staticmethod def message(): - return "Test shell crashed" + return "DumpRenderTree crashed" def result_html_output(self, filename): # FIXME: create a link to the minidump file diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py index b90421a..7e934a8 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -392,6 +392,8 @@ class ChromiumDriver(base.Driver): cmd.append('--enable-accelerated-compositing') if self._port.get_option('accelerated_2d_canvas'): cmd.append('--enable-accelerated-2d-canvas') + if self._port.get_option('enable_hardware_gpu'): + cmd.append('--enable-hardware-gpu') return cmd def start(self): diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index c431765..a141661 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -243,6 +243,10 @@ def parse_args(args=None): action="store_false", dest="accelerated_2d_canvas", help="Don't use hardware-accelerated 2D Canvas calls"), + optparse.make_option("--enable-hardware-gpu", + action="store_true", + default=False, + help="Run graphics tests on real GPU hardware vs software"), ] # Missing Mac-specific old-run-webkit-tests options: diff --git a/Tools/Scripts/webkitpy/style/checker.py b/Tools/Scripts/webkitpy/style/checker.py index 3cfa1c9..ebcf326 100644 --- a/Tools/Scripts/webkitpy/style/checker.py +++ b/Tools/Scripts/webkitpy/style/checker.py @@ -165,20 +165,20 @@ _PATH_RULES_SPECIFIER = [ # WebKit2 doesn't use config.h, and certain directories have other # idiosyncracies. ([# NPAPI has function names with underscores. - "WebKit2/WebProcess/Plugins/Netscape"], + "Source/WebKit2/WebProcess/Plugins/Netscape"], ["-build/include_order", "-readability/naming"]), ([# The WebKit2 C API has names with underscores and whitespace-aligned # struct members. Also, we allow unnecessary parameter names in # WebKit2 APIs because we're matching CF's header style. - "WebKit2/UIProcess/API/C/", - "WebKit2/WebProcess/InjectedBundle/API/c/"], + "Source/WebKit2/UIProcess/API/C/", + "Source/WebKit2/WebProcess/InjectedBundle/API/c/"], ["-build/include_order", "-readability/naming", "-readability/parameter_name", "-whitespace/declaration"]), ([# Nothing in WebKit2 uses config.h. - "WebKit2/"], + "Source/WebKit2/"], ["-build/include_order"]), # For third-party Python code, keep only the following checks-- diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp.py b/Tools/Scripts/webkitpy/style/checkers/cpp.py index 4ea7d69..250b9ee 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp.py @@ -344,6 +344,12 @@ class Position(object): self.row = row self.column = column + def __str__(self): + return '(%s, %s)' % (self.row, self.column) + + def __cmp__(self, other): + return self.row.__cmp__(other.row) or self.column.__cmp__(other.column) + class Parameter(object): """Information about one function parameter.""" @@ -486,32 +492,37 @@ class _FunctionState(object): self.current_function = '' self.in_a_function = False self.lines_in_function = 0 - # Make sure these will not be mistaken for real lines (even when a + # Make sure these will not be mistaken for real positions (even when a # small amount is added to them). - self.body_start_line_number = -1000 - self.ending_line_number = -1000 + self.body_start_position = Position(-1000, 0) + self.end_position = Position(-1000, 0) - def begin(self, function_name, body_start_line_number, ending_line_number, is_declaration, + def begin(self, function_name, function_name_start_position, body_start_position, end_position, parameter_start_position, parameter_end_position, clean_lines): """Start analyzing function body. Args: function_name: The name of the function being tracked. - body_start_line_number: The line number of the { or the ; for a protoype. - ending_line_number: The line number where the function ends. - is_declaration: True if this is a prototype. - parameter_start_position: position in elided of the '(' for the parameters. - parameter_end_position: position in elided of the ')' for the parameters. + function_name_start_position: Position in elided where the function name starts. + body_start_position: Position in elided of the { or the ; for a prototype. + end_position: Position in elided just after the final } (or ; is. + parameter_start_position: Position in elided of the '(' for the parameters. + parameter_end_position: Position in elided just after the ')' for the parameters. clean_lines: A CleansedLines instance containing the file. """ self.in_a_function = True self.lines_in_function = -1 # Don't count the open brace line. self.current_function = function_name - self.body_start_line_number = body_start_line_number - self.ending_line_number = ending_line_number - self.is_declaration = is_declaration + self.function_name_start_position = function_name_start_position + self.body_start_position = body_start_position + self.end_position = end_position + self.is_declaration = clean_lines.elided[body_start_position.row][body_start_position.column] == ';' self.parameter_start_position = parameter_start_position self.parameter_end_position = parameter_end_position + self.is_pure = False + if self.is_declaration: + characters_after_parameters = SingleLineView(clean_lines.elided, parameter_end_position, body_start_position).single_line + self.is_pure = bool(match(r'\s*=\s*0\s*', characters_after_parameters)) self._clean_lines = clean_lines self._parameter_list = None @@ -524,7 +535,7 @@ class _FunctionState(object): def count(self, line_number): """Count line in current function body.""" - if self.in_a_function and line_number >= self.body_start_line_number: + if self.in_a_function and line_number >= self.body_start_position.row: self.lines_in_function += 1 def check(self, error, line_number): @@ -791,49 +802,58 @@ class CleansedLines(object): return elided -def close_expression(clean_lines, line_number, pos): +def close_expression(elided, position): """If input points to ( or { or [, finds the position that closes it. - If clean_lines.elided[line_number][pos] points to a '(' or '{' or '[', finds - the line_number/pos that correspond to the closing of the expression. + If elided[position.row][position.column] points to a '(' or '{' or '[', + finds the line_number/pos that correspond to the closing of the expression. - Args: - clean_lines: A CleansedLines instance containing the file. - line_number: The number of the line to check. - pos: A position on the line. + Args: + elided: A CleansedLines.elided instance containing the file. + position: The position of the opening item. - Returns: - A tuple (line, line_number, pos) pointer *past* the closing brace, or - ('', len(clean_lines.elided), -1) if we never find a close. Note we - ignore strings and comments when matching; and the line we return is the - 'cleansed' line at line_number. + Returns: + The Position *past* the closing brace, or Position(len(elided), -1) + if we never find a close. Note we ignore strings and comments when matching. """ - - line = clean_lines.elided[line_number] - start_character = line[pos] - if start_character not in '({[': - return (line, clean_lines.num_lines(), -1) + line = elided[position.row] + start_character = line[position.column] if start_character == '(': - end_character = ')' - if start_character == '[': - end_character = ']' - if start_character == '{': - end_character = '}' - - num_open = line.count(start_character) - line.count(end_character) - while num_open > 0: + enclosing_character_regex = r'[\(\)]' + elif start_character == '[': + enclosing_character_regex = r'[\[\]]' + elif start_character == '{': + enclosing_character_regex = r'[\{\}]' + else: + return Position(len(elided), -1) + + current_column = position.column + 1 + line_number = position.row + net_open = 1 + for line in elided[position.row:]: + line = line[current_column:] + + # Search the current line for opening and closing characters. + while True: + next_enclosing_character = search(enclosing_character_regex, line) + # No more on this line. + if not next_enclosing_character: + break + current_column += next_enclosing_character.end(0) + line = line[next_enclosing_character.end(0):] + if next_enclosing_character.group(0) == start_character: + net_open += 1 + else: + net_open -= 1 + if not net_open: + return Position(line_number, current_column) + + # Proceed to the next line. line_number += 1 - if line_number >= clean_lines.num_lines(): - return ('', len(clean_lines.elided), -1) - line = clean_lines.elided[line_number] - num_open += line.count(start_character) - line.count(end_character) - # OK, now find the end_character that actually got us back to even - endpos = len(line) - while num_open >= 0: - endpos = line.rfind(')', 0, endpos) - num_open -= 1 # chopped off another ) - return (line, line_number, endpos + 1) + current_column = 0 + # The given item was not closed. + return Position(len(elided), -1) def check_for_copyright(lines, error): """Logs an error if no Copyright message appears at the top of the file.""" @@ -1378,7 +1398,7 @@ def detect_functions(clean_lines, line_number, function_state, error): error: The function to call with any errors found. """ # Are we now past the end of a function? - if function_state.ending_line_number + 1 == line_number: + if function_state.end_position.row + 1 == line_number: function_state.end() # If we're in a function, don't try to detect a new one. @@ -1409,7 +1429,10 @@ def detect_functions(clean_lines, line_number, function_state, error): for start_line_number in xrange(line_number, clean_lines.num_lines()): start_line = clean_lines.elided[start_line_number] joined_line += ' ' + start_line.lstrip() - if search(r'{|;', start_line): + body_match = search(r'{|;', start_line) + if body_match: + body_start_position = Position(start_line_number, body_match.start(0)) + # Replace template constructs with _ so that no spaces remain in the function name, # while keeping the column numbers of other characters the same as "line". line_with_no_templates = iteratively_replace_matches_with_char(r'<[^<>]*>', '_', line) @@ -1420,6 +1443,7 @@ def detect_functions(clean_lines, line_number, function_state, error): # Use the column numbers from the modified line to find the # function name in the original line. function = line[match_function.start(1):match_function.end(1)] + function_name_start_position = Position(line_number, match_function.start(1)) if match(r'TEST', function): # Handle TEST... macros parameter_regexp = search(r'(\(.*\))', joined_line) @@ -1429,19 +1453,21 @@ def detect_functions(clean_lines, line_number, function_state, error): function += '()' parameter_start_position = Position(line_number, match_function.end(1)) - close_result = close_expression(clean_lines, line_number, parameter_start_position.column) - if close_result[1] == len(clean_lines.elided): + parameter_end_position = close_expression(clean_lines.elided, parameter_start_position) + if parameter_end_position.row == len(clean_lines.elided): # No end was found. return - parameter_end_position = Position(close_result[1], close_result[2]) - is_declaration = bool(search(r'^[^{]*;', start_line)) - if is_declaration: - ending_line_number = start_line_number + if start_line[body_start_position.column] == ';': + end_position = Position(body_start_position.row, body_start_position.column + 1) else: - open_brace_index = start_line.find('{') - ending_line_number = close_expression(clean_lines, start_line_number, open_brace_index)[1] - function_state.begin(function, start_line_number, ending_line_number, is_declaration, + end_position = close_expression(clean_lines.elided, body_start_position) + + # Check for nonsensical positions. (This happens in test cases which check code snippets.) + if parameter_end_position > body_start_position: + return + + function_state.begin(function, function_name_start_position, body_start_position, end_position, parameter_start_position, parameter_end_position, clean_lines) return @@ -1471,7 +1497,7 @@ def check_for_function_lengths(clean_lines, line_number, function_state, error): raw = clean_lines.raw_lines raw_line = raw[line_number] - if function_state.ending_line_number == line_number: # last line + if function_state.end_position.row == line_number: # last line if not search(r'\bNOLINT\b', raw_line): function_state.check(error, line_number) elif not match(r'^\s*$', line): @@ -1517,7 +1543,7 @@ def check_function_definition(clean_lines, line_number, function_state, error): error: The function to call with any errors found. """ # Only do checks when we have a function declaration. - if line_number != function_state.body_start_line_number or not function_state.is_declaration: + if line_number != function_state.body_start_position.row or not function_state.is_declaration: return parameter_list = function_state.parameter_list() @@ -1553,7 +1579,7 @@ def check_pass_ptr_usage(clean_lines, line_number, function_state, error): lines = clean_lines.lines line = lines[line_number] - if line_number > function_state.body_start_line_number: + if line_number > function_state.body_start_position.row: matched_pass_ptr = match(r'^\s*Pass([A-Z][A-Za-z]*)Ptr<', line) if matched_pass_ptr: type_name = 'Pass%sPtr' % matched_pass_ptr.group(1) diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py index d39d2ba..868d3f6 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -342,6 +342,14 @@ class CppStyleTestBase(unittest.TestCase): 'Blank line at the end of a code block. Is this needed?' ' [whitespace/blank_line] [3]')) + def assert_positions_equal(self, position, tuple_position): + """Checks if the two positions are equal. + + position: a cpp_style.Position object. + tuple_position: a tuple (row, column) to compare against.""" + self.assertEquals(position, cpp_style.Position(tuple_position[0], tuple_position[1]), + 'position %s, tuple_position %s' % (position, tuple_position)) + class FunctionDetectionTest(CppStyleTestBase): def perform_function_detection(self, lines, function_information): @@ -354,9 +362,13 @@ class FunctionDetectionTest(CppStyleTestBase): return self.assertEquals(function_state.in_a_function, True) self.assertEquals(function_state.current_function, function_information['name'] + '()') - self.assertEquals(function_state.body_start_line_number, function_information['body_start_line_number']) - self.assertEquals(function_state.ending_line_number, function_information['ending_line_number']) + self.assertEquals(function_state.is_pure, function_information['is_pure']) self.assertEquals(function_state.is_declaration, function_information['is_declaration']) + self.assert_positions_equal(function_state.function_name_start_position, function_information['function_name_start_position']) + self.assert_positions_equal(function_state.parameter_start_position, function_information['parameter_start_position']) + self.assert_positions_equal(function_state.parameter_end_position, function_information['parameter_end_position']) + self.assert_positions_equal(function_state.body_start_position, function_information['body_start_position']) + self.assert_positions_equal(function_state.end_position, function_information['end_position']) expected_parameters = function_information.get('parameter_list') if expected_parameters: actual_parameters = function_state.parameter_list() @@ -373,44 +385,105 @@ class FunctionDetectionTest(CppStyleTestBase): ['void theTestFunctionName(int) {', '}'], {'name': 'theTestFunctionName', - 'body_start_line_number': 0, - 'ending_line_number': 1, + 'function_name_start_position': (0, 5), + 'parameter_start_position': (0, 24), + 'parameter_end_position': (0, 29), + 'body_start_position': (0, 30), + 'end_position': (1, 1), + 'is_pure': False, 'is_declaration': False}) def test_function_declaration_detection(self): self.perform_function_detection( ['void aFunctionName(int);'], {'name': 'aFunctionName', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 5), + 'parameter_start_position': (0, 18), + 'parameter_end_position': (0, 23), + 'body_start_position': (0, 23), + 'end_position': (0, 24), + 'is_pure': False, 'is_declaration': True}) self.perform_function_detection( ['CheckedInt operator /(const CheckedInt &lhs, const CheckedInt &rhs);'], {'name': 'operator /', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 14), + 'parameter_start_position': (0, 24), + 'parameter_end_position': (0, 76), + 'body_start_position': (0, 76), + 'end_position': (0, 77), + 'is_pure': False, 'is_declaration': True}) self.perform_function_detection( ['CheckedInt operator -(const CheckedInt &lhs, const CheckedInt &rhs);'], {'name': 'operator -', - 'body_start_line_number': 0, - 'ending_line_number': 0, - 'is_declaration': True}) + 'function_name_start_position': (0, 14), + 'parameter_start_position': (0, 24), + 'parameter_end_position': (0, 76), + 'body_start_position': (0, 76), + 'end_position': (0, 77), + 'is_pure': False, + 'is_declaration': True}) self.perform_function_detection( ['CheckedInt operator !=(const CheckedInt &lhs, const CheckedInt &rhs);'], {'name': 'operator !=', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 14), + 'parameter_start_position': (0, 25), + 'parameter_end_position': (0, 77), + 'body_start_position': (0, 77), + 'end_position': (0, 78), + 'is_pure': False, 'is_declaration': True}) self.perform_function_detection( ['CheckedInt operator +(const CheckedInt &lhs, const CheckedInt &rhs);'], {'name': 'operator +', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 14), + 'parameter_start_position': (0, 24), + 'parameter_end_position': (0, 76), + 'body_start_position': (0, 76), + 'end_position': (0, 77), + 'is_pure': False, + 'is_declaration': True}) + + def test_pure_function_detection(self): + self.perform_function_detection( + ['virtual void theTestFunctionName(int = 0);'], + {'name': 'theTestFunctionName', + 'function_name_start_position': (0, 13), + 'parameter_start_position': (0, 32), + 'parameter_end_position': (0, 41), + 'body_start_position': (0, 41), + 'end_position': (0, 42), + 'is_pure': False, + 'is_declaration': True}) + + self.perform_function_detection( + ['virtual void theTestFunctionName(int) = 0;'], + {'name': 'theTestFunctionName', + 'function_name_start_position': (0, 13), + 'parameter_start_position': (0, 32), + 'parameter_end_position': (0, 37), + 'body_start_position': (0, 41), + 'end_position': (0, 42), + 'is_pure': True, + 'is_declaration': True}) + + # Hopefully, no one writes code like this but it is a tricky case. + self.perform_function_detection( + ['virtual void theTestFunctionName(int)', + ' = ', + ' 0 ;'], + {'name': 'theTestFunctionName', + 'function_name_start_position': (0, 13), + 'parameter_start_position': (0, 32), + 'parameter_end_position': (0, 37), + 'body_start_position': (2, 3), + 'end_position': (2, 4), + 'is_pure': True, 'is_declaration': True}) def test_ignore_macros(self): @@ -425,8 +498,12 @@ class FunctionDetectionTest(CppStyleTestBase): # This isn't a function but it looks like one to our simple # algorithm and that is ok. {'name': 'asm', - 'body_start_line_number': 2, - 'ending_line_number': 2, + 'function_name_start_position': (0, 0), + 'parameter_start_position': (0, 3), + 'parameter_end_position': (2, 1), + 'body_start_position': (2, 1), + 'end_position': (2, 2), + 'is_pure': False, 'is_declaration': True}) # Simple test case with something that is not a function. @@ -437,8 +514,12 @@ class FunctionDetectionTest(CppStyleTestBase): function_state = self.perform_function_detection( ['void functionName();'], {'name': 'functionName', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 5), + 'parameter_start_position': (0, 17), + 'parameter_end_position': (0, 19), + 'body_start_position': (0, 19), + 'end_position': (0, 20), + 'is_pure': False, 'is_declaration': True, 'parameter_list': ()}) @@ -446,8 +527,12 @@ class FunctionDetectionTest(CppStyleTestBase): function_state = self.perform_function_detection( ['void functionName(int);'], {'name': 'functionName', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 5), + 'parameter_start_position': (0, 17), + 'parameter_end_position': (0, 22), + 'body_start_position': (0, 22), + 'end_position': (0, 23), + 'is_pure': False, 'is_declaration': True, 'parameter_list': ({'type': 'int', 'name': '', 'row': 0},)}) @@ -456,8 +541,12 @@ class FunctionDetectionTest(CppStyleTestBase): function_state = self.perform_function_detection( ['void functionName(unsigned a, short b, long c, long long short unsigned int);'], {'name': 'functionName', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'function_name_start_position': (0, 5), + 'parameter_start_position': (0, 17), + 'parameter_end_position': (0, 76), + 'body_start_position': (0, 76), + 'end_position': (0, 77), + 'is_pure': False, 'is_declaration': True, 'parameter_list': ({'type': 'unsigned', 'name': 'a', 'row': 0}, @@ -469,8 +558,12 @@ class FunctionDetectionTest(CppStyleTestBase): function_state = self.perform_function_detection( ['virtual void determineARIADropEffects(Vector*&, const unsigned long int*&, const MediaPlayer::Preload, Other >, int);'], {'name': 'determineARIADropEffects', - 'body_start_line_number': 0, - 'ending_line_number': 0, + 'parameter_start_position': (0, 37), + 'function_name_start_position': (0, 13), + 'parameter_end_position': (0, 147), + 'body_start_position': (0, 147), + 'end_position': (0, 148), + 'is_pure': False, 'is_declaration': True, 'parameter_list': ({'type': 'Vector*&', 'name': '', 'row': 0}, @@ -486,8 +579,12 @@ class FunctionDetectionTest(CppStyleTestBase): 'const ComplexTemplate >* const * param = new ComplexTemplate >(34, 42),', 'int* myCount = 0);'], {'name': 'aFunctionName', - 'body_start_line_number': 3, - 'ending_line_number': 3, + 'function_name_start_position': (0, 32), + 'parameter_start_position': (0, 45), + 'parameter_end_position': (3, 17), + 'body_start_position': (3, 17), + 'end_position': (3, 18), + 'is_pure': False, 'is_declaration': True, 'parameter_list': ({'type': 'PassRefPtr', 'name': 'paramName', 'row': 0}, @@ -523,6 +620,24 @@ class CppStyleTest(CppStyleTestBase): cpp_style.remove_multi_line_comments_from_range(lines, 1, 4) self.assertEquals(['a', '// dummy', '// dummy', '// dummy', 'b'], lines) + def test_position(self): + position = cpp_style.Position(3, 4) + self.assert_positions_equal(position, (3, 4)) + self.assertEquals(position.row, 3) + self.assertTrue(position > cpp_style.Position(position.row - 1, position.column + 1)) + self.assertTrue(position > cpp_style.Position(position.row, position.column - 1)) + self.assertTrue(position < cpp_style.Position(position.row, position.column + 1)) + self.assertTrue(position < cpp_style.Position(position.row + 1, position.column - 1)) + self.assertEquals(position.__str__(), '(3, 4)') + + def test_close_expression(self): + self.assertEquals(cpp_style.Position(1, -1), cpp_style.close_expression([')('], cpp_style.Position(0, 1))) + self.assertEquals(cpp_style.Position(1, -1), cpp_style.close_expression([') ()'], cpp_style.Position(0, 1))) + self.assertEquals(cpp_style.Position(0, 4), cpp_style.close_expression([')[)]'], cpp_style.Position(0, 1))) + self.assertEquals(cpp_style.Position(0, 5), cpp_style.close_expression(['}{}{}'], cpp_style.Position(0, 3))) + self.assertEquals(cpp_style.Position(1, 1), cpp_style.close_expression(['}{}{', '}'], cpp_style.Position(0, 3))) + self.assertEquals(cpp_style.Position(2, -1), cpp_style.close_expression(['][][', ' '], cpp_style.Position(0, 3))) + def test_spaces_at_end_of_line(self): self.assert_lint( '// Hello there ', diff --git a/Tools/Scripts/webkitpy/style_references.py b/Tools/Scripts/webkitpy/style_references.py index a21e931..c92bad9 100644 --- a/Tools/Scripts/webkitpy/style_references.py +++ b/Tools/Scripts/webkitpy/style_references.py @@ -70,5 +70,4 @@ class WebKitCheckout(object): return self._scm.checkout_root def create_patch(self, git_commit, changed_files=None): - # FIXME: SCM.create_patch should understand how to handle None. - return self._scm.create_patch(git_commit, changed_files=changed_files or []) + return self._scm.create_patch(git_commit, changed_files=changed_files) diff --git a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py index 4bdc79b..3be2556 100644 --- a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py +++ b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py @@ -46,7 +46,11 @@ class CommitQueueTaskDelegate(object): def layout_test_results(self): raise NotImplementedError("subclasses must implement") - def report_flaky_tests(self, patch, flaky_tests): + def archive_last_layout_test_results(self, patch): + raise NotImplementedError("subclasses must implement") + + # We could make results_archive optional, but for now it's required. + def report_flaky_tests(self, patch, flaky_tests, results_archive): raise NotImplementedError("subclasses must implement") @@ -66,6 +70,8 @@ class CommitQueueTask(object): return False if not self._patch.committer(): return False + if not self._patch.review() != "-": + return False # Reviewer is not required. Missing reviewers will be caught during # the ChangeLog check during landing. return True @@ -168,8 +174,8 @@ class CommitQueueTask(object): "Landed patch", "Unable to land patch") - def _report_flaky_tests(self, flaky_test_results): - self._delegate.report_flaky_tests(self._patch, flaky_test_results) + def _report_flaky_tests(self, flaky_test_results, results_archive): + self._delegate.report_flaky_tests(self._patch, flaky_test_results, results_archive) def _test_patch(self): if self._patch.is_rollout(): @@ -177,14 +183,15 @@ class CommitQueueTask(object): if self._test(): return True - first_failing_results = self._failing_results_from_last_run() - first_failing_tests = [result.filename for result in first_failing_results] + first_results = self._failing_results_from_last_run() + first_failing_tests = [result.filename for result in first_results] + first_results_archive = self._delegate.archive_last_layout_test_results(self._patch) if self._test(): - self._report_flaky_tests(first_failing_results) + self._report_flaky_tests(first_results, first_results_archive) return True - second_failing_results = self._failing_results_from_last_run() - second_failing_tests = [result.filename for result in second_failing_results] + second_results = self._failing_results_from_last_run() + second_failing_tests = [result.filename for result in second_results] if first_failing_tests != second_failing_tests: # We could report flaky tests here, but since run-webkit-tests # is run with --exit-after-N-failures=1, we would need to diff --git a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py index f279cac..26231ae 100644 --- a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py @@ -29,6 +29,7 @@ from datetime import datetime import unittest +from webkitpy.common.net import bugzilla from webkitpy.common.system.deprecated_logging import error, log from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.layout_tests.layout_package import test_results @@ -64,9 +65,15 @@ class MockCommitQueue(CommitQueueTaskDelegate): def layout_test_results(self): return None - def report_flaky_tests(self, patch, flaky_results): + def report_flaky_tests(self, patch, flaky_results, results_archive): flaky_tests = [result.filename for result in flaky_results] - log("report_flaky_tests: patch='%s' flaky_tests='%s'" % (patch.id(), flaky_tests)) + log("report_flaky_tests: patch='%s' flaky_tests='%s' archive='%s'" % (patch.id(), flaky_tests, results_archive.filename)) + + def archive_last_layout_test_results(self, patch): + log("archive_last_layout_test_results: patch='%s'" % patch.id()) + archive = Mock() + archive.filename = "mock-archive-%s.zip" % patch.id() + return archive class CommitQueueTaskTest(unittest.TestCase): @@ -193,9 +200,10 @@ run_webkit_patch: ['build', '--no-clean', '--no-update', '--build-style=both'] command_passed: success_message='Built patch' patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK tests failure' patch='197' +archive_last_layout_test_results: patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_passed: success_message='Passed tests' patch='197' -report_flaky_tests: patch='197' flaky_tests='[]' +report_flaky_tests: patch='197' flaky_tests='[]' archive='mock-archive-197.zip' run_webkit_patch: ['land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 197] command_passed: success_message='Landed patch' patch='197' """ @@ -225,6 +233,7 @@ run_webkit_patch: ['build', '--no-clean', '--no-update', '--build-style=both'] command_passed: success_message='Built patch' patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure' patch='197' +archive_last_layout_test_results: patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure again' patch='197' """ @@ -262,6 +271,7 @@ run_webkit_patch: ['build', '--no-clean', '--no-update', '--build-style=both'] command_passed: success_message='Built patch' patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure' patch='197' +archive_last_layout_test_results: patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure again' patch='197' run_webkit_patch: ['build-and-test', '--force-clean', '--no-update', '--build', '--test', '--non-interactive'] @@ -289,6 +299,7 @@ run_webkit_patch: ['build', '--no-clean', '--no-update', '--build-style=both'] command_passed: success_message='Built patch' patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure' patch='197' +archive_last_layout_test_results: patch='197' run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive'] command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure again' patch='197' run_webkit_patch: ['build-and-test', '--force-clean', '--no-update', '--build', '--test', '--non-interactive'] @@ -320,3 +331,24 @@ command_failed: failure_message='Unable to land patch' script_error='MOCK land f """ # FIXME: This should really be expect_retry=True for a better user experiance. self._run_through_task(commit_queue, expected_stderr, ScriptError) + + def _expect_validate(self, patch, is_valid): + class MockDelegate(object): + def refetch_patch(self, patch): + return patch + + task = CommitQueueTask(MockDelegate(), patch) + self.assertEquals(task._validate(), is_valid) + + def _mock_patch(self, attachment_dict={}, bug_dict={'bug_status': 'NEW'}, committer="fake"): + bug = bugzilla.Bug(bug_dict, None) + patch = bugzilla.Attachment(attachment_dict, bug) + patch._committer = committer + return patch + + def test_validate(self): + self._expect_validate(self._mock_patch(), True) + self._expect_validate(self._mock_patch({'is_obsolete': True}), False) + self._expect_validate(self._mock_patch(bug_dict={'bug_status': 'CLOSED'}), False) + self._expect_validate(self._mock_patch(committer=None), False) + self._expect_validate(self._mock_patch({'review': '-'}), False) diff --git a/Tools/Scripts/webkitpy/tool/bot/feeders.py b/Tools/Scripts/webkitpy/tool/bot/feeders.py index 046c4c1..0b7f23d 100644 --- a/Tools/Scripts/webkitpy/tool/bot/feeders.py +++ b/Tools/Scripts/webkitpy/tool/bot/feeders.py @@ -54,6 +54,7 @@ class CommitQueueFeeder(AbstractFeeder): def feed(self): patches = self._validate_patches() + patches = self._patches_with_acceptable_review_flag(patches) patches = sorted(patches, self._patch_cmp) patch_ids = [patch.id() for patch in patches] self._update_work_items(patch_ids) @@ -61,6 +62,10 @@ class CommitQueueFeeder(AbstractFeeder): def _patches_for_bug(self, bug_id): return self._tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) + # Filters out patches with r? or r-, only r+ or no review are OK to land. + def _patches_with_acceptable_review_flag(self, patches): + return [patch for patch in patches if patch.review() in [None, '+']] + def _validate_patches(self): # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers. bug_ids = self._tool.bugs.queries.fetch_bug_ids_from_commit_queue() diff --git a/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py b/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py index 580f840..e956a8f 100644 --- a/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py @@ -68,3 +68,13 @@ Feeding commit-queue items [106, 197] queue = CommitQueueFeeder(MockTool()) attachments.sort(queue._patch_cmp) self.assertEqual(attachments, expected_sort) + + def test_patches_with_acceptable_review_flag(self): + class MockPatch(object): + def __init__(self, patch_id, review): + self.id = patch_id + self.review = lambda: review + + feeder = CommitQueueFeeder(MockTool()) + patches = [MockPatch(1, None), MockPatch(2, '-'), MockPatch(3, "+")] + self.assertEquals([patch.id for patch in feeder._patches_with_acceptable_review_flag(patches)], [1, 3]) diff --git a/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py b/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py index 91fcb85..270a656 100644 --- a/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py +++ b/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py @@ -131,13 +131,10 @@ If you would like to track this test fix with another bug, please close this bug flake_message = "The %s just saw %s flake (%s) while processing attachment %s on bug %s." % (self._bot_name, flaky_result.filename, ", ".join(failure_messages), patch.id(), patch.bug_id()) return "%s\n%s" % (flake_message, self._bot_information()) - def _results_diff_path_for_test(self, flaky_test): + def _results_diff_path_for_test(self, test_path): # FIXME: This is a big hack. We should get this path from results.json # except that old-run-webkit-tests doesn't produce a results.json # so we just guess at the file path. - results_path = self._tool.port().layout_tests_results_path() - results_directory = os.path.dirname(results_path) - test_path = os.path.join(results_directory, flaky_test) (test_path_root, _) = os.path.splitext(test_path) return "%s-diffs.txt" % test_path_root @@ -153,7 +150,32 @@ If you would like to track this test fix with another bug, please close this bug else: self._tool.bugs.post_comment_to_bug(bug.id(), latest_flake_message) - def report_flaky_tests(self, flaky_test_results, patch): + # This method is needed because our archive paths include a leading tmp/layout-test-results + def _find_in_archive(self, path, archive): + for archived_path in archive.namelist(): + # Archives are currently created with full paths. + if archived_path.endswith(path): + return archived_path + return None + + def _attach_failure_diff(self, flake_bug_id, flaky_test, results_archive): + results_diff_path = self._results_diff_path_for_test(flaky_test) + # Check to make sure that the path makes sense. + # Since we're not actually getting this path from the results.html + # there is a chance it's wrong. + bot_id = self._tool.status_server.bot_id or "bot" + archive_path = self._find_in_archive(results_diff_path, results_archive) + if archive_path: + results_diff = results_archive.read(archive_path) + description = "Failure diff from %s" % bot_id + self._tool.bugs.add_attachment_to_bug(flake_bug_id, results_diff, description, filename="failure.diff") + else: + _log.warn("%s does not exist in results archive, uploading entire archive." % results_diff_path) + description = "Archive of layout-test-results from %s" % bot_id + # results_archive is a ZipFile object, grab the File object (.fp) to pass to Mechanize for uploading. + self._tool.bugs.add_attachment_to_bug(flake_bug_id, results_archive.fp, description, filename="layout-test-results.zip") + + def report_flaky_tests(self, patch, flaky_test_results, results_archive): message = "The %s encountered the following flaky tests while processing attachment %s:\n\n" % (self._bot_name, patch.id()) for flaky_result in flaky_test_results: flaky_test = flaky_result.filename @@ -165,20 +187,12 @@ If you would like to track this test fix with another bug, please close this bug flake_bug_id = self._create_bug_for_flaky_test(flaky_test, author_emails, latest_flake_message) else: bug = self._follow_duplicate_chain(bug) + # FIXME: Ideally we'd only make one comment per flake, not two. But that's not possible + # in all cases (e.g. when reopening), so for now file attachment and comment are separate. self._update_bug_for_flaky_test(bug, latest_flake_message) flake_bug_id = bug.id() - # FIXME: Ideally we'd only make one comment per flake, not two. But that's not possible - # in all cases (e.g. when reopening), so for now we do the attachment in a second step. - results_diff_path = self._results_diff_path_for_test(flaky_test) - # Check to make sure that the path makes sense. - # Since we're not actually getting this path from the results.html - # there is a high probaility it's totally wrong. - if self._tool.filesystem.exists(results_diff_path): - results_diff = self._tool.filesystem.read_binary_file(results_diff_path) - bot_id = self._tool.status_server.bot_id or "bot" - self._tool.bugs.add_attachment_to_bug(flake_bug_id, results_diff, "Failure diff from %s" % bot_id, filename="failure.diff") - else: - _log.error("%s does not exist as expected, not uploading." % results_diff_path) + + self._attach_failure_diff(flake_bug_id, flaky_test, results_archive) message += "%s bug %s%s\n" % (flaky_test, flake_bug_id, self._optional_author_string(author_emails)) message += "The %s is continuing to process your patch." % self._bot_name diff --git a/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py b/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py index 631f8d1..26c98c1 100644 --- a/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py @@ -33,6 +33,7 @@ from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.layout_tests.layout_package import test_results from webkitpy.layout_tests.layout_package import test_failures +from webkitpy.thirdparty.mock import Mock from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter from webkitpy.tool.mocktool import MockTool, MockStatusServer @@ -140,7 +141,15 @@ The dummy-queue is continuing to process your patch. """ test_results = [self._mock_test_result('foo/bar.html')] - OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [test_results, patch], expected_stderr=expected_stderr) + + class MockZipFile(object): + def read(self, path): + return "" + + def namelist(self): + return ['foo/bar-diffs.txt'] + + OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [patch, test_results, MockZipFile()], expected_stderr=expected_stderr) def test_optional_author_string(self): reporter = FlakyTestReporter(MockTool(), 'dummy-queue') @@ -150,6 +159,15 @@ The dummy-queue is continuing to process your patch. def test_results_diff_path_for_test(self): reporter = FlakyTestReporter(MockTool(), 'dummy-queue') - self.assertEqual(reporter._results_diff_path_for_test("test.html"), "/mock/test-diffs.txt") + self.assertEqual(reporter._results_diff_path_for_test("test.html"), "test-diffs.txt") + + def test_find_in_archive(self): + reporter = FlakyTestReporter(MockTool(), 'dummy-queue') + + class MockZipFile(object): + def namelist(self): + return ["tmp/layout-test-results/foo/bar-diffs.txt"] - # report_flaky_tests is also tested by queues_unittest + reporter._find_in_archive("foo/bar-diffs.txt", MockZipFile()) + # This is not ideal, but its + reporter._find_in_archive("txt", MockZipFile()) diff --git a/Tools/Scripts/webkitpy/tool/commands/queues.py b/Tools/Scripts/webkitpy/tool/commands/queues.py index 5628543..42321cf 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues.py @@ -309,12 +309,32 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD return None return LayoutTestResults.results_from_string(results_html) + def _results_directory(self): + results_path = self._tool.port().layout_tests_results_path() + # FIXME: This is wrong in two ways: + # 1. It assumes that results.html is at the top level of the results tree. + # 2. This uses the "old" ports.py infrastructure instead of the new layout_tests/port + # which will not support Chromium. However the new arch doesn't work with old-run-webkit-tests + # so we have to use this for now. + return os.path.dirname(results_path) + + def archive_last_layout_test_results(self, patch): + results_directory = self._results_directory() + results_name, _ = os.path.splitext(os.path.basename(results_directory)) + # Note: We name the zip with the bug_id instead of patch_id to match work_item_log_path(). + zip_path = self._tool.workspace.find_unused_filename(self._log_directory(), "%s-%s" % (patch.bug_id(), results_name), "zip") + archive = self._tool.workspace.create_zip(zip_path, results_directory) + # Remove the results directory to prevent http logs, etc. from getting huge between runs. + # We could have create_zip remove the original, but this is more explicit. + self._tool.filesystem.remove_tree(results_directory, ignore_errors=True) + return archive + def refetch_patch(self, patch): return self._tool.bugs.fetch_attachment(patch.id()) - def report_flaky_tests(self, patch, flaky_test_results): + def report_flaky_tests(self, patch, flaky_test_results, results_archive=None): reporter = FlakyTestReporter(self._tool, self.name) - reporter.report_flaky_tests(flaky_test_results, patch) + reporter.report_flaky_tests(patch, flaky_test_results, results_archive) # StepSequenceErrorHandler methods diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py index 34a6a64..8f5c9e6 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py @@ -27,9 +27,11 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os +import StringIO from webkitpy.common.checkout.scm import CheckoutNeedsUpdate from webkitpy.common.net.bugzilla import Attachment +from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.layout_tests.layout_package import test_results from webkitpy.layout_tests.layout_package import test_failures @@ -342,12 +344,14 @@ The commit-queue just saw foo/bar.html flake (Text diff mismatch) while processi Port: MockPort Platform: MockPlatform 1.0 --- End comment --- +MOCK add_attachment_to_bug: bug_id=76, description=Failure diff from bot filename=failure.diff MOCK bug comment: bug_id=76, cc=None --- Begin comment --- The commit-queue just saw bar/baz.html flake (Text diff mismatch) while processing attachment 197 on bug 42. Port: MockPort Platform: MockPlatform 1.0 --- End comment --- +MOCK add_attachment_to_bug: bug_id=76, description=Archive of layout-test-results from bot filename=layout-test-results.zip MOCK bug comment: bug_id=42, cc=None --- Begin comment --- The commit-queue encountered the following flaky tests while processing attachment 197: @@ -360,7 +364,19 @@ The commit-queue is continuing to process your patch. """ test_names = ["foo/bar.html", "bar/baz.html"] test_results = [self._mock_test_result(name) for name in test_names] - OutputCapture().assert_outputs(self, queue.report_flaky_tests, [QueuesTest.mock_work_item, test_results], expected_stderr=expected_stderr) + + class MockZipFile(object): + def __init__(self): + self.fp = StringIO() + + def read(self, path): + return "" + + def namelist(self): + # This is intentionally missing one diffs.txt to exercise the "upload the whole zip" codepath. + return ['foo/bar-diffs.txt'] + + OutputCapture().assert_outputs(self, queue.report_flaky_tests, [QueuesTest.mock_work_item, test_results, MockZipFile()], expected_stderr=expected_stderr) def test_layout_test_results(self): queue = CommitQueue() @@ -370,6 +386,12 @@ The commit-queue is continuing to process your patch. queue._read_file_contents = lambda path: "" self.assertEquals(queue.layout_test_results(), None) + def test_archive_last_layout_test_results(self): + queue = CommitQueue() + queue.bind_to_tool(MockTool()) + patch = queue._tool.bugs.fetch_attachment(128) + queue.archive_last_layout_test_results(patch) + class StyleQueueTest(QueuesTest): def test_style_queue(self): diff --git a/Tools/Scripts/webkitpy/tool/main.py b/Tools/Scripts/webkitpy/tool/main.py index 0006e87..76d5bef 100755 --- a/Tools/Scripts/webkitpy/tool/main.py +++ b/Tools/Scripts/webkitpy/tool/main.py @@ -40,10 +40,7 @@ from webkitpy.common.net.bugzilla import Bugzilla from webkitpy.common.net.buildbot import BuildBot from webkitpy.common.net.irc.ircproxy import IRCProxy from webkitpy.common.net.statusserver import StatusServer -from webkitpy.common.system.executive import Executive -from webkitpy.common.system.filesystem import FileSystem -from webkitpy.common.system.platforminfo import PlatformInfo -from webkitpy.common.system.user import User +from webkitpy.common.system import executive, filesystem, platforminfo, user, workspace from webkitpy.layout_tests import port from webkitpy.tool.multicommandtool import MultiCommandTool import webkitpy.tool.commands as commands @@ -52,6 +49,7 @@ import webkitpy.tool.commands as commands class WebKitPatch(MultiCommandTool): global_options = [ make_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="enable all logging"), + make_option("-d", "--directory", action="append", dest="patch_directories", default=[], help="Directory to look at for changed files"), make_option("--dry-run", action="store_true", dest="dry_run", default=False, help="do not touch remote servers"), make_option("--status-host", action="store", dest="status_host", type="string", help="Hostname (e.g. localhost or commit.webkit.org) where status updates should be posted."), make_option("--bot-id", action="store", dest="bot_id", type="string", help="Identifier for this bot (if multiple bots are running for a queue)"), @@ -70,21 +68,22 @@ class WebKitPatch(MultiCommandTool): # manual getter functions (e.g. scm()). self.bugs = Bugzilla() self.buildbot = BuildBot() - self.executive = Executive() + self.executive = executive.Executive() self._irc = None - self.filesystem = FileSystem() + self.filesystem = filesystem.FileSystem() + self.workspace = workspace.Workspace(self.filesystem, self.executive) self._port = None - self.user = User() + self.user = user.User() self._scm = None self._checkout = None self.status_server = StatusServer() self.port_factory = port.factory - self.platform = PlatformInfo() + self.platform = platforminfo.PlatformInfo() def scm(self): # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands). if not self._scm: - self._scm = default_scm() + self._scm = default_scm(self._options.patch_directories) return self._scm def checkout(self): diff --git a/Tools/Scripts/webkitpy/tool/mocktool.py b/Tools/Scripts/webkitpy/tool/mocktool.py index eb7c248..7db2996 100644 --- a/Tools/Scripts/webkitpy/tool/mocktool.py +++ b/Tools/Scripts/webkitpy/tool/mocktool.py @@ -623,10 +623,10 @@ class MockStatusServer(object): # FIXME: Unify with common.system.executive_mock.MockExecutive. class MockExecutive(Mock): def __init__(self, should_log): - self._should_log = should_log + self.should_log = should_log def run_and_throw_if_fail(self, args, quiet=False): - if self._should_log: + if self.should_log: log("MOCK run_and_throw_if_fail: %s" % args) return "MOCK output of child process" @@ -638,7 +638,7 @@ class MockExecutive(Mock): return_exit_code=False, return_stderr=True, decode_output=False): - if self._should_log: + if self.should_log: log("MOCK run_command: %s" % args) return "MOCK output of child process" @@ -686,6 +686,14 @@ class MockPlatformInfo(object): return "MockPlatform 1.0" +class MockWorkspace(object): + def find_unused_filename(self, directory, name, extension, search_limit=10): + return "%s/%s.%s" % (directory, name, extension) + + def create_zip(self, zip_path, source_path): + pass + + class MockTool(object): def __init__(self, log_executive=False): @@ -694,6 +702,7 @@ class MockTool(object): self.buildbot = MockBuildBot() self.executive = MockExecutive(should_log=log_executive) self.filesystem = MockFileSystem() + self.workspace = MockWorkspace() self._irc = None self.user = MockUser() self._scm = MockSCM() diff --git a/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py b/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py index 099dfe3..392cd32 100644 --- a/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py +++ b/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py @@ -70,6 +70,8 @@ class PrepareChangeLog(AbstractStep): if self._tool.scm().supports_local_commits(): args.append("--merge-base=%s" % self._tool.scm().merge_base(self._options.git_commit)) + args.extend(self._changed_files(state)) + try: self._tool.executive.run_and_throw_if_fail(args, self._options.quiet) except ScriptError, e: diff --git a/Tools/Scripts/webkitpy/tool/steps/validatechangelogs.py b/Tools/Scripts/webkitpy/tool/steps/validatechangelogs.py index e812f94..a27ed77 100644 --- a/Tools/Scripts/webkitpy/tool/steps/validatechangelogs.py +++ b/Tools/Scripts/webkitpy/tool/steps/validatechangelogs.py @@ -44,6 +44,9 @@ class ValidateChangeLogs(AbstractStep): # later than that, assume that the entry is wrong. if diff_file.lines[0][0] < 8: return True + if self._options.non_interactive: + return False + log("The diff to %s looks wrong. Are you sure your ChangeLog entry is at the top of the file?" % (diff_file.filename)) # FIXME: Do we need to make the file path absolute? self._tool.scm().diff_for_file(diff_file.filename) diff --git a/Tools/Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py b/Tools/Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py index 66db793..db35a58 100644 --- a/Tools/Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py +++ b/Tools/Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py @@ -36,20 +36,24 @@ from webkitpy.tool.steps.validatechangelogs import ValidateChangeLogs class ValidateChangeLogsTest(unittest.TestCase): - def _assert_start_line_produces_output(self, start_line, should_prompt_user=False): + def _assert_start_line_produces_output(self, start_line, should_fail=False, non_interactive=False): tool = MockTool() tool._checkout.is_path_to_changelog = lambda path: True - step = ValidateChangeLogs(tool, MockOptions(git_commit=None)) + step = ValidateChangeLogs(tool, MockOptions(git_commit=None, non_interactive=non_interactive)) diff_file = Mock() diff_file.filename = "mock/ChangeLog" diff_file.lines = [(start_line, start_line, "foo")] expected_stdout = expected_stderr = "" - if should_prompt_user: + if should_fail and not non_interactive: expected_stdout = "OK to continue?\n" expected_stderr = "The diff to mock/ChangeLog looks wrong. Are you sure your ChangeLog entry is at the top of the file?\n" - OutputCapture().assert_outputs(self, step._check_changelog_diff, [diff_file], expected_stdout=expected_stdout, expected_stderr=expected_stderr) + result = OutputCapture().assert_outputs(self, step._check_changelog_diff, [diff_file], expected_stdout=expected_stdout, expected_stderr=expected_stderr) + self.assertEqual(not result, should_fail) def test_check_changelog_diff(self): - self._assert_start_line_produces_output(1, should_prompt_user=False) - self._assert_start_line_produces_output(7, should_prompt_user=False) - self._assert_start_line_produces_output(8, should_prompt_user=True) + self._assert_start_line_produces_output(1) + self._assert_start_line_produces_output(7) + self._assert_start_line_produces_output(8, should_fail=True) + + self._assert_start_line_produces_output(1, non_interactive=False) + self._assert_start_line_produces_output(8, non_interactive=True, should_fail=True) diff --git a/Tools/WebKitTestRunner/DerivedSources.pro b/Tools/WebKitTestRunner/DerivedSources.pro index 561a09e..1e4e461 100644 --- a/Tools/WebKitTestRunner/DerivedSources.pro +++ b/Tools/WebKitTestRunner/DerivedSources.pro @@ -37,8 +37,8 @@ defineTest(addExtraCompiler) { SRC_ROOT_DIR = $$replace(PWD, /Tools/WebKitTestRunner, /) # Make sure forwarded headers needed by this project are present -fwheader_generator.commands = perl $${SRC_ROOT_DIR}/WebKit2/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/Tools/WebKitTestRunner $${OUTPUT_DIR}/include qt -fwheader_generator.depends = $${SRC_ROOT_DIR}/WebKit2/Scripts/generate-forwarding-headers.pl +fwheader_generator.commands = perl $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/Tools/WebKitTestRunner $${OUTPUT_DIR}/include qt +fwheader_generator.depends = $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl generated_files.depends += fwheader_generator QMAKE_EXTRA_TARGETS += fwheader_generator diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index f68d3c4..999ca3a 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -167,6 +167,8 @@ void InjectedBundle::done() WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get()); + closeOtherPages(); + m_state = Idle; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 765ff37..4bcb3c8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -323,7 +323,7 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKB static_cast(const_cast(clientInfo))->didRunInsecureContentForFrame(frame); } -bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef, const void* clientInfo) +bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef, const void* clientInfo) { return static_cast(const_cast(clientInfo))->shouldLoadResourceForFrame(frame); } diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index ac9fbc3..e9462df 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -64,7 +64,7 @@ private: static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*); static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); - static bool shouldLoadResourceForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef, const void*); + static bool shouldLoadResourceForFrame(WKBundlePageRef, WKBundleFrameRef, WKStringRef, const void*); void didStartProvisionalLoadForFrame(WKBundleFrameRef); void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef); diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro index c15d1f2..92d31b8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro +++ b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro @@ -46,8 +46,8 @@ HEADERS += \ include(../../../../WebKit.pri) include(../../../../Source/JavaScriptCore/JavaScriptCore.pri) addJavaScriptCoreLib(../../../../Source/JavaScriptCore) -include(../../../../WebKit2/WebKit2.pri) -addWebKit2Lib(../../../../WebKit2) +include(../../../../Source/WebKit2/WebKit2.pri) +addWebKit2Lib(../../../../Source/WebKit2) INCLUDEPATH += \ $$PWD \ @@ -56,8 +56,8 @@ INCLUDEPATH += \ $$PWD/../Bindings \ $$PWD/../../../../Source/JavaScriptCore \ $$PWD/../../../../Source/JavaScriptCore/wtf \ - $$PWD/../../../../WebKit2 \ - $$PWD/../../../../WebKit2/Shared \ + $$PWD/../../../../Source/WebKit2 \ + $$PWD/../../../../Source/WebKit2/Shared \ $$GENERATED_SOURCES_DIR INCLUDEPATH += \ @@ -65,7 +65,7 @@ INCLUDEPATH += \ $$WC_GENERATED_SOURCES_DIR PREFIX_HEADER = $$PWD/../../WebKitTestRunnerPrefix.h -QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" +*-g++*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" unix:!mac:!symbian { CONFIG += link_pkgconfig diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index 3ea46ee..699982e 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -97,6 +97,12 @@ static void setWindowFrameOtherPage(WKPageRef page, WKRect frame, const void* cl view->setWindowFrame(frame); } +static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo) +{ + printf("%s\n", toSTD(message).c_str()); + return true; +} + static void closeOtherPage(WKPageRef page, const void* clientInfo) { WKPageClose(page); @@ -134,11 +140,12 @@ static WKPageRef createOtherPage(WKPageRef oldPage, WKDictionaryRef, WKEventModi 0, // setIsResizable getWindowFrameOtherPage, setWindowFrameOtherPage, - 0, // runBeforeUnloadConfirmPanel + runBeforeUnloadConfirmPanel, 0, // didDraw 0, // pageDidScroll 0, // exceededDatabaseQuota - 0 // runOpenPanel + 0, // runOpenPanel + 0, // decidePolicyForGeolocationPermissionRequest }; WKPageSetPageUIClient(newPage, &otherPageUIClient); @@ -238,11 +245,12 @@ void TestController::initialize(int argc, const char* argv[]) 0, // setIsResizable getWindowFrameMainPage, setWindowFrameMainPage, - 0, // runBeforeUnloadConfirmPanel + runBeforeUnloadConfirmPanel, 0, // didDraw 0, // pageDidScroll 0, // exceededDatabaseQuota - 0 // runOpenPanel + 0, // runOpenPanel + 0, // decidePolicyForGeolocationPermissionRequest }; WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient); @@ -270,7 +278,7 @@ void TestController::initialize(int argc, const char* argv[]) 0, // didFinishProgress 0, // didBecomeUnresponsive 0, // didBecomeResponsive - 0, // processDidExit + processDidCrash, // processDidCrash 0 // didChangeBackForwardList }; WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient); @@ -393,6 +401,11 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKT static_cast(const_cast(clientInfo))->didFinishLoadForFrame(page, frame); } +void TestController::processDidCrash(WKPageRef page, const void* clientInfo) +{ + static_cast(const_cast(clientInfo))->processDidCrash(page); +} + void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame) { if (m_state != Resetting) @@ -409,4 +422,10 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame) shared().notifyDone(); } +void TestController::processDidCrash(WKPageRef page) +{ + fputs("#CRASHED - WebProcess\n", stderr); + fflush(stderr); +} + } // namespace WTR diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h index ef41314..fc8bd30 100644 --- a/Tools/WebKitTestRunner/TestController.h +++ b/Tools/WebKitTestRunner/TestController.h @@ -82,6 +82,9 @@ private: static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void*); void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame); + static void processDidCrash(WKPageRef, const void* clientInfo); + void processDidCrash(WKPageRef); + OwnPtr m_currentInvocation; diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm index fee0070..6a4444f 100644 --- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm +++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm @@ -52,8 +52,10 @@ void TestController::initializeTestPluginDirectory() void TestController::platformRunUntil(bool& done, double timeout) { CFAbsoluteTime end = CFAbsoluteTimeGetCurrent() + timeout; + CFDateRef endDate = CFDateCreate(0, end); while (!done && CFAbsoluteTimeGetCurrent() < end) - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; + [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:(NSDate *)endDate]; + CFRelease(endDate); } void TestController::platformInitializeContext() diff --git a/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro b/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro index bcfc159..73ab4b0 100644 --- a/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro +++ b/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro @@ -19,10 +19,10 @@ DEFINES += USE_SYSTEM_MALLOC=1 INCLUDEPATH += \ $$BASEDIR \ $$BASEDIR/../../Source/JavaScriptCore \ - $$BASEDIR/../../WebKit2 \ - $$BASEDIR/../../WebKit2/Shared \ - $$BASEDIR/../../WebKit2/UIProcess/API/qt \ - $$BASEDIR/../../WebKit2/UIProcess/API/cpp/qt \ + $$BASEDIR/../../Source/WebKit2 \ + $$BASEDIR/../../Source/WebKit2/Shared \ + $$BASEDIR/../../Source/WebKit2/UIProcess/API/qt \ + $$BASEDIR/../../Source/WebKit2/UIProcess/API/cpp/qt \ $$GENERATED_SOURCES_DIR INCLUDEPATH += \ @@ -52,7 +52,7 @@ SOURCES = \ $$BASEDIR/TestInvocation.cpp \ PREFIX_HEADER = $$BASEDIR/WebKitTestRunnerPrefix.h -QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" +*-g++*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" linux-* { # From Creator's src/rpath.pri: -- cgit v1.1