diff options
Diffstat (limited to 'WebKitTools')
78 files changed, 2468 insertions, 510 deletions
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog index e7d06cd..553962a 100644 --- a/WebKitTools/ChangeLog +++ b/WebKitTools/ChangeLog @@ -1,6 +1,841 @@ +2010-07-05 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Oliver Hunt. + + The style checker exempts gtk2drawing.h when it should exempt gtkdrawing.h + https://bugs.webkit.org/show_bug.cgi?id=41017 + + * Scripts/webkitpy/style/checker.py: Exempt gtkdrawing.h instead of gtk2drawing.h + * Scripts/webkitpy/style/checker_unittest.py: Update the unit test to reflect the change. + +2010-07-04 MORITA Hajime <morrita@google.com> + + rebaseline-chromium-webkit-tests: UnicodeDecodeError + https://bugs.webkit.org/show_bug.cgi?id=41589 + + * run() method can result non-utf-8 bytes, that causes utf-8 + decoding fail. Fixed to disable decoding. + * Fixed Git.find_checkout_root() to make a test pass. + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/common/checkout/scm_unittest.py: + +2010-07-03 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix DumpRenderTree userStyleSheet handling. + https://bugs.webkit.org/show_bug.cgi?id=41570 + + DumpRenderTree did only set the userStyleSheet at + layoutTestController.setUserStyleSheetEnabled(). + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::reset): + (LayoutTestController::setUserStyleSheetLocation): + (LayoutTestController::setUserStyleSheetEnabled): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + +2010-07-03 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] support dumpChildFrameScrollPositions + + https://bugs.webkit.org/show_bug.cgi?id=41088 + + Unskip: + + http/tests/navigation/anchor-subframeload.html + http/tests/navigation/relativeanchor-frames.html + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::dumpFrameScrollPosition): + (WebCore::DumpRenderTree::dump): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::reset): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController::shouldDumpChildFrameScrollPositions): + (LayoutTestController::dumpChildFrameScrollPositions): + +2010-07-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Rename new scripts so that they don't make autocompleting run-webkit-tests annoying. + + * Scripts/debug-test-runner: Copied from Scripts/debug-webkittestrunner. + * Scripts/debug-webkittestrunner: Removed. + * Scripts/run-test-runner: Copied from Scripts/run-webkittestrunner. + * Scripts/run-webkittestrunner: Removed. + +2010-07-02 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Steve Falkenburg. + + Some http tests fail on Windows with Cygwin 1.7 + https://bugs.webkit.org/show_bug.cgi?id=41537 + + With Cygwin 1.7, the registry key at SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/ + doesn't exist anymore, because the mount points are stored in /etc/fstab. However, we + just need root mount point, which is defined in SOFTWARE\\Cygwin\\setup. + + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + (resolveCygwinPath): Fall back to SOFTWARE\\Cygwin\\setup if + SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/ doesn't work. + +2010-06-23 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Separate DerivedSources per-project + https://bugs.webkit.org/show_bug.cgi?id=41109 + + The JavaScriptCore cppflags used to include the top-level DerivedSources directory + allowing the tools to build as a side-effect. Now that the top-level directory + is no longer in the list of JavaScriptCore includes, include it explicitly. + + * GNUmakefile.am: + +2010-07-01 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Make context menus show up in the right place in QTestBrowser + + Context menus were shown at scene-relative coordinates for + QGraphicsWebView while QMenu expects them to be global. The + change to the QWidget case was to get rid of the mapToGlobal. + + * QtTestBrowser/webview.cpp: + +2010-07-01 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] dump frames in ascending alphabetical order of title + + https://bugs.webkit.org/show_bug.cgi?id=41261 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::dumpHistoryItem): + +2010-07-01 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. + + Fix the GTK+ build after r62278. + + * Scripts/webkitdirs.pm: If the make arguments have already been specified, + let them override the automatic CPU detection for autotools builds. + +2010-07-01 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. + + Fix the Windows build after r62278. + + * Scripts/num-cpus: Use FindBin to add the Scripts directory to the list of library directories. + +2010-07-01 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] build-webkit does not detect the number of CPUs + https://bugs.webkit.org/show_bug.cgi?id=41469 + + Pass the appropriate -j<#> flag to make when building autotools builds. + This causes make to spawn that many number of child processes for doing + parallel builds. + + * Scripts/num-cpus: Use the newly abstracted numberOfCPUs to return the number + of CPUs. This makes the script work across more platforms. + * Scripts/webkitdirs.pm: Create a numberOfCPUs/determineNumberOfCPUs to determine the + number of CPUs across several platforms. Use this new function to determine the appropriate + arguments to pass to make for doing parallel builds with autotools build files. + +2010-07-01 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Laszlo Gombos. + + [Qt][Symbian] Bumped up the maximum heap size to 96MB + + * QtTestBrowser/QtTestBrowser.pro: Removed explicit heap size declaration + and use the one from WebKit.pri instead. + +2010-07-01 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Promote webkit-patch land-safely to main help + https://bugs.webkit.org/show_bug.cgi?id=41446 + + I've been using this command a bunch and recommending it to folks. We + should show it in main help as it's past the experimental phase. + + * Scripts/webkitpy/tool/commands/upload.py: + +2010-06-28 MORITA Hajime <morrita@google.com> + + Reviewed by Shinichiro Hamaji. + + rebaseline-chromium-webkit-tests doesn't do diffs right with a Git checkout of WebKit + https://bugs.webkit.org/show_bug.cgi?id=38775 + + - Introduced SCM.show_head() and SCM.diff_for_file(). + - Replaced direct svn invocations with newly implement SCM methods. + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/common/checkout/scm_unittest.py: + * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py: + +2010-06-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Allow MiniBrowser to open local files + https://bugs.webkit.org/show_bug.cgi?id=41104 + + Wire up the openDocument: message with an NSOpenPanel, so we can open + local files. + + Also change the xib so that the window remembers its size. + + * MiniBrowser/mac/AppDelegate.m: + (-[BrowserAppDelegate frontmostBrowserWindowController]): + (-[BrowserAppDelegate openDocument:]): + (-[BrowserAppDelegate openPanelDidEnd:returnCode:contextInfo:]): + * MiniBrowser/mac/English.lproj/BrowserWindow.xib: + +2010-06-30 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Anders Carlsson. + + Add debug-webkittestrunner and cleanup related scripts. + + * Scripts/debug-webkittestrunner: Added. + * Scripts/run-webkittestrunner: + * Scripts/webkitdirs.pm: + +2010-06-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after recent changes to LayoutTestController. + + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + (LayoutTestController::pageSizeAndMarginsInPixels): + +2010-06-29 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41389 + Make WebKitTestRunner work with more than one test at a time. + + This converts WebKitTestRunner to a similar model as DumpRenderTree, + where there is a single WKView and each test is run it, rather than + the design I was using where each test got its own WKView. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::didRecieveMessage): + (WTR::InjectedBundle::reset): + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): + (WTR::TestController::runTest): + (WTR::TestController::_didRecieveMessageFromInjectedBundle): + (WTR::TestController::didRecieveMessageFromInjectedBundle): + * WebKitTestRunner/TestController.h: + (WTR::TestController::mainWebView): + (WTR::TestController::pageNamespace): + (WTR::TestController::context): + * WebKitTestRunner/TestInvocation.cpp: + (WTR::TestInvocation::TestInvocation): + (WTR::TestInvocation::~TestInvocation): + (WTR::TestInvocation::invoke): + (WTR::TestInvocation::didRecieveMessageFromInjectedBundle): + * WebKitTestRunner/TestInvocation.h: + +2010-06-30 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt][Symbian] Only 10 websites can be loaded consecutively when using QtWebkit 2.0 + https://bugs.webkit.org/show_bug.cgi?id=40446 + + We quickly run out of memory on Symbian when loading web pages. This is + caused by the default heap size, which is not suited for a web browser. + + This change bumps the max heap size to 32MB. + + * QtTestBrowser/QtTestBrowser.pro: + +2010-06-30 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + webkit-patch land allow the user to continue even if the builders are red + https://bugs.webkit.org/show_bug.cgi?id=41395 + + I don't think it's good that we've been teaching people + to always pass --ignore-builders. At least land is now + useable w/o --ignore-builders. + + * Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py: + +2010-06-29 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] support dumpResourceResponseMIMETypes + https://bugs.webkit.org/show_bug.cgi?id=41260 + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::reset): + (LayoutTestController::dumpResourceResponseMIMETypes): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + +2010-06-29 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Resize scene when Qt DRT WebPage receives a geometry change request + https://bugs.webkit.org/show_bug.cgi?id=41173 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::setViewGeometry): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + +2010-06-29 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Deal with postEvent in case of graphics based DRT + https://bugs.webkit.org/show_bug.cgi?id=41174 + + QGraphicsScene does not have a postEvent method, so make scene + send the event, in case of graphics based DRT, and delete it after that. + + * DumpRenderTree/qt/EventSenderQt.cpp: + (EventSender::scheduleAsynchronousClick): + (EventSender::replaySavedEvents): + (EventSender::postEvent): + * DumpRenderTree/qt/EventSenderQt.h: + +2010-06-29 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Make switchFocus() method works with QGraphicsWebView in Qt DRT + https://bugs.webkit.org/show_bug.cgi?id=41172 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::switchFocus): + +2010-06-29 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Make DRT more coherent with other ports to allow reusing more tests + https://bugs.webkit.org/show_bug.cgi?id=40009 + + Make sure "AXRole: ", "AXTitle: " and "AXDescription: " prefixes + are used when returning those values, for coherency with other ports. + + * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp: + (AccessibilityUIElement::role): + (AccessibilityUIElement::title): + (AccessibilityUIElement::description): + +2010-06-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r62106. + http://trac.webkit.org/changeset/62106 + https://bugs.webkit.org/show_bug.cgi?id=41346 + + "Broke editing tests" (Requested by xan_ on #webkit). + + * Scripts/old-run-webkit-tests: + +2010-06-29 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Xan Lopez. + + Ensure DRT loads GAIL (Gtk+ module), for a11y tests + https://bugs.webkit.org/show_bug.cgi?id=38648 + + Add the GTK_MODULES envvar (set to "gail") to the clean + environment when running DRT for the Gtk+ port + + * Scripts/old-run-webkit-tests: + +2010-06-28 Adam Barth <abarth@webkit.org> + + Unreviewed. + + Switch test-html5-parser back to using runner.html. + + * Scripts/test-html5-parser: + +2010-06-28 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Restore webkit-runner.html for use with new tree builder + https://bugs.webkit.org/show_bug.cgi?id=41317 + + For now, we just want to run webkit-runner when we test-html5-parser. + + * Scripts/test-html5-parser: + +2010-06-23 John Gregg <johnnyg@google.com> + + Reviewed by Kent Tamura. + + add ENABLE_DIRECTORY_UPLOAD build support + https://bugs.webkit.org/show_bug.cgi?id=41100 + + * Scripts/build-webkit: + +2010-06-28 Gustavo Noronha Silva <gns@gnome.org> + + Rubber-stamped by Xan Lopez. + + Update webkitdirs's knowledge of our library's name. + + * Scripts/webkitdirs.pm: + +2010-06-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41299 + Build up WebKitTestRunner output in the InjectedBundle + + Simplify WebKitTestRunner by building up the output in the InjectedBundle + and sending it over postMessage when done, instead of using the async + WKPageRenderTreeExternalRepresentation. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::done): + (WTR::InjectedBundle::didRecieveMessage): + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: + (WTR::InjectedBundle::os): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::WKStringToUTF8): + (WTR::InjectedBundlePage::didFinishLoadForFrame): + (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): + * WebKitTestRunner/TestInvocation.cpp: + (WTR::WKStringToUTF8): + (WTR::TestInvocation::TestInvocation): + (WTR::TestInvocation::invoke): + (WTR::TestInvocation::initializeMainWebView): + (WTR::TestInvocation::_didRecieveMessageFromInjectedBundle): + (WTR::TestInvocation::didRecieveMessageFromInjectedBundle): + * WebKitTestRunner/TestInvocation.h: + +2010-06-28 Robert Hogan <robert@webkit.org> + + Unreviewed, rolling out r62021. + http://trac.webkit.org/changeset/62021 + https://bugs.webkit.org/show_bug.cgi?id=41261 + + Broke http/navigation tests among other + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::dumpFramesAsText): + +2010-06-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add run-webkittestrunner to run WebKitTestRunner with the appropriate + environment. + + * Scripts/run-webkittestrunner: Added. + * Scripts/webkitdirs.pm: + +2010-06-28 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] dump frames in ascending alphabetical order of title + + https://bugs.webkit.org/show_bug.cgi?id=41261 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::dumpFramesAsText): + +2010-06-28 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] dump bf history of child windows + + https://bugs.webkit.org/show_bug.cgi?id=41266 + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::DumpRenderTree::dumpBackForwardList): + (WebCore::DumpRenderTree::dump): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + +2010-06-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41288 + WebKit2: Add frame API for InjectedBundle code + + * MiniBrowser/mac/WebBundle/WebBundleMain.m: + (_didClearWindowForFrame): + +2010-06-28 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtTestBrowser does not have a "Load" button ; therefore, unable to load pages on touch only symbian devices (portrait mode). + https://bugs.webkit.org/show_bug.cgi?id=38597 + + Fix behavior so reload button really acts as a load and a reload button. + + * QtTestBrowser/mainwindow.cpp: + (MainWindow::changeLocation): + +2010-06-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Does not compile with -DGSEAL_ENABLE + https://bugs.webkit.org/show_bug.cgi?id=37851 + + Fix build with GSEAL enabled. + + * DumpRenderTree/gtk/EventSender.cpp: + (gtk_widget_get_window): + (prepareMouseButtonEvent): + (mouseMoveToCallback): + (mouseWheelToCallback): + (keyDownCallback): + +2010-06-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add support for GTK+3 + https://bugs.webkit.org/show_bug.cgi?id=41253 + + Adapt build system for 3.x support. + + * GNUmakefile.am: + +2010-06-10 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Simon Hausmann. + + [QT][S60] build-webkit scripts picks wrong make spec for windows build + https://bugs.webkit.org/show_bug.cgi?id=41198 + + Instead of checking for existence of %EPOCROOT% on windows, mandatory use of --symbian flag for symbian builds. + + * Scripts/webkitdirs.pm: + (determineIsSymbian): remove check for %EPOCROOT% as one can build for windows port of QT as well + +2010-06-28 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Make it possible to test the new HTML5 TreeBuilder + https://bugs.webkit.org/show_bug.cgi?id=41276 + + Adam was concerned that someone might make their port + depend on this setting (I guess we had some trouble with that + with the HTML5Parser setting), so I littered the code with warnings. + + test-html5-parser now tests this code path. + + * DumpRenderTree/mac/DumpRenderTree.mm: + (resetDefaultsToConsistentValues): + (initializeGlobalsFromCommandLineOptions): + * Scripts/test-html5-parser: + +2010-06-27 MORITA Hajime <morrita@google.com> + + Unreviewed. + + Some never-called @staticmethods touched self. + Fixed it to replace these self with a class. + + * Scripts/webkitpy/common/checkout/scm.py: + +2010-06-27 MORITA Hajime <morrita@google.com> + + Unreviewed. + + Fixed exception raising syntax that is pointed out at + https://bugs.webkit.org/show_bug.cgi?id=41153 + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/common/checkout/scm_unittest.py: + Removed a bad line that I accidentally checked-in at last revision. + +2010-06-24 MORITA Hajime <morrita@google.com> + + Reviewed by Eric Seidel. + + rebaseline-chromium-webkit-tests should add or remove files to local git repository + https://bugs.webkit.org/show_bug.cgi?id=41153 + + - Added SCM.add() and SCM.remove() + - Replaced "svn add" and "svn remove" + rebaseline_chromium_webkit_tests.py: in with SCM method equivalents. + - add "-U" and "-q" options to rebaseline_chromium_webkit_tests.py + for debugging purpose. + + * Scripts/webkitpy/common/checkout/scm.py: + * Scripts/webkitpy/common/checkout/scm_unittest.py: + * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py: + +2010-06-25 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Improve default value handling for page format properties. + https://bugs.webkit.org/show_bug.cgi?id=41150 + + * DumpRenderTree/LayoutTestController.cpp: + (parsePageNumber): + (parsePageNumberSizeMarings): + (pageSizeAndMarginsInPixelsCallback): + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + (LayoutTestController::pageSizeAndMarginsInPixels): + * DumpRenderTree/mac/LayoutTestControllerMac.mm: + (LayoutTestController::pageSizeAndMarginsInPixels): + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + (LayoutTestController::pageSizeAndMarginsInPixels): + +2010-06-21 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] DRT Support for setCustomPolicyDelegate + + https://bugs.webkit.org/show_bug.cgi?id=39564 + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::setCustomPolicyDelegate): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + +2010-06-26 Robert Hogan <robert@webkit.org> + + Unreviewed, Qt build fix following http://trac.webkit.org/changeset/61879 + + Remove qwebscriptworld.h from LayoutTestControllerQt.cpp - it is no longer + exported. + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + +2010-06-26 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add a build-webkit option for enabling Web Timing support. + https://bugs.webkit.org/show_bug.cgi?id=38924 + + * Scripts/build-webkit: + +2010-06-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtTestBrowser does not have a "Load" button ; therefore, unable to load pages on touch only symbian devices (portrait mode). + https://bugs.webkit.org/show_bug.cgi?id=38597 + + Make the reload button act as a load button as well. + + * QtTestBrowser/mainwindow.cpp: + (MainWindow::buildUI): + (MainWindow::changeLocation): + +2010-06-25 Prasad Tammana <prasadt@chromium.org> + + Reviewed by Dmitry Titov. + + Add empty abortModal() method to all platforms. + https://bugs.webkit.org/show_bug.cgi?id=40864 + + Add an empty abortModal() stub to LayoutTestController on all platforms to get rid of platform specific #ifs in + platform independent LayoutTestController code. Without this change, layout tests using LayoutTestController tests + that use abortModal will become mac specific which is not desirable. + + * DumpRenderTree/LayoutTestController.cpp: + (abortModalCallback): + (LayoutTestController::staticFunctions): + * DumpRenderTree/LayoutTestController.h: + * DumpRenderTree/chromium/LayoutTestController.cpp: + (LayoutTestController::LayoutTestController): + (LayoutTestController::abortModal): + * DumpRenderTree/chromium/LayoutTestController.h: + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: + (LayoutTestController::abortModal): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController::abortModal): + * DumpRenderTree/win/LayoutTestControllerWin.cpp: + (LayoutTestController::abortModal): + * DumpRenderTree/wx/LayoutTestControllerWx.cpp: + (LayoutTestController::abortModal): + +2010-06-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41226 + Flesh out injected bundle code for WebKitTestRunner and add basic LayoutTestController. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Added. + (WTR::InjectedBundle::shared): + (WTR::InjectedBundle::InjectedBundle): + (WTR::InjectedBundle::_didCreatePage): + (WTR::InjectedBundle::_willDestroyPage): + (WTR::InjectedBundle::_didRecieveMessage): + (WTR::InjectedBundle::initialize): + (WTR::InjectedBundle::didCreatePage): + (WTR::InjectedBundle::willDestroyPage): + (WTR::InjectedBundle::didRecieveMessage): + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Added. + (WTR::InjectedBundle::layoutTestController): + * WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp: + (WKBundleInitialize): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Added. + (WTR::InjectedBundlePage::InjectedBundlePage): + (WTR::InjectedBundlePage::~InjectedBundlePage): + (WTR::InjectedBundlePage::_didStartProvisionalLoadForFrame): + (WTR::InjectedBundlePage::_didReceiveServerRedirectForProvisionalLoadForFrame): + (WTR::InjectedBundlePage::_didFailProvisionalLoadWithErrorForFrame): + (WTR::InjectedBundlePage::_didCommitLoadForFrame): + (WTR::InjectedBundlePage::_didFinishLoadForFrame): + (WTR::InjectedBundlePage::_didFailLoadWithErrorForFrame): + (WTR::InjectedBundlePage::_didReceiveTitleForFrame): + (WTR::InjectedBundlePage::_didClearWindowForFrame): + (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): + (WTR::InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame): + (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame): + (WTR::InjectedBundlePage::didCommitLoadForFrame): + (WTR::InjectedBundlePage::didFinishLoadForFrame): + (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame): + (WTR::InjectedBundlePage::didReceiveTitleForFrame): + (WTR::InjectedBundlePage::didClearWindowForFrame): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added. + (WTR::InjectedBundlePage::page): + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: Added. + (WTR::LayoutTestController::create): + (WTR::LayoutTestController::LayoutTestController): + (WTR::LayoutTestController::~LayoutTestController): + (WTR::dumpAsTextCallback): + (WTR::layoutTestControllerObjectFinalize): + (WTR::LayoutTestController::makeWindowObject): + (WTR::LayoutTestController::getJSClass): + (WTR::LayoutTestController::staticFunctions): + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added. + (WTR::LayoutTestController::dumpAsText): + (WTR::LayoutTestController::setDumpAsText): + * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: + +2010-06-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make WebKitTestRunner really work with run-webkit-tests. + + - Add Forwarding headers to allow some cleanup. + + * WebKitTestRunner/ForwardingHeaders: Added. + * WebKitTestRunner/ForwardingHeaders/wtf: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Locker.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Platform.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Threading.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h: Added. + * WebKitTestRunner/ForwardingHeaders/wtf/Vector.h: Added. + * WebKitTestRunner/TestInvocation.cpp: + (WTR::TestInvocation::dump): Dump the right number of #EOFs. + * WebKitTestRunner/TestInvocation.h: + +2010-06-25 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Add support for WebKitTestRunner to old-run-webkit-tests + + - Also adds a script to build WebKitTestRunner for old-run-webkit-tests to use. + + * Scripts/build-webkittestrunner: Added. + * Scripts/old-run-webkit-tests: + +2010-06-25 Adam Barth <abarth@webkit.org> + + Reviewed by David Levin. + + Incremental build failed on Chromium ews + https://bugs.webkit.org/show_bug.cgi?id=41011 + + The division of responsibility between update-webkit --chromium and + build-webkit --chromium is slightly unclear. In this patch, we make + build-webkit --chromium also update DEPS and re-run GYP in case the + developer has changed either since they updated. + + This change is also helpful for the EWS, which wants to update DEPS and + re-run GYP after applying patches, but the EWS doesn't want to run + update-webkit --chromium because it has a dirty working copy. + + * Scripts/webkitdirs.pm: + +2010-06-25 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Support evaluateScriptInIsolatedWorld() + + https://bugs.webkit.org/show_bug.cgi?id=40079 + + Remove evaluateScriptInIsolatedWorld() from QtWebKit API. + Remove QWebScriptWorld from exported headers. + Confine support to DumpRenderTreeSupportQt so that the tests can pass. + + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::reset): + (LayoutTestController::evaluateScriptInIsolatedWorld): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + 2010-06-25 Anders Carlsson <andersca@apple.com> - Reviewed by Dan Bernstein. + Revert accidental part and add a newline. + + * MiniBrowser/mac/AppDelegate.m: + * MiniBrowser/mac/MiniBrowser_Prefix.pch: + +2010-06-25 Anders Carlsson <andersca@apple.com> + + Rubber-stamped by Dan Bernstein. Add a LOG macro that expands to a no-op by default. diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index 02c77a4..edab29e 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -555,10 +555,65 @@ static bool parsePagePropertyParameters(JSContextRef context, int argumentCount, static bool parsePageNumber(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber) { pageNumber = 0; - if (argumentCount != 1) + switch (argumentCount) { + case 1: + pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); + if (*exception) + return false; + // Fall through. + case 0: + return true; + default: + return false; + } +} + +static bool parsePageNumberSizeMarings(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber, int& width, int& height, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) +{ + pageNumber = 0; + width = height = 0; + marginTop = marginRight = marginBottom = marginLeft = 0; + + switch (argumentCount) { + case 7: + marginLeft = static_cast<int>(JSValueToNumber(context, arguments[6], exception)); + if (*exception) + return false; + // Fall through. + case 6: + marginBottom = static_cast<int>(JSValueToNumber(context, arguments[5], exception)); + if (*exception) + return false; + // Fall through. + case 5: + marginRight = static_cast<int>(JSValueToNumber(context, arguments[4], exception)); + if (*exception) + return false; + // Fall through. + case 4: + marginTop = static_cast<int>(JSValueToNumber(context, arguments[3], exception)); + if (*exception) + return false; + // Fall through. + case 3: + height = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); + if (*exception) + return false; + // Fall through. + case 2: + width = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); + if (*exception) + return false; + // Fall through. + case 1: + pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); + if (*exception) + return false; + // Fall through. + return true; + default: return false; - pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); - return !*exception; + } } static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -612,24 +667,16 @@ static JSValueRef isPageBoxVisibleCallback(JSContextRef context, JSObjectRef fun return JSValueMakeBoolean(context, controller->isPageBoxVisible(pageNumber)); } -static JSValueRef pageAreaRectInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int pageNumber = 0; - if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber)) - return JSValueMakeUndefined(context); - - LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(context, controller->pageAreaRectInPixels(pageNumber).get()); -} - -static JSValueRef preferredPageSizeInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static JSValueRef pageSizeAndMarginsInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { int pageNumber = 0; - if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber)) + int width = 0, height = 0; + int marginTop = 0, marginRight = 0, marginBottom = 0, marginLeft = 0; + if (!parsePageNumberSizeMarings(context, argumentCount, arguments, exception, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft)) return JSValueMakeUndefined(context); LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(context, controller->preferredPageSizeInPixels(pageNumber).get()); + return JSValueMakeString(context, controller->pageSizeAndMarginsInPixels(pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft).get()); } static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) @@ -1513,14 +1560,12 @@ static JSValueRef setWebViewEditableCallback(JSContextRef context, JSObjectRef f } -#if PLATFORM(MAC) static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); controller->abortModal(); return JSValueMakeUndefined(context); } -#endif static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { @@ -1648,9 +1693,7 @@ JSStaticValue* LayoutTestController::staticValues() JSStaticFunction* LayoutTestController::staticFunctions() { static JSStaticFunction staticFunctions[] = { -#if PLATFORM(MAC) { "abortModal", abortModalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -#endif { "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserScript", addUserScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserStyleSheet", addUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1699,12 +1742,11 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "pageAreaRectInPixels", pageAreaRectInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "pageSizeAndMarginsInPixels", pageSizeAndMarginsInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "preferredPageSizeInPixels", preferredPageSizeInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 6af2c57..be79473 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -64,9 +64,8 @@ public: void overridePreference(JSStringRef key, JSStringRef value); int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels); JSRetainPtr<JSStringRef> pageProperty(const char* propertyName, int pageNumber) const; + JSRetainPtr<JSStringRef> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const; bool isPageBoxVisible(int pageNumber) const; - JSRetainPtr<JSStringRef> pageAreaRectInPixels(int pageNumber) const; - JSRetainPtr<JSStringRef> preferredPageSizeInPixels(int pageNumber) const; JSStringRef pathToLocalResource(JSContextRef, JSStringRef url); void queueBackNavigation(int howFarBackward); void queueForwardNavigation(int howFarForward); @@ -260,10 +259,7 @@ public: void setWebViewEditable(bool); - -#if PLATFORM(MAC) void abortModal(); -#endif // The following API test functions should probably be moved to platform-specific // unit tests outside of DRT once they exist. diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp index 89e16e0..9ba6421 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -165,6 +165,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission); bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition); bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); + bindMethod("abortModal", &LayoutTestController::abortModal); // The fallback method is called when an unknown method is invoked. bindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -1312,3 +1313,8 @@ void LayoutTestController::setMockGeolocationError(const CppArgumentList& argume return; WebGeolocationServiceMock::setMockGeolocationError(arguments[0].toInt32(), cppVariantToWebString(arguments[1])); } + +void LayoutTestController::abortModal(const CppArgumentList& arguments, CppVariant* result) +{ + result->setNull(); +} diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h index 0e66087..22741d5 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h @@ -286,6 +286,9 @@ public: void setMockGeolocationPosition(const CppArgumentList&, CppVariant*); void setMockGeolocationError(const CppArgumentList&, CppVariant*); + // Empty stub method to keep parity with object model exposed by global LayoutTestController. + void abortModal(const CppArgumentList&, CppVariant*); + public: // The following methods are not exposed to JavaScript. void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); } diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp index 610248a..52f1e7d 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp @@ -586,7 +586,7 @@ WebViewHost* TestShell::createWebView() WebViewHost* TestShell::createNewWindow(const WebURL& url) { WebViewHost* host = new WebViewHost(this); - WebView* view = WebView::create(host); + WebView* view = WebView::create(host, 0); host->setWebWidget(view); resetWebSettings(*view); view->initializeMainFrame(host); diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index d186ffa..fbdbd23 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "AccessibilityUIElement.h" +#include "GOwnPtr.h" #include "GRefPtr.h" #include <JavaScriptCore/JSStringRef.h> @@ -198,7 +199,10 @@ JSStringRef AccessibilityUIElement::role() if (!role) return JSStringCreateWithCharacters(0, 0); - return JSStringCreateWithUTF8CString(atk_role_get_name(role)); + const gchar* roleName = atk_role_get_name(role); + GOwnPtr<gchar> axRole(g_strdup_printf("AXRole: %s", roleName)); + + return JSStringCreateWithUTF8CString(axRole.get()); } JSStringRef AccessibilityUIElement::subrole() @@ -218,7 +222,9 @@ JSStringRef AccessibilityUIElement::title() if (!name) return JSStringCreateWithCharacters(0, 0); - return JSStringCreateWithUTF8CString(name); + GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name)); + + return JSStringCreateWithUTF8CString(axTitle.get()); } JSStringRef AccessibilityUIElement::description() @@ -228,7 +234,9 @@ JSStringRef AccessibilityUIElement::description() if (!description) return JSStringCreateWithCharacters(0, 0); - return JSStringCreateWithUTF8CString(description); + GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description)); + + return JSStringCreateWithUTF8CString(axDesc.get()); } JSStringRef AccessibilityUIElement::stringValue() diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index 7836ff0..4936fe5 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -96,6 +96,14 @@ static void gdk_window_get_root_coords(GdkWindow* window, gint x, gint y, gint* } #endif +#if !GTK_CHECK_VERSION(2, 14, 0) +static GdkWindow* gtk_widget_get_window(GtkWidget* widget) +{ + g_return_val_if_fail(GTK_IS_WIDGET(widget), 0); + return widget->window; +} +#endif + static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { return JSValueMakeBoolean(context, dragMode); @@ -139,13 +147,13 @@ bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber) event->button.button = gdkButtonNumber; event->button.x = lastMousePositionX; event->button.y = lastMousePositionY; - event->button.window = GTK_WIDGET(view)->window; + event->button.window = gtk_widget_get_window(GTK_WIDGET(view)); event->button.device = gdk_device_get_core_pointer(); event->button.state = getStateFlags(); event->button.time = GDK_CURRENT_TIME; int xRoot, yRoot; - gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); + gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); event->button.x_root = xRoot; event->button.y_root = yRoot; @@ -266,12 +274,12 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function event.motion.y = lastMousePositionY; event.motion.time = GDK_CURRENT_TIME; - event.motion.window = GTK_WIDGET(view)->window; + event.motion.window = gtk_widget_get_window(GTK_WIDGET(view)); event.motion.device = gdk_device_get_core_pointer(); event.motion.state = getStateFlags(); int xRoot, yRoot; - gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); + gdk_window_get_root_coords(gtk_widget_get_window(GTK_WIDGET(view)), lastMousePositionX, lastMousePositionY, &xRoot, &yRoot); event.motion.x_root = xRoot; event.motion.y_root = yRoot; @@ -301,7 +309,7 @@ static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef functio event.scroll.x = lastMousePositionX; event.scroll.y = lastMousePositionY; event.scroll.time = GDK_CURRENT_TIME; - event.scroll.window = GTK_WIDGET(view)->window; + event.scroll.window = gtk_widget_get_window(GTK_WIDGET(view)); if (horizontal < 0) event.scroll.direction = GDK_SCROLL_LEFT; @@ -499,7 +507,7 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS memset(&event, 0, sizeof(event)); event.key.keyval = gdkKeySym; event.key.state = state; - event.key.window = GTK_WIDGET(view)->window; + event.key.window = gtk_widget_get_window(GTK_WIDGET(view)); // When synthesizing an event, an invalid hardware_keycode value // can cause it to be badly processed by Gtk+. diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 6f8e637..1814933 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -183,13 +183,7 @@ bool LayoutTestController::isPageBoxVisible(int pageNumber) const return false; } -JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const -{ - // FIXME: implement - return JSRetainPtr<JSStringRef>(); -} - -JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const +JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const { // FIXME: implement return JSRetainPtr<JSStringRef>(); @@ -729,3 +723,7 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) if (!strcmp(editingBehavior, "mac")) g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC, NULL); } + +void LayoutTestController::abortModal() +{ +} diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 51ea004..ce02081 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -137,6 +137,7 @@ static int threaded; static int dumpTree = YES; static int forceComplexText; static int useHTML5Parser = YES; +static int useHTML5TreeBuilder = NO; // Temporary, will be removed. static BOOL printSeparators; static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; @@ -456,6 +457,7 @@ static void resetDefaultsToConsistentValues() [preferences setAcceleratedCompositingEnabled:YES]; [preferences setWebGLEnabled:NO]; [preferences setHTML5ParserEnabled:useHTML5Parser]; + [preferences setHTML5TreeBuilderEnabled:useHTML5TreeBuilder]; // Temporary, will be removed. [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain]; @@ -563,6 +565,7 @@ static void initializeGlobalsFromCommandLineOptions(int argc, const char *argv[] {"threaded", no_argument, &threaded, YES}, {"complex-text", no_argument, &forceComplexText, YES}, {"legacy-parser", no_argument, &useHTML5Parser, NO}, + {"html5-treebuilder", no_argument, &useHTML5TreeBuilder, YES}, {NULL, 0, NULL, 0} }; diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index d0599e0..9b044c3 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -223,15 +223,9 @@ bool LayoutTestController::isPageBoxVisible(int pageNumber) const return [mainFrame isPageBoxVisible:pageNumber]; } -JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const +JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const { - JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageAreaRectInPixels:pageNumber])); - return propertyValue; -} - -JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const -{ - JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame preferredPageSizeInPixels:pageNumber])); + JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageSizeAndMarginsInPixels:pageNumber:width:height:marginTop:marginRight:marginBottom:marginLeft])); return propertyValue; } diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index f5fbb5c..3eb1714 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -353,6 +353,14 @@ bool WebPage::allowGeolocationRequest(QWebFrame *) return m_drt->layoutTestController()->geolocationPermission(); } +void WebPage::setViewGeometry(const QRect& rect) +{ + if (WebViewGraphicsBased* v = qobject_cast<WebViewGraphicsBased*>(view())) + v->scene()->setSceneRect(QRectF(rect)); + else if (QWidget *v = view()) + v->setGeometry(rect); +} + WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent) : m_item(new QGraphicsWebView) { @@ -660,13 +668,35 @@ void DumpRenderTree::hidePage() m_mainView->hide(); } +QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) +{ + if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) + return QString(); + + QString result; + QPoint pos = frame->scrollPosition(); + if (pos.x() > 0 || pos.y() > 0) { + QWebFrame* parent = qobject_cast<QWebFrame *>(frame->parent()); + if (parent) + result.append(QString("frame '%1' ").arg(frame->title())); + result.append(QString("scrolled to %1,%2\n").arg(pos.x()).arg(pos.y())); + } + + if (m_controller->shouldDumpChildFrameScrollPositions()) { + QList<QWebFrame*> children = frame->childFrames(); + for (int i = 0; i < children.size(); ++i) + result += dumpFrameScrollPosition(children.at(i)); + } + return result; +} + QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame) { if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) return QString(); QString result; - QWebFrame *parent = qobject_cast<QWebFrame *>(frame->parent()); + QWebFrame* parent = qobject_cast<QWebFrame*>(frame->parent()); if (parent) { result.append(QLatin1String("\n--------\nFrame: '")); result.append(frame->frameName()); @@ -721,16 +751,16 @@ static QString dumpHistoryItem(const QWebHistoryItem& item, int indent, bool cur result.append(QLatin1String(" **nav target**")); result.append(QLatin1String("\n")); - QList<QWebHistoryItem> children = DumpRenderTreeSupportQt::getChildHistoryItems(item); - for (int i = 0; i < children.size(); ++i) - result += dumpHistoryItem(children.at(i), 12, false); + QMap<QString, QWebHistoryItem> children = DumpRenderTreeSupportQt::getChildHistoryItems(item); + foreach (QWebHistoryItem item, children) + result += dumpHistoryItem(item, 12, false); return result; } -QString DumpRenderTree::dumpBackForwardList() +QString DumpRenderTree::dumpBackForwardList(QWebPage* page) { - QWebHistory* history = webPage()->history(); + QWebHistory* history = page->history(); QString result; result.append(QLatin1String("\n============== Back Forward List ==============\n")); @@ -794,15 +824,21 @@ void DumpRenderTree::dump() QString resultString; if (m_controller->shouldDumpAsText()) resultString = dumpFramesAsText(mainFrame); - else + else { resultString = mainFrame->renderTreeDump(); - + resultString += dumpFrameScrollPosition(mainFrame); + } if (!resultString.isEmpty()) { fprintf(stdout, "Content-Type: text/plain\n"); fprintf(stdout, "%s", resultString.toUtf8().constData()); - if (m_controller->shouldDumpBackForwardList()) - fprintf(stdout, "%s", dumpBackForwardList().toUtf8().constData()); + if (m_controller->shouldDumpBackForwardList()) { + fprintf(stdout, "%s", dumpBackForwardList(webPage()).toUtf8().constData()); + foreach (QObject* widget, windows) { + QWebPage* page = qobject_cast<QWebPage*>(widget->findChild<QWebPage*>()); + fprintf(stdout, "%s", dumpBackForwardList(page).toUtf8().constData()); + } + } } else printf("ERROR: nil result from %s", methodNameStringForFailedTest(m_controller)); @@ -946,7 +982,13 @@ int DumpRenderTree::windowCount() const void DumpRenderTree::switchFocus(bool focused) { QFocusEvent event((focused) ? QEvent::FocusIn : QEvent::FocusOut, Qt::ActiveWindowFocusReason); - QApplication::sendEvent(m_mainView, &event); + if (!isGraphicsBased()) + QApplication::sendEvent(m_mainView, &event); + else { + if (WebViewGraphicsBased* view = qobject_cast<WebViewGraphicsBased*>(m_mainView)) + view->scene()->sendEvent(view->graphicsView(), &event); + } + } void DumpRenderTree::checkPermission(const QUrl& url, NotificationPermission& permission) diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index 2ec972a..f258189 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -133,7 +133,8 @@ private Q_SLOTS: private: QString dumpFramesAsText(QWebFrame* frame); - QString dumpBackForwardList(); + QString dumpBackForwardList(QWebPage* page); + QString dumpFrameScrollPosition(QWebFrame* frame); LayoutTestController *m_controller; bool m_dumpPixels; @@ -198,12 +199,8 @@ protected: bool isTextOutputEnabled() { return m_drt->isTextOutputEnabled(); } private slots: - void setViewGeometry(const QRect &r) - { - QWidget *v = view(); - if (v) - v->setGeometry(r); - } + void setViewGeometry(const QRect&); + private: QWebInspector* m_webInspector; DumpRenderTree *m_drt; diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index 5f340e9..1e495b1 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -368,9 +368,9 @@ void EventSender::contextClick() void EventSender::scheduleAsynchronousClick() { QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonPress, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); - QApplication::postEvent(m_page, event); + postEvent(m_page, event); QMouseEvent* event2 = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, Qt::LeftButton, Qt::RightButton, Qt::NoModifier); - QApplication::postEvent(m_page, event2); + postEvent(m_page, event2); } void EventSender::addTouchPoint(int x, int y) @@ -552,7 +552,7 @@ void EventSender::replaySavedEvents(bool flush) // First send all the events that are ready to be sent while (!eventQueue[startOfQueue].m_delay && startOfQueue < endOfQueue) { QEvent* ev = eventQueue[startOfQueue++].m_event; - QApplication::postEvent(m_page->view(), ev); // ev deleted by the system + postEvent(m_page->view(), ev); } if (startOfQueue == endOfQueue) { // Reset the queue @@ -643,3 +643,14 @@ void EventSender::sendEvent(QObject* receiver, QEvent* event) else QApplication::sendEvent(receiver, event); } + +void EventSender::postEvent(QObject* receiver, QEvent* event) +{ + // QGraphicsScene does not have a postEvent method, so send the event in this case + // and delete it after that. + if (WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(receiver)) { + view->scene()->sendEvent(view->graphicsView(), event); + delete event; + } else + QApplication::postEvent(receiver, event); // event deleted by the system +} diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h index c2ff746..a17e938 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h @@ -90,6 +90,7 @@ private: QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton, Qt::MouseButtons, Qt::KeyboardModifiers); QGraphicsSceneWheelEvent* createGraphicsSceneWheelEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, int delta, Qt::KeyboardModifiers, Qt::Orientation); void sendEvent(QObject* receiver, QEvent* event); + void postEvent(QObject* receiver, QEvent* event); private: void sendTouchEvent(QEvent::Type); diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 3cced7d..008190f 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -35,7 +35,6 @@ #include "WorkQueueItemQt.h" #include <QDir> #include <QLocale> -#include <qwebscriptworld.h> #include <qwebsettings.h> LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt) @@ -54,6 +53,7 @@ void LayoutTestController::reset() m_textDump = false; m_dumpBackForwardList = false; m_dumpChildrenAsText = false; + m_dumpChildFrameScrollPositions = false; m_canOpenWindows = false; m_waitForDone = false; m_dumpTitleChanges = false; @@ -65,14 +65,18 @@ void LayoutTestController::reset() m_handleErrorPages = false; m_webHistory = 0; m_globalFlag = false; + m_userStyleSheetEnabled = false; m_desktopNotificationAllowedOrigins.clear(); DumpRenderTreeSupportQt::dumpEditingCallbacks(false); DumpRenderTreeSupportQt::dumpFrameLoader(false); DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false); + DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(false); DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(false); DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(false); DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(QStringList()); + DumpRenderTreeSupportQt::clearScriptWorlds(); + DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false); setIconDatabaseEnabled(false); emit hidePage(); @@ -225,6 +229,11 @@ void LayoutTestController::dumpResourceLoadCallbacks() DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(true); } +void LayoutTestController::dumpResourceResponseMIMETypes() +{ + DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(true); +} + void LayoutTestController::setWillSendRequestReturnsNullOnRedirect(bool enabled) { DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(enabled); @@ -490,6 +499,11 @@ void LayoutTestController::removeOriginAccessWhitelistEntry(const QString& sourc DumpRenderTreeSupportQt::removeWhiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); } +void LayoutTestController::setCustomPolicyDelegate(bool enabled, bool permissive) +{ + DumpRenderTreeSupportQt::setCustomPolicyDelegate(enabled, permissive); +} + void LayoutTestController::waitForPolicyDelegate() { m_waitForPolicy = true; @@ -524,6 +538,9 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian void LayoutTestController::setUserStyleSheetLocation(const QString& url) { m_userStyleSheetLocation = QUrl(url); + + if (m_userStyleSheetEnabled) + setUserStyleSheetEnabled(true); } void LayoutTestController::setCaretBrowsingEnabled(bool value) @@ -533,6 +550,8 @@ void LayoutTestController::setCaretBrowsingEnabled(bool value) void LayoutTestController::setUserStyleSheetEnabled(bool enabled) { + m_userStyleSheetEnabled = enabled; + if (enabled) m_drt->webPage()->settings()->setUserStyleSheetUrl(m_userStyleSheetLocation); else @@ -665,16 +684,7 @@ void LayoutTestController::setMockGeolocationPosition(double latitude, double lo void LayoutTestController::evaluateScriptInIsolatedWorld(int worldID, const QString& script) { - QWebScriptWorld* scriptWorld; - if (!worldID) { - scriptWorld = new QWebScriptWorld(); - } else if (!m_worldMap.contains(worldID)) { - scriptWorld = new QWebScriptWorld(); - m_worldMap.insert(worldID, scriptWorld); - } else - scriptWorld = m_worldMap.value(worldID); - - m_drt->webPage()->mainFrame()->evaluateScriptInIsolatedWorld(scriptWorld, script); + DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->webPage()->mainFrame(), worldID, script); } const unsigned LayoutTestController::maxViewWidth = 800; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index b56f1c9..ed1a232 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -62,6 +62,7 @@ public: bool shouldDumpAsText() const { return m_textDump; } bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; } bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; } + bool shouldDumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; } bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; } bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } bool shouldWaitUntilDone() const { return m_waitForDone; } @@ -88,6 +89,7 @@ public slots: void maybeDump(bool ok); void dumpAsText() { m_textDump = true; } void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } + void dumpChildFrameScrollPositions() { m_dumpChildFrameScrollPositions = true; } void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; } void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; } void setCanOpenWindows() { m_canOpenWindows = true; } @@ -103,6 +105,7 @@ public slots: void dumpEditingCallbacks(); void dumpFrameLoadCallbacks(); void dumpResourceLoadCallbacks(); + void dumpResourceResponseMIMETypes(); void setWillSendRequestReturnsNullOnRedirect(bool enabled); void setWillSendRequestReturnsNull(bool enabled); void setWillSendRequestClearHeader(const QStringList& headers); @@ -171,7 +174,9 @@ public slots: void clearAllDatabases(); void setIconDatabaseEnabled(bool enable); + void setCustomPolicyDelegate(bool enabled, bool permissive = true); void waitForPolicyDelegate(); + void overridePreference(const QString& name, const QVariant& value); void setUserStyleSheetLocation(const QString& url); void setUserStyleSheetEnabled(bool enabled); @@ -194,6 +199,9 @@ public slots: bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; } bool geolocationPermission() const { return m_geolocationPermission; } + // Empty stub method to keep parity with object model exposed by global LayoutTestController. + void abortModal() {} + /* Policy values: 'on', 'auto' or 'off'. Orientation values: 'vertical' or 'horizontal'. @@ -218,6 +226,7 @@ private: bool m_textDump; bool m_dumpBackForwardList; bool m_dumpChildrenAsText; + bool m_dumpChildFrameScrollPositions; bool m_canOpenWindows; bool m_waitForDone; bool m_dumpTitleChanges; @@ -227,10 +236,10 @@ private: bool m_handleErrorPages; bool m_loadFinished; bool m_globalFlag; + bool m_userStyleSheetEnabled; bool m_isGeolocationPermissionSet; bool m_geolocationPermission; - QMap<int, QWebScriptWorld*> m_worldMap; QUrl m_userStyleSheetLocation; QBasicTimer m_timeoutTimer; QWebFrame* m_topLoadingFrame; diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index e0d5731..df96328 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -617,8 +617,14 @@ static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath) DWORD keyType; DWORD result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), &keyType, &rootPath, &rootPathSize); - if (result != ERROR_SUCCESS || keyType != REG_SZ) - return false; + if (result != ERROR_SUCCESS || keyType != REG_SZ) { + // Cygwin 1.7 doesn't store Cygwin's root as a mount point anymore, because mount points are now stored in /etc/fstab. + // However, /etc/fstab doesn't contain any information about where / is located as a Windows path, so we need to use Cygwin's + // new registry key that has the root. + result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygwin\\setup"), TEXT("rootdir"), &keyType, &rootPath, &rootPathSize); + if (result != ERROR_SUCCESS || keyType != REG_SZ) + return false; + } windowsPath = wstring(rootPath, rootPathSize); @@ -1254,13 +1260,7 @@ bool LayoutTestController::isPageBoxVisible(int pageNumber) const return false; } -JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const -{ - // FIXME: implement - return JSRetainPtr<JSStringRef>(); -} - -JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const +JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const { // FIXME: implement return JSRetainPtr<JSStringRef>(); @@ -1308,3 +1308,7 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) if (behaviorString == "win") preferences->setEditingBehavior(WebKitEditingWinBehavior); } + +void LayoutTestController::abortModal() +{ +} diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 90ddea8..511eb81 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -452,6 +452,10 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) // FIXME: Implement } +void LayoutTestController::abortModal() +{ +} + JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const { @@ -463,14 +467,9 @@ bool LayoutTestController::isPageBoxVisible(int pageNumber) const return true; } -JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const +JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const { // FIXME: Implement return 0; } -JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const -{ - // FIXME: Implement - return 0; -} diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am index 4425196..473b510 100644 --- a/WebKitTools/GNUmakefile.am +++ b/WebKitTools/GNUmakefile.am @@ -6,6 +6,7 @@ noinst_PROGRAMS += \ Programs_GtkLauncher_CPPFLAGS = \ -I$(srcdir)/WebKit/gtk \ -I$(top_builddir)/WebKit/gtk \ + -I$(top_builddir)/DerivedSources \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -20,7 +21,7 @@ Programs_GtkLauncher_CFLAGS = \ $(LIBSOUP_CFLAGS) Programs_GtkLauncher_LDADD = \ - libwebkit-1.0.la \ + libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ $(GTK_LIBS) \ $(GLIB_LIBS) @@ -34,6 +35,7 @@ dumprendertree_cppflags := \ -I$(srcdir)/WebKitTools/DumpRenderTree/gtk \ -I$(srcdir)/WebKit/gtk \ -I$(top_builddir)/WebKit/gtk \ + -I$(top_builddir)/DerivedSources \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -81,7 +83,7 @@ Programs_DumpRenderTree_CFLAGS = \ $(LIBSOUP_CFLAGS) Programs_DumpRenderTree_LDADD = \ - libwebkit-1.0.la \ + libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ libJavaScriptCore.la \ $(GLOBALDEPS_LIBS) \ $(CAIRO_LIBS) \ diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m index efc9b37..2805157 100644 --- a/WebKitTools/MiniBrowser/mac/AppDelegate.m +++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m @@ -31,7 +31,7 @@ #import <WebKit2/WKStringCF.h> #import <WebKit2/WKContextPrivate.h> -static NSString *defaultURL = @"file:///Users/andersca/Desktop/t.html"; +static NSString *defaultURL = @"http://www.webkit.org/"; @implementation BrowserAppDelegate @@ -153,4 +153,44 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess processPageNamespace = 0; } +- (BrowserWindowController *)frontmostBrowserWindowController +{ + NSArray* windows = [NSApp windows]; + for (NSWindow* window in windows) { + id delegate = [window delegate]; + if ([delegate isKindOfClass:[BrowserWindowController class]]) + return (BrowserWindowController *)delegate; + } + + return 0; +} + +- (IBAction)openDocument:(id)sender +{ + NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain]; + [openPanel beginForDirectory:nil + file:nil + types:nil + modelessDelegate:self + didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) + contextInfo:0]; +} + +- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + [sheet autorelease]; + if (returnCode != NSOKButton || ![[sheet filenames] count]) + return; + + NSString* filePath = [[sheet filenames] objectAtIndex:0]; + + BrowserWindowController *controller = [self frontmostBrowserWindowController]; + if (!controller) { + controller = [[BrowserWindowController alloc] initWithPageNamespace:[self getCurrentPageNamespace]]; + [[controller window] makeKeyAndOrderFront:self]; + } + + [controller loadURLString:[[NSURL fileURLWithPath:filePath] absoluteString]]; +} + @end diff --git a/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib b/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib index dbd4344..64c4999 100644 --- a/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib +++ b/WebKitTools/MiniBrowser/mac/English.lproj/BrowserWindow.xib @@ -2,17 +2,16 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> - <string key="IBDocument.SystemVersion">10D573</string> - <string key="IBDocument.InterfaceBuilderVersion">740</string> + <string key="IBDocument.SystemVersion">10F569</string> + <string key="IBDocument.InterfaceBuilderVersion">800</string> <string key="IBDocument.AppKitVersion">1038.29</string> - <string key="IBDocument.HIToolboxVersion">460.00</string> + <string key="IBDocument.HIToolboxVersion">461.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">740</string> + <string key="NS.object.0">800</string> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -46,7 +45,7 @@ <string key="NSWindowTitle">Window</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="1006"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -57,6 +56,7 @@ <int key="NSvFlags">274</int> <string key="NSFrameSize">{776, 608}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> </object> @@ -65,6 +65,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{45, 618}, {699, 22}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1023147716"> @@ -104,6 +105,7 @@ <object class="NSPSMatrix" key="NSDrawMatrix"/> <string key="NSFrame">{{752, 621}, {16, 16}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <int key="NSpiFlags">28936</int> <double key="NSMaxValue">1</double> </object> @@ -112,6 +114,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{8, 616}, {29, 25}}</string> <reference key="NSSuperview" ref="1006"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="366486485"> <int key="NSCellFlags">-2080244224</int> @@ -134,10 +137,12 @@ </object> <string key="NSFrameSize">{776, 658}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSFrameAutosaveName">Main Window</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> @@ -368,12 +373,52 @@ <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>fetch:</string> + <string>forceRepaint:</string> <string>reload:</string> + <string>removeReinsertWebView:</string> + <string>showHideWebView:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>fetch:</string> + <string>forceRepaint:</string> + <string>reload:</string> + <string>removeReinsertWebView:</string> + <string>showHideWebView:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">fetch:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">forceRepaint:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">reload:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">removeReinsertWebView:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">showHideWebView:</string> + <string key="candidateClassName">id</string> + </object> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -393,6 +438,35 @@ <string>NSTextField</string> </object> </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>containerView</string> + <string>progressIndicator</string> + <string>reloadButton</string> + <string>urlText</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBToOneOutletInfo"> + <string key="name">containerView</string> + <string key="candidateClassName">NSView</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">progressIndicator</string> + <string key="candidateClassName">NSProgressIndicator</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">reloadButton</string> + <string key="candidateClassName">NSButton</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">urlText</string> + <string key="candidateClassName">NSTextField</string> + </object> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">mac/BrowserWindowController.h</string> @@ -846,6 +920,13 @@ <string key="NS.key.0">showWindow:</string> <string key="NS.object.0">id</string> </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <string key="NS.key.0">showWindow:</string> + <object class="IBActionInfo" key="NS.object.0"> + <string key="name">showWindow:</string> + <string key="candidateClassName">id</string> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> @@ -854,6 +935,7 @@ </object> </object> <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <integer value="1060" key="NS.object.0"/> @@ -865,5 +947,9 @@ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../../MiniBrowser.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> + <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> + <string key="NS.key.0">NSRefreshTemplate</string> + <string key="NS.object.0">{10, 12}</string> + </object> </data> </archive> diff --git a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch index faa14fc..cb8ceae 100644 --- a/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch +++ b/WebKitTools/MiniBrowser/mac/MiniBrowser_Prefix.pch @@ -33,4 +33,4 @@ #define LOG NSLog #else #define LOG(...) ((void)0) -#endif
\ No newline at end of file +#endif diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m index f52c98e..d7f2e36 100644 --- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m +++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m @@ -25,6 +25,7 @@ #include <Cocoa/Cocoa.h> #include <WebKit2/WKBundle.h> +#include <WebKit2/WKBundleFrame.h> #include <WebKit2/WKBundleInitialize.h> #include <WebKit2/WKBundlePage.h> #include <WebKit2/WKString.h> @@ -66,7 +67,7 @@ void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleF void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) { - CFURLRef cfURL = WKURLCopyCFURL(0, WKBundlePageGetMainFrameURL(page)); + CFURLRef cfURL = WKURLCopyCFURL(0, WKBundleFrameGetURL(WKBundlePageGetMainFrame(page))); LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]); CFRelease(cfURL); diff --git a/WebKitTools/QtTestBrowser/mainwindow.cpp b/WebKitTools/QtTestBrowser/mainwindow.cpp index 941ef79..c5cf15c 100644 --- a/WebKitTools/QtTestBrowser/mainwindow.cpp +++ b/WebKitTools/QtTestBrowser/mainwindow.cpp @@ -51,9 +51,12 @@ void MainWindow::buildUI() #if defined(Q_WS_S60) bar->setIconSize(QSize(16, 16)); #endif + QAction* reloadAction = page()->action(QWebPage::Reload); + connect(reloadAction, SIGNAL(triggered()), this, SLOT(changeLocation())); + bar->addAction(page()->action(QWebPage::Back)); bar->addAction(page()->action(QWebPage::Forward)); - bar->addAction(page()->action(QWebPage::Reload)); + bar->addAction(reloadAction); bar->addAction(page()->action(QWebPage::Stop)); urlEdit = new LocationEdit(this); @@ -142,6 +145,13 @@ void MainWindow::load(const QUrl& url) void MainWindow::changeLocation() { QString string = urlEdit->text(); + QUrl mainFrameURL = page()->mainFrame()->url(); + + if (mainFrameURL.isValid() && string == mainFrameURL.toString()) { + page()->triggerAction(QWebPage::Reload); + return; + } + load(string); } diff --git a/WebKitTools/QtTestBrowser/webview.cpp b/WebKitTools/QtTestBrowser/webview.cpp index 1467cf8..d06493e 100644 --- a/WebKitTools/QtTestBrowser/webview.cpp +++ b/WebKitTools/QtTestBrowser/webview.cpp @@ -192,14 +192,14 @@ void WebViewTraditional::mousePressEvent(QMouseEvent* event) void GraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) { QMenu* menu = createContextMenu(page(), event->pos().toPoint()); - menu->exec(mapToScene(event->pos()).toPoint()); + menu->exec(event->screenPos()); delete menu; } void WebViewTraditional::contextMenuEvent(QContextMenuEvent* event) { QMenu* menu = createContextMenu(page(), event->pos()); - menu->exec(mapToGlobal(event->pos())); + menu->exec(event->globalPos()); delete menu; } diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit index 88765e8..2934b21 100755 --- a/WebKitTools/Scripts/build-webkit +++ b/WebKitTools/Scripts/build-webkit @@ -59,9 +59,9 @@ my ($threeDCanvasSupport, $threeDRenderingSupport, $channelMessagingSupport, $cl $domStorageSupport, $eventsourceSupport, $filtersSupport, $geolocationSupport, $iconDatabaseSupport, $imageResizerSupport, $indexedDatabaseSupport, $inputSpeechSupport, $javaScriptDebuggerSupport, $mathmlSupport, $offlineWebApplicationSupport, $rubySupport, $systemMallocSupport, $sandboxSupport, $sharedWorkersSupport, $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport, - $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport, + $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $webTimingSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport, $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport, - $fileReaderSupport, $fileWriterSupport); + $fileReaderSupport, $fileWriterSupport, $directoryUploadSupport); my @features = ( { option => "3d-canvas", desc => "Toggle 3D canvas support", @@ -91,6 +91,9 @@ my @features = ( { option => "datalist", desc => "Toggle HTML5 datalist support", define => "ENABLE_DATALIST", default => 1, value => \$datalistSupport }, + { option => "directory-upload", desc => "Toogle Directory upload support", + define => "ENABLE_DIRECTORY_UPLOAD", default => 0, value => \$directoryUploadSupport }, + { option => "dom-storage", desc => "Toggle DOM Storage Support", define => "ENABLE_DOM_STORAGE", default => 1, value => \$domStorageSupport }, @@ -169,6 +172,9 @@ my @features = ( { option => "web-sockets", desc => "Toggle Web Sockets support", define => "ENABLE_WEB_SOCKETS", default => 1, value=> \$webSocketsSupport }, + { option => "web-timing", desc => "Toggle Web Timing support", + define => "ENABLE_WEB_TIMING", default => 0, value=> \$webTimingSupport }, + { option => "wml", desc => "Toggle WML support", define => "ENABLE_WML", default => 0, value => \$wmlSupport }, diff --git a/WebKitTools/Scripts/build-webkittestrunner b/WebKitTools/Scripts/build-webkittestrunner new file mode 100755 index 0000000..bb059e1 --- /dev/null +++ b/WebKitTools/Scripts/build-webkittestrunner @@ -0,0 +1,68 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2010 Apple 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: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +use strict; +use File::Basename; +use FindBin; +use Getopt::Long qw(:config pass_through); +use lib $FindBin::Bin; +use webkitdirs; +use POSIX; + +my $showHelp = 0; +my $clean = 0; + +my $programName = basename($0); +my $usage = <<EOF; +Usage: $programName [options] [options to pass to build system] + --help Show this help message + --clean Clean up the build directory +EOF + +GetOptions( + 'help' => \$showHelp, + 'clean' => \$clean, +); + +if ($showHelp) { + print STDERR $usage; + exit 1; +} + +checkRequiredSystemConfig(); +setConfiguration(); +chdirWebKit(); + +# Build +chdir "WebKitTools/WebKitTestRunner" or die; + +my $result; +if (isAppleMacWebKit()) { + $result = buildXCodeProject("WebKitTestRunner", $clean, XcodeOptions(), @ARGV); +} else { + die "WebKitTestRunner is not supported on this platform.\n"; +} + +exit exitStatus($result); diff --git a/WebKitTools/Scripts/debug-test-runner b/WebKitTools/Scripts/debug-test-runner new file mode 100755 index 0000000..5a9b7f9 --- /dev/null +++ b/WebKitTools/Scripts/debug-test-runner @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2010 Apple 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: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +# Simplified "debug" script for debugging the WebKitTestRunner. + +use strict; +use FindBin; +use lib $FindBin::Bin; +use webkitdirs; + +setConfiguration(); + +exit exitStatus(debugWebKitTestRunner()); diff --git a/WebKitTools/Scripts/num-cpus b/WebKitTools/Scripts/num-cpus index ede9995..8a8c97f 100755 --- a/WebKitTools/Scripts/num-cpus +++ b/WebKitTools/Scripts/num-cpus @@ -1,3 +1,6 @@ -#!/bin/bash -# Assumes cygwin. -ls /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor | wc -w +#!/usr/bin/perl -w +use strict; +use FindBin; +use lib $FindBin::Bin; +use webkitdirs; +print numberOfCPUs() . "\n"; diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests index a25a24d..0e705a9 100755 --- a/WebKitTools/Scripts/old-run-webkit-tests +++ b/WebKitTools/Scripts/old-run-webkit-tests @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) # Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com) # Copyright (C) 2007 Eric Seidel <eric@webkit.org> @@ -165,6 +165,7 @@ my $useRemoteLinksToTests = 0; my $useValgrind = 0; my $verbose = 0; my $shouldWaitForHTTPD = 0; +my $useWebKitTestRunner = 0; my @leaksFilenames; @@ -279,6 +280,7 @@ Usage: $programName [options] [testdir|testpath ...] -v|--verbose More verbose output (overrides --quiet) -m|--merge-leak-depth arg Merges leak callStacks and prints the number of unique leaks beneath a callstack depth of arg. Defaults to 5. --use-remote-links-to-tests Link to test files within the SVN repository in the results. + --webkit-test-runner Use WebKitTestRunner rather than DumpRenderTree. EOF setConfiguration(); @@ -321,6 +323,7 @@ my $getOptionsResult = GetOptions( 'use-remote-links-to-tests' => \$useRemoteLinksToTests, 'valgrind' => \$useValgrind, 'verbose|v' => \$verbose, + 'webkit-test-runner' => \$useWebKitTestRunner, ); if (!$getOptionsResult || $showHelp) { @@ -354,8 +357,11 @@ $productDir .= "/Programs" if isGtk(); chdirWebKit(); +my $dumpToolName = $useWebKitTestRunner ? "WebKitTestRunner" : "DumpRenderTree"; + if (!defined($root)) { - print STDERR "Running build-dumprendertree\n"; + my $dumpToolBuildScript = "build-" . lc($dumpToolName); + print STDERR "Running $dumpToolBuildScript\n"; local *DEVNULL; my ($childIn, $childOut, $childErr); @@ -370,7 +376,7 @@ if (!defined($root)) { } my @args = argumentsForConfiguration(); - my $buildProcess = open3($childIn, $childOut, $childErr, "WebKitTools/Scripts/build-dumprendertree", @args) or die "Failed to run build-dumprendertree"; + my $buildProcess = open3($childIn, $childOut, $childErr, "WebKitTools/Scripts/$dumpToolBuildScript", @args) or die "Failed to run build-dumprendertree"; close($childIn); waitpid $buildProcess, 0; my $buildResult = $?; @@ -380,12 +386,11 @@ if (!defined($root)) { close DEVNULL if ($quiet); if ($buildResult) { - print STDERR "Compiling DumpRenderTree failed!\n"; + print STDERR "Compiling $dumpToolName failed!\n"; exit exitStatus($buildResult); } } -my $dumpToolName = "DumpRenderTree"; $dumpToolName .= "_debug" if isCygwin() && configurationForVisualStudio() !~ /^Release|Debug_Internal$/; my $dumpTool = "$productDir/$dumpToolName"; die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool; diff --git a/WebKitTools/Scripts/run-test-runner b/WebKitTools/Scripts/run-test-runner new file mode 100755 index 0000000..98fa3b6 --- /dev/null +++ b/WebKitTools/Scripts/run-test-runner @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2010 Apple 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: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +# Simplified "run" script for launching the WebKit2 WebKitTestRunner. + +use strict; +use FindBin; +use lib $FindBin::Bin; +use webkitdirs; + +setConfiguration(); + +exit exitStatus(runWebKitTestRunner()); diff --git a/WebKitTools/Scripts/test-html5-parser b/WebKitTools/Scripts/test-html5-parser index 5b935b8..eb9bab4 100755 --- a/WebKitTools/Scripts/test-html5-parser +++ b/WebKitTools/Scripts/test-html5-parser @@ -60,7 +60,6 @@ system("WebKitTools/Scripts/build-dumprendertree", @args) == 0 or die "Failed to my @tests = ( "html5lib/runner", - "html5lib/webkit-resumer", ); foreach my $test (@tests) { @@ -69,7 +68,7 @@ foreach my $test (@tests) { my $testPath = "LayoutTests/$test.html"; my $expectedPath = "LayoutTests/$test-expected-html5.txt"; my $actualPath = "LayoutTests/$test-actual-html5.txt"; - my $command = "DYLD_FRAMEWORK_PATH=$productDir $dumpTool --html5-parser $testPath"; + my $command = "DYLD_FRAMEWORK_PATH=$productDir $dumpTool --html5-treebuilder $testPath"; print $command, "\n"; my $output = `$command`; writeToFile($actualPath, $output); diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index 46d2cbf..9f54c3e 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. +# Copyright (C) 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,6 +50,7 @@ BEGIN { our @EXPORT_OK; my $architecture; +my $numberOfCPUs; my $baseProductDir; my @baseProductDirOption; my $configuration; @@ -229,6 +230,28 @@ sub determineArchitecture } } +sub determineNumberOfCPUs +{ + return if defined $numberOfCPUs; + if (isLinux()) { + # First try the nproc utility, if it exists. If we get no + # results fall back to just interpretting /proc directly. + $numberOfCPUs = `nproc 2> /dev/null`; + if ($numberOfCPUs eq "") { + $numberOfCPUs = (grep /processor/, `cat /proc/cpuinfo`); + } + } elsif (isWindows() || isCygwin()) { + if (defined($ENV{NUMBER_OF_PROCESSORS})) { + $numberOfCPUs = $ENV{NUMBER_OF_PROCESSORS}; + } else { + # Assumes cygwin + $numberOfCPUs = `ls /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor | wc -w`; + } + } elsif (isDarwin()) { + $numberOfCPUs = `sysctl -n hw.ncpu`; + } +} + sub jscPath($) { my ($productDir) = @_; @@ -468,6 +491,12 @@ sub architecture() return $architecture; } +sub numberOfCPUs() +{ + determineNumberOfCPUs(); + return $numberOfCPUs; +} + sub setArchitecture { if (my $arch = shift @_) { @@ -566,7 +595,7 @@ sub builtDylibPathForName return "$configurationProductDir/libwxwebkit.dylib"; } if (isGtk()) { - return "$configurationProductDir/$libraryName/../.libs/libwebkit-1.0.so"; + return "$configurationProductDir/$libraryName/../.libs/libwebkitgtk-1.0.so"; } if (isEfl()) { return "$configurationProductDir/$libraryName/../.libs/libewebkit.so"; @@ -687,8 +716,6 @@ sub determineIsSymbian() $isSymbian = 1; return; } - - $isSymbian = defined($ENV{'EPOCROOT'}); } sub determineIsEfl() @@ -1260,6 +1287,12 @@ sub buildAutotoolsProject($@) } } + # Automatically determine the number of CPUs for make only + # if make arguments haven't already been specified. + if ($makeArgs eq "") { + $makeArgs = "-j" . numberOfCPUs(); + } + $prefix = $ENV{"WebKitInstallationPrefix"} if !defined($prefix); push @buildArgs, "--prefix=" . $prefix if defined($prefix); @@ -1443,7 +1476,7 @@ sub buildChromiumMakefile($$) return system qw(rm -rf out); } my $config = configuration(); - my $numCpus = (grep /processor/, `cat /proc/cpuinfo`) || 1; + my $numCpus = numberOfCPUs(); my @command = ("make", "-fMakefile.chromium", "-j$numCpus", "BUILDTYPE=$config", $target); print join(" ", @command) . "\n"; return system @command; @@ -1493,6 +1526,9 @@ sub buildChromium($@) { my ($clean, @options) = @_; + # We might need to update DEPS or re-run GYP if things have changed. + system("perl", "WebKitTools/Scripts/update-webkit-chromium") == 0 or die $!; + my $result = 1; if (isDarwin()) { # Mac build - builds the root xcode project. @@ -1610,4 +1646,43 @@ sub debugMiniBrowser return 1; } +sub runWebKitTestRunner +{ + if (isAppleMacWebKit()) { + my $productDir = productDir(); + print "Starting WebKitTestRunner with DYLD_FRAMEWORK_PATH set to point to $productDir.\n"; + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + my $webKitTestRunnerPath = "$productDir/WebKitTestRunner"; + if (!isTiger() && architecture()) { + return system "arch", "-" . architecture(), $webKitTestRunnerPath, @ARGV; + } else { + return system $webKitTestRunnerPath, @ARGV; + } + } + + return 1; +} + +sub debugWebKitTestRunner +{ + if (isAppleMacWebKit()) { + my $gdbPath = "/usr/bin/gdb"; + die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath; + + my $productDir = productDir(); + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = 'YES'; + + my $webKitTestRunnerPath = "$productDir/WebKitTestRunner"; + + print "Starting WebKitTestRunner under gdb with DYLD_FRAMEWORK_PATH set to point to $productDir.\n"; + my @architectureFlags = ("-arch", architecture()) if !isTiger(); + exec $gdbPath, @architectureFlags, $webKitTestRunnerPath or die; + return; + } + + return 1; +} + 1; diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py index fc4c6fd..d7c621c 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py @@ -31,6 +31,8 @@ import os import re +import sys +import shutil from webkitpy.common.system.executive import Executive, run_command, ScriptError from webkitpy.common.system.user import User @@ -166,82 +168,95 @@ class SCM: return match.group('svn_revision') @staticmethod + def _subclass_must_implement(): + raise NotImplementedError("subclasses must implement") + + @staticmethod def in_working_directory(path): - raise NotImplementedError, "subclasses must implement" + SCM._subclass_must_implement() @staticmethod def find_checkout_root(path): - raise NotImplementedError, "subclasses must implement" + SCM._subclass_must_implement() @staticmethod def commit_success_regexp(): - raise NotImplementedError, "subclasses must implement" + SCM._subclass_must_implement() def working_directory_is_clean(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def clean_working_directory(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def status_command(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() - def add(self, path): - raise NotImplementedError, "subclasses must implement" + def add(self, path, return_exit_code=False): + self._subclass_must_implement() + + def delete(self, path): + self._subclass_must_implement() def changed_files(self, git_commit=None, squash=None): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def changed_files_for_revision(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def added_files(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def conflicted_files(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def display_name(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def create_patch(self, git_commit=None, squash=None): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def committer_email_for_revision(self, revision): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def contents_at_revision(self, path, revision): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def diff_for_revision(self, revision): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() + + def diff_for_file(self, path, log=None): + self._subclass_must_implement() + + def show_head(self, path): + self._subclass_must_implement() def apply_reverse_diff(self, revision): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def revert_files(self, file_paths): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def should_squash(self, squash): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def commit_with_message(self, message, username=None, git_commit=None, squash=None): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def svn_commit_log(self, svn_revision): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() def last_svn_commit_log(self): - raise NotImplementedError, "subclasses must implement" + self._subclass_must_implement() # Subclasses must indicate if they support local commits, # but the SCM baseclass will only call local_commits methods when this is true. @staticmethod def supports_local_commits(): - raise NotImplementedError, "subclasses must implement" + SCM._subclass_must_implement() def remote_merge_base(): - raise NotImplementedError, "subclasses must implement" + SCM._subclass_must_implement() def commit_locally_with_message(self, message): error("Your source control manager does not support local commits.") @@ -261,7 +276,8 @@ class SVN(SCM): def __init__(self, cwd): SCM.__init__(self, cwd) self.cached_version = None - + self._bogus_dir = None + @staticmethod def in_working_directory(path): return os.path.isdir(os.path.join(path, '.svn')) @@ -343,9 +359,23 @@ class SVN(SCM): field_count = 6 if self.svn_version() > "1.6" else 5 return "^(?P<status>[%s]).{%s} (?P<filename>.+)$" % (expected_types, field_count) - def add(self, path): - # path is assumed to be cwd relative? - self.run(["svn", "add", path]) + def _add_parent_directories(self, path): + """Does 'svn add' to the path and its parents.""" + if self.in_working_directory(path): + return + dirname = os.path.dirname(path) + # We have dirname directry - ensure it added. + if dirname != path: + self._add_parent_directories(dirname) + self.add(path) + + def add(self, path, return_exit_code=False): + self._add_parent_directories(os.path.dirname(os.path.abspath(path))) + return self.run(["svn", "add", path], return_exit_code=return_exit_code) + + def delete(self, path): + parent, base = os.path.split(os.path.abspath(path)) + return self.run(["svn", "delete", "--force", base], cwd=parent) def changed_files(self, git_commit=None, squash=None): return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("ACDMR")) @@ -362,6 +392,9 @@ class SVN(SCM): def added_files(self): return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("A")) + def deleted_files(self): + return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("D")) + @staticmethod def supports_local_commits(): return False @@ -391,6 +424,44 @@ class SVN(SCM): # FIXME: This should probably use cwd=self.checkout_root return self.run(['svn', 'diff', '-c', revision]) + def _bogus_dir_name(self): + if sys.platform.startswith("win"): + parent_dir = tempfile.gettempdir() + else: + parent_dir = sys.path[0] # tempdir is not secure. + return os.path.join(parent_dir, "temp_svn_config") + + def _setup_bogus_dir(self, log): + self._bogus_dir = self._bogus_dir_name() + if not os.path.exists(self._bogus_dir): + os.mkdir(self._bogus_dir) + self._delete_bogus_dir = True + else: + self._delete_bogus_dir = False + if log: + log.debug(' Html: temp config dir: "%s".', self._bogus_dir) + + def _teardown_bogus_dir(self, log): + if self._delete_bogus_dir: + shutil.rmtree(self._bogus_dir, True) + if log: + log.debug(' Html: removed temp config dir: "%s".', self._bogus_dir) + self._bogus_dir = None + + def diff_for_file(self, path, log=None): + self._setup_bogus_dir(log) + try: + args = ['svn', 'diff'] + if self._bogus_dir: + args += ['--config-dir', self._bogus_dir] + args.append(path) + return self.run(args) + finally: + self._teardown_bogus_dir(log) + + def show_head(self, path): + return self.run(['svn', 'cat', '-r', 'BASE', path], decode_output=False) + def _repository_url(self): return self.value_from_svn_info(self.checkout_root, 'URL') @@ -435,6 +506,14 @@ class SVN(SCM): # http://svnbook.red-bean.com/en/1.0/ch03s03.html return self.svn_commit_log('BASE') + def propset(self, pname, pvalue, path): + dir, base = os.path.split(path) + return self.run(['svn', 'pset', pname, pvalue, base], cwd=dir) + + def propget(self, pname, path): + dir, base = os.path.split(path) + return self.run(['svn', 'pget', pname, base], cwd=dir).encode('utf-8').rstrip("\n") + # All git-specific logic should go here. class Git(SCM): def __init__(self, cwd): @@ -447,13 +526,18 @@ class Git(SCM): @classmethod def find_checkout_root(cls, path): # "git rev-parse --show-cdup" would be another way to get to the root - (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=path)) + (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=(path or "./"))) # If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path) if not os.path.isabs(checkout_root): # Sometimes git returns relative paths checkout_root = os.path.join(path, checkout_root) return checkout_root @classmethod + def to_object_name(cls, filepath): + root_end_with_slash = os.path.join(cls.find_checkout_root(os.path.dirname(filepath)), '') + return filepath.replace(root_end_with_slash, '') + + @classmethod def read_git_config(cls, key): # FIXME: This should probably use cwd=self.checkout_root. return run_command(["git", "config", key], @@ -494,9 +578,11 @@ class Git(SCM): def _status_regexp(self, expected_types): return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types - def add(self, path): - # path is assumed to be cwd relative? - self.run(["git", "add", path]) + def add(self, path, return_exit_code=False): + return self.run(["git", "add", path], return_exit_code=return_exit_code) + + def delete(self, path): + return self.run(["git", "rm", "-f", path]) def _merge_base(self, git_commit, squash): if git_commit: @@ -537,6 +623,9 @@ class Git(SCM): def added_files(self): return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("A")) + def deleted_files(self): + return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("D")) + @staticmethod def supports_local_commits(): return True @@ -569,6 +658,12 @@ class Git(SCM): git_commit = self.git_commit_from_svn_revision(revision) return self.create_patch(git_commit) + def diff_for_file(self, path, log=None): + return self.run(['git', 'diff', 'HEAD', '--', path]) + + def show_head(self, path): + return self.run(['git', 'show', 'HEAD:' + self.to_object_name(path)], decode_output=False) + def committer_email_for_revision(self, revision): git_commit = self.git_commit_from_svn_revision(revision) committer_email = self.run(["git", "log", "-1", "--pretty=format:%ce", git_commit]) diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py index 36a1d1c..eaa3b46 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py @@ -40,6 +40,7 @@ import subprocess import tempfile import unittest import urllib +import shutil from datetime import date from webkitpy.common.checkout.api import Checkout @@ -63,8 +64,12 @@ def run_silent(args, cwd=None): def write_into_file_at_path(file_path, contents, encoding="utf-8"): - with codecs.open(file_path, "w", encoding) as file: - file.write(contents) + if encoding: + with codecs.open(file_path, "w", encoding) as file: + file.write(contents) + else: + with open(file_path, "w") as file: + file.write(contents) def read_from_path(file_path, encoding="utf-8"): @@ -388,6 +393,11 @@ OcmYex&reD$;sO8*F9L)B # Cannot delete again. self.assertRaises(ScriptError, self.checkout.apply_patch, self._create_patch(git_binary_deletion)) + def _shared_test_add_recursively(self): + os.mkdir("added_dir") + write_into_file_at_path("added_dir/added_file", "new stuff") + self.scm.add("added_dir/added_file") + self.assertTrue("added_dir/added_file" in self.scm.added_files()) class SVNTest(SCMTest): @@ -632,6 +642,60 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== def test_committer_email_for_revision(self): self._shared_test_committer_email_for_revision() + def test_add_recursively(self): + self._shared_test_add_recursively() + + def test_delete(self): + os.chdir(self.svn_checkout_path) + self.scm.delete("test_file") + self.assertTrue("test_file" in self.scm.deleted_files()) + + def test_propset_propget(self): + filepath = os.path.join(self.svn_checkout_path, "test_file") + expected_mime_type = "x-application/foo-bar" + self.scm.propset("svn:mime-type", expected_mime_type, filepath) + self.assertEqual(expected_mime_type, self.scm.propget("svn:mime-type", filepath)) + + def test_show_head(self): + write_into_file_at_path("test_file", u"Hello!", "utf-8") + SVNTestRepository._svn_commit("fourth commit") + self.assertEqual("Hello!", self.scm.show_head('test_file')) + + def test_show_head_binary(self): + data = "\244" + write_into_file_at_path("binary_file", data, encoding=None) + self.scm.add("binary_file") + self.scm.commit_with_message("a test commit") + self.assertEqual(data, self.scm.show_head('binary_file')) + + def do_test_diff_for_file(self): + write_into_file_at_path('test_file', 'some content') + self.scm.commit_with_message("a test commit") + diff = self.scm.diff_for_file('test_file') + self.assertEqual(diff, "") + + write_into_file_at_path("test_file", "changed content") + diff = self.scm.diff_for_file('test_file') + self.assertTrue("-some content" in diff) + self.assertTrue("+changed content" in diff) + + def clean_bogus_dir(self): + self.bogus_dir = self.scm._bogus_dir_name() + if os.path.exists(self.bogus_dir): + shutil.rmtree(self.bogus_dir) + + def test_diff_for_file_with_existing_bogus_dir(self): + self.clean_bogus_dir() + os.mkdir(self.bogus_dir) + self.do_test_diff_for_file() + self.assertTrue(os.path.exists(self.bogus_dir)) + shutil.rmtree(self.bogus_dir) + + def test_diff_for_file_with_missing_bogus_dir(self): + self.clean_bogus_dir() + self.do_test_diff_for_file() + self.assertFalse(os.path.exists(self.bogus_dir)) + class GitTest(SCMTest): @@ -1098,6 +1162,46 @@ class GitSVNTest(SCMTest): def test_committer_email_for_revision(self): self._shared_test_committer_email_for_revision() + def test_add_recursively(self): + self._shared_test_add_recursively() + + def test_delete(self): + self._two_local_commits() + self.scm.delete('test_file_commit1') + self.assertTrue("test_file_commit1" in self.scm.deleted_files()) + + def test_to_object_name(self): + relpath = 'test_file_commit1' + fullpath = os.path.join(self.git_checkout_path, relpath) + self._two_local_commits() + self.assertEqual(relpath, self.scm.to_object_name(fullpath)) + + def test_show_head(self): + self._two_local_commits() + self.assertEqual("more test content", self.scm.show_head('test_file_commit1')) + + def test_show_head_binary(self): + self._two_local_commits() + data = "\244" + write_into_file_at_path("binary_file", data, encoding=None) + self.scm.add("binary_file") + self.scm.commit_locally_with_message("a test commit") + self.assertEqual(data, self.scm.show_head('binary_file')) + + def test_diff_for_file(self): + self._two_local_commits() + write_into_file_at_path('test_file_commit1', "Updated", encoding=None) + + diff = self.scm.diff_for_file('test_file_commit1') + cached_diff = self.scm.diff_for_file('test_file_commit1') + self.assertTrue("+Updated" in diff) + self.assertTrue("-more test content" in diff) + + self.scm.add('test_file_commit1') + + cached_diff = self.scm.diff_for_file('test_file_commit1') + self.assertTrue("+Updated" in cached_diff) + self.assertTrue("-more test content" in cached_diff) if __name__ == '__main__': unittest.main() diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py index f11b8a9..35f32d4 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py @@ -58,7 +58,9 @@ import urllib import webbrowser import zipfile -from webkitpy.common.system.executive import run_command +from webkitpy.common.system.executive import run_command, ScriptError +from webkitpy.common.checkout.scm import detect_scm_system +import webkitpy.common.checkout.scm as scm import port from layout_package import test_expectations @@ -68,9 +70,6 @@ from test_types import text_diff _log = logging.getLogger("webkitpy.layout_tests." "rebaseline_chromium_webkit_tests") -# Repository type constants. -REPO_SVN, REPO_UNKNOWN = range(2) - BASELINE_SUFFIXES = ['.txt', '.png', '.checksum'] REBASELINE_PLATFORM_ORDER = ['mac', 'win', 'win-xp', 'win-vista', 'linux'] ARCHIVE_DIR_NAME_DICT = {'win': 'webkit-rel', @@ -241,8 +240,7 @@ class Rebaseliner(object): self._platform, False, False) - - self._repo_type = self._get_repo_type() + self._scm = detect_scm_system(os.getcwd()) def run(self, backup): """Run rebaseline process.""" @@ -285,15 +283,6 @@ class Rebaseliner(object): def get_rebaselining_tests(self): return self._rebaselining_tests - # FIXME: Callers should use scm.py instead. - def _get_repo_type(self): - """Get the repository type that client is using.""" - return_code = run_command(['svn', 'info'], return_exit_code=True) - if return_code == 0: - return REPO_SVN - - return REPO_UNKNOWN - def _compile_rebaselining_tests(self): """Compile list of tests that need rebaselining for the platform. @@ -371,6 +360,9 @@ class Rebaseliner(object): None on failure """ + if self._options.force_archive_url: + return self._options.force_archive_url + dir_name = self._get_archive_dir_name(self._platform, self._options.webkit_canary) if not dir_name: @@ -431,7 +423,7 @@ class Rebaseliner(object): _log.info('Test %d: %s', test_no, test) found = False - svn_error = False + scm_error = False test_basename = os.path.splitext(test)[0] for suffix in BASELINE_SUFFIXES: archive_test_name = ('layout-test-results/%s-actual%s' % @@ -480,16 +472,17 @@ class Rebaseliner(object): shutil.move(temp_name, expected_fullpath) - if not self._svn_add(expected_fullpath): - svn_error = True + if 0 != self._scm.add(expected_fullpath, return_exit_code=True): + # FIXME: print detailed diagnose messages + scm_error = True elif suffix != '.checksum': self._create_html_baseline_files(expected_fullpath) if not found: _log.warn(' No new baselines found in archive.') else: - if svn_error: - _log.warn(' Failed to add baselines to SVN.') + if scm_error: + _log.warn(' Failed to add baselines to your repository.') else: _log.info(' Rebaseline succeeded.') self._rebaselined_tests.append(test) @@ -572,15 +565,7 @@ class Rebaseliner(object): if not filename or not os.path.isfile(filename): return - - if self._repo_type == REPO_SVN: - parent_dir, basename = os.path.split(filename) - original_dir = os.getcwd() - os.chdir(parent_dir) - run_shell(['svn', 'delete', '--force', basename], False) - os.chdir(original_dir) - else: - os.remove(filename) + self._scm.delete(filename) def _update_rebaselined_tests_in_file(self, backup): """Update the rebaselined tests in test expectations file. @@ -609,91 +594,10 @@ class Rebaseliner(object): # Or is new_expectations always a byte array? with open(path, "w") as file: file.write(new_expectations) + self._scm.add(path) else: _log.info('No test was rebaselined so nothing to remove.') - # FIXME: Callers should move to SCM.add instead. - def _svn_add(self, filename): - """Add the file to SVN repository. - - Args: - filename: full path of the file to add. - - Returns: - True if the file already exists in SVN or is sucessfully added - to SVN. - False otherwise. - """ - - if not filename: - return False - - parent_dir, basename = os.path.split(filename) - if self._repo_type != REPO_SVN or parent_dir == filename: - _log.info("No svn checkout found, skip svn add.") - return True - - original_dir = os.getcwd() - os.chdir(parent_dir) - status_output = run_shell(['svn', 'status', basename], False) - os.chdir(original_dir) - output = status_output.upper() - if output.startswith('A') or output.startswith('M'): - _log.info(' File already added to SVN: "%s"', filename) - return True - - if output.find('IS NOT A WORKING COPY') >= 0: - _log.info(' File is not a working copy, add its parent: "%s"', - parent_dir) - return self._svn_add(parent_dir) - - os.chdir(parent_dir) - add_output = run_shell(['svn', 'add', basename], True) - os.chdir(original_dir) - output = add_output.upper().rstrip() - if output.startswith('A') and output.find(basename.upper()) >= 0: - _log.info(' Added new file: "%s"', filename) - self._svn_prop_set(filename) - return True - - if (not status_output) and (add_output.upper().find( - 'ALREADY UNDER VERSION CONTROL') >= 0): - _log.info(' File already under SVN and has no change: "%s"', - filename) - return True - - _log.warn(' Failed to add file to SVN: "%s"', filename) - _log.warn(' Svn status output: "%s"', status_output) - _log.warn(' Svn add output: "%s"', add_output) - return False - - def _svn_prop_set(self, filename): - """Set the baseline property - - Args: - filename: full path of the file to add. - - Returns: - True if the file already exists in SVN or is sucessfully added - to SVN. - False otherwise. - """ - ext = os.path.splitext(filename)[1].upper() - if ext != '.TXT' and ext != '.PNG' and ext != '.CHECKSUM': - return - - parent_dir, basename = os.path.split(filename) - original_dir = os.getcwd() - os.chdir(parent_dir) - if ext == '.PNG': - cmd = ['svn', 'pset', 'svn:mime-type', 'image/png', basename] - else: - cmd = ['svn', 'pset', 'svn:eol-style', 'LF', basename] - - _log.debug(' Set svn prop: %s', ' '.join(cmd)) - run_shell(cmd, False) - os.chdir(original_dir) - def _create_html_baseline_files(self, baseline_fullpath): """Create baseline files (old, new and diff) in html directory. @@ -715,8 +619,13 @@ class Rebaseliner(object): _log.info(' Html: copied new baseline file from "%s" to "%s".', baseline_fullpath, new_file) - # Get the old baseline from SVN and save to the html directory. - output = run_shell(['svn', 'cat', '-r', 'BASE', baseline_fullpath]) + # Get the old baseline from the repository and save to the html directory. + try: + output = self._scm.show_head(baseline_fullpath) + except ScriptError, e: + _log.info(e) + output = "" + if (not output) or (output.upper().rstrip().endswith( 'NO SUCH FILE OR DIRECTORY')): _log.info(' No base file: "%s"', baseline_fullpath) @@ -733,27 +642,7 @@ class Rebaseliner(object): # Get the diff between old and new baselines and save to the html dir. if baseline_filename.upper().endswith('.TXT'): - # If the user specified a custom diff command in their svn config - # file, then it'll be used when we do svn diff, which we don't want - # to happen since we want the unified diff. Using --diff-cmd=diff - # doesn't always work, since they can have another diff executable - # in their path that gives different line endings. So we use a - # bogus temp directory as the config directory, which gets - # around these problems. - if sys.platform.startswith("win"): - parent_dir = tempfile.gettempdir() - else: - parent_dir = sys.path[0] # tempdir is not secure. - bogus_dir = os.path.join(parent_dir, "temp_svn_config") - _log.debug(' Html: temp config dir: "%s".', bogus_dir) - if not os.path.exists(bogus_dir): - os.mkdir(bogus_dir) - delete_bogus_dir = True - else: - delete_bogus_dir = False - - output = run_shell(["svn", "diff", "--config-dir", bogus_dir, - baseline_fullpath]) + output = self._scm.diff_for_file(baseline_fullpath, log=_log) if output: diff_file = get_result_file_fullpath( self._options.html_directory, baseline_filename, @@ -764,12 +653,6 @@ class Rebaseliner(object): _log.info(' Html: created baseline diff file: "%s".', diff_file) - if delete_bogus_dir: - shutil.rmtree(bogus_dir, True) - _log.debug(' Html: removed temp config dir: "%s".', - bogus_dir) - - class HtmlGenerator(object): """Class to generate rebaselining result comparison html.""" @@ -1001,6 +884,10 @@ def main(): default=False, help='include debug-level logging.') + option_parser.add_option('-q', '--quiet', + action='store_true', + help='Suppress result HTML viewing') + option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma delimited list of platforms ' @@ -1011,6 +898,9 @@ def main(): 'layout_test_results'), help=('Url to find the layout test result archive' ' file.')) + option_parser.add_option('-U', '--force_archive_url', + help=('Url of result zip file. This option is for debugging ' + 'purposes')) option_parser.add_option('-w', '--webkit_canary', action='store_true', @@ -1106,7 +996,8 @@ def main(): rebaseline_platforms, rebaselining_tests) html_generator.generate_html() - html_generator.show_html() + if not options.quiet: + html_generator.show_html() log_dashed_string('Rebaselining result comparison done', None) sys.exit(0) diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py index 5d75a1b..e3c56c5 100644 --- a/WebKitTools/Scripts/webkitpy/style/checker.py +++ b/WebKitTools/Scripts/webkitpy/style/checker.py @@ -205,7 +205,7 @@ _SKIPPED_FILES_WITH_WARNING = [ # The Qt API and tests do not follow WebKit style. # They follow Qt style. :) "gtk2drawing.c", # WebCore/platform/gtk/gtk2drawing.c - "gtk2drawing.h", # WebCore/platform/gtk/gtk2drawing.h + "gtkdrawing.h", # WebCore/platform/gtk/gtkdrawing.h "JavaScriptCore/qt/api/", "WebKit/gtk/tests/", "WebKit/qt/Api/", diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py index e99ac68..5254275 100755 --- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py +++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py @@ -281,10 +281,10 @@ class CheckerDispatcherSkipTest(unittest.TestCase): # Check skipped files. paths_to_skip = [ "gtk2drawing.c", - "gtk2drawing.h", + "gtkdrawing.h", "JavaScriptCore/qt/api/qscriptengine_p.h", "WebCore/platform/gtk/gtk2drawing.c", - "WebCore/platform/gtk/gtk2drawing.h", + "WebCore/platform/gtk/gtkdrawing.h", "WebKit/gtk/tests/testatk.c", "WebKit/qt/Api/qwebpage.h", "WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp", diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/download.py b/WebKitTools/Scripts/webkitpy/tool/commands/download.py index 17fb12c..59af16a 100644 --- a/WebKitTools/Scripts/webkitpy/tool/commands/download.py +++ b/WebKitTools/Scripts/webkitpy/tool/commands/download.py @@ -82,7 +82,6 @@ class Land(AbstractSequencedCommand): steps.EnsureBuildersAreGreen, steps.UpdateChangeLogsWithReviewer, steps.ValidateReviewer, - steps.EnsureBuildersAreGreen, steps.Build, steps.RunTests, steps.Commit, @@ -243,7 +242,6 @@ class AbstractPatchLandingCommand(AbstractPatchSequencingCommand): steps.Update, steps.ApplyPatch, steps.ValidateReviewer, - steps.EnsureBuildersAreGreen, steps.Build, steps.RunTests, steps.Commit, diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py index e682ca7..9c935e8 100644 --- a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py +++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py @@ -178,8 +178,13 @@ class Post(AbstractPatchUploadingCommand): class LandSafely(AbstractPatchUploadingCommand): name = "land-safely" - help_text = "Land the current diff via the commit-queue (Experimental)" + help_text = "Land the current diff via the commit-queue" argument_names = "[BUGID]" + long_help = """land-safely updates the ChangeLog with the reviewer listed + in bugs.webkit.org for BUGID (or the bug ID detected from the ChangeLog). + The command then uploads the current diff to the bug and marks it for + commit by the commit-queue.""" + show_in_main_help = True steps = [ steps.UpdateChangeLogsWithReviewer, steps.ObsoletePatches, diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py b/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py index 40bc302..7b717ef 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py @@ -28,7 +28,7 @@ from webkitpy.tool.steps.abstractstep import AbstractStep from webkitpy.tool.steps.options import Options -from webkitpy.common.system.deprecated_logging import error +from webkitpy.common.system.deprecated_logging import log, error class EnsureBuildersAreGreen(AbstractStep): @@ -45,4 +45,6 @@ class EnsureBuildersAreGreen(AbstractStep): if not red_builders_names: return red_builders_names = map(lambda name: "\"%s\"" % name, red_builders_names) # Add quotes around the names. - error("Builders [%s] are red, please do not commit.\nSee http://%s.\nPass --ignore-builders to bypass this check." % (", ".join(red_builders_names), self._tool.buildbot.buildbot_host)) + log("\nBuilders [%s] are red, please do not commit.\nSee http://%s/console?category=core\n" % (", ".join(red_builders_names), self._tool.buildbot.buildbot_host)) + if not self._tool.user.confirm("Are you sure you want to continue?"): + error("User aborted.") diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h new file mode 100644 index 0000000..f2258d2 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ASCIICType.h @@ -0,0 +1 @@ +#include <JavaScriptCore/ASCIICType.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h new file mode 100644 index 0000000..2144410 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Assertions.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Assertions.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h new file mode 100644 index 0000000..37b1892 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Atomics.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Atomics.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h new file mode 100644 index 0000000..1701231 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/FastMalloc.h @@ -0,0 +1 @@ +#include <JavaScriptCore/FastMalloc.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h new file mode 100644 index 0000000..9f262e2 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashMap.h @@ -0,0 +1 @@ +#include <JavaScriptCore/HashMap.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h new file mode 100644 index 0000000..cfe2d80 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashSet.h @@ -0,0 +1 @@ +#include <JavaScriptCore/HashSet.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h new file mode 100644 index 0000000..412fa98 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/HashTraits.h @@ -0,0 +1 @@ +#include <JavaScriptCore/HashTraits.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h new file mode 100644 index 0000000..75b0acd --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Locker.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Locker.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h new file mode 100644 index 0000000..ff75971 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MainThread.h @@ -0,0 +1 @@ +#include <JavaScriptCore/MainThread.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h new file mode 100644 index 0000000..2955786 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/MathExtras.h @@ -0,0 +1 @@ +#include <JavaScriptCore/MathExtras.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h new file mode 100644 index 0000000..f8484d2 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Noncopyable.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Noncopyable.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h new file mode 100644 index 0000000..9211d38 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/OwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h new file mode 100644 index 0000000..6064e88 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/OwnPtrCommon.h @@ -0,0 +1 @@ +#include <JavaScriptCore/PassOwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h new file mode 100644 index 0000000..6064e88 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassOwnPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/PassOwnPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h new file mode 100644 index 0000000..aafd1a2 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/PassRefPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/PassRefPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h new file mode 100644 index 0000000..3b22955 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Platform.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Platform.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h new file mode 100644 index 0000000..628a63b --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefCounted.h @@ -0,0 +1 @@ +#include <JavaScriptCore/RefCounted.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h new file mode 100644 index 0000000..0ff6213 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RefPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/RefPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h new file mode 100644 index 0000000..65fc27b --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/RetainPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/RetainPtr.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h new file mode 100644 index 0000000..063d500 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/StringExtras.h @@ -0,0 +1 @@ +#include <JavaScriptCore/StringExtras.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h new file mode 100644 index 0000000..4a7a77f --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadSafeShared.h @@ -0,0 +1 @@ +#include <JavaScriptCore/ThreadSafeShared.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h new file mode 100644 index 0000000..17359e5 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Threading.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Threading.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h new file mode 100644 index 0000000..a7ee117 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/ThreadingPrimitives.h @@ -0,0 +1 @@ +#include <JavaScriptCore/ThreadingPrimitives.h> diff --git a/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h new file mode 100644 index 0000000..c6d15fd --- /dev/null +++ b/WebKitTools/WebKitTestRunner/ForwardingHeaders/wtf/Vector.h @@ -0,0 +1 @@ +#include <JavaScriptCore/Vector.h> diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp new file mode 100644 index 0000000..63013fb --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundle.h" + +#include "InjectedBundlePage.h" +#include <WebKit2/WKBundle.h> +#include <WebKit2/WKBundlePage.h> +#include <WebKit2/WKRetainPtr.h> +#include <WebKit2/WKStringCF.h> +#include <WebKit2/WebKit2.h> +#include <wtf/RetainPtr.h> + +namespace WTR { + +InjectedBundle& InjectedBundle::shared() +{ + static InjectedBundle& shared = *new InjectedBundle; + return shared; +} + +InjectedBundle::InjectedBundle() + : m_bundle(0) + , m_layoutTestController(LayoutTestController::create(std::string(""))) +{ +} + +void InjectedBundle::_didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) +{ + static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didCreatePage(page); +} + +void InjectedBundle::_willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) +{ + static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page); +} + +void InjectedBundle::_didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) +{ + static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didRecieveMessage(message); +} + +void InjectedBundle::initialize(WKBundleRef bundle) +{ + m_bundle = bundle; + + WKBundleClient client = { + 0, + this, + _didCreatePage, + _willDestroyPage, + _didRecieveMessage + }; + WKBundleSetClient(m_bundle, &client); +} + +void InjectedBundle::done() +{ + std::string output = m_outputStream.str(); + RetainPtr<CFStringRef> outputCFString(AdoptCF, CFStringCreateWithCString(0, output.c_str(), kCFStringEncodingUTF8)); + WKRetainPtr<WKStringRef> doneMessage(AdoptWK, WKStringCreateWithCFString(outputCFString.get())); + WKBundlePostMessage(m_bundle, doneMessage.get()); +} + +void InjectedBundle::didCreatePage(WKBundlePageRef page) +{ + m_pages.add(page, new InjectedBundlePage(page)); +} + +void InjectedBundle::willDestroyPage(WKBundlePageRef page) +{ + delete m_pages.take(page); +} + +void InjectedBundle::didRecieveMessage(WKStringRef message) +{ + CFStringRef cfMessage = WKStringCopyCFString(0, message); + if (CFEqual(cfMessage, CFSTR("BeginTest"))) { + WKRetainPtr<WKStringRef> ackMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTestAck"))); + WKBundlePostMessage(m_bundle, ackMessage.get()); + + reset(); + return; + } + + WKRetainPtr<WKStringRef> errorMessage(AdoptWK, WKStringCreateWithCFString(CFSTR("Error: Unknown."))); + WKBundlePostMessage(m_bundle, errorMessage.get()); +} + +void InjectedBundle::reset() +{ + m_outputStream.str(""); +} + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h new file mode 100644 index 0000000..33934cf --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundle_h +#define InjectedBundle_h + +#include "LayoutTestController.h" +#include <WebKit2/WKBase.h> +#include <WebKit2/WKBundleBase.h> +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +#include <sstream> + +namespace WTR { + +class InjectedBundlePage; + +class InjectedBundle { +public: + static InjectedBundle& shared(); + + // Initialize the InjectedBundle. + void initialize(WKBundleRef); + + void done(); + + LayoutTestController* layoutTestController() { return m_layoutTestController.get(); } + + std::ostringstream& os() { return m_outputStream; } + +private: + InjectedBundle(); + ~InjectedBundle(); + + static void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); + static void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); + static void _didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo); + + void didCreatePage(WKBundlePageRef page); + void willDestroyPage(WKBundlePageRef page); + void didRecieveMessage(WKStringRef message); + + void reset(); + + WKBundleRef m_bundle; + HashMap<WKBundlePageRef, InjectedBundlePage*> m_pages; + + RefPtr<LayoutTestController> m_layoutTestController; + + std::ostringstream m_outputStream; +}; + +} // namespace WTR + +#endif // InjectedBundle_h diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp index f108548..27779df 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp @@ -23,84 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include <WebKit2/WKBundle.h> +#include "InjectedBundle.h" #include <WebKit2/WKBundleInitialize.h> -#include <WebKit2/WKBundlePage.h> -#include <WebKit2/WebKit2.h> - -static WKBundleRef globalBundle; - -// WKBundlePageClient - -void _didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo) -{ -} - -void _didClearWindow(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) -{ -} - -// WKBundleClient - -void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) -{ - WKBundlePageClient client = { - 0, - 0, - _didStartProvisionalLoadForFrame, - _didReceiveServerRedirectForProvisionalLoadForFrame, - _didFailProvisionalLoadWithErrorForFrame, - _didCommitLoadForFrame, - _didFinishLoadForFrame, - _didFailLoadWithErrorForFrame, - _didReceiveTitleForFrame, - _didClearWindow - }; - WKBundlePageSetClient(page, &client); -} - -void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo) -{ -} - -void _didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) -{ -} extern "C" void WKBundleInitialize(WKBundleRef bundle) { - globalBundle = bundle; - - WKBundleClient client = { - 0, - 0, - _didCreatePage, - _willDestroyPage, - _didRecieveMessage - }; - WKBundleSetClient(bundle, &client); + WTR::InjectedBundle::shared().initialize(bundle); } diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp new file mode 100644 index 0000000..cabb90d --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePage.h" + +#include "InjectedBundle.h" +#include <WebKit2/WKBundleFrame.h> +#include <WebKit2/WKBundlePagePrivate.h> +#include <WebKit2/WKRetainPtr.h> +#include <WebKit2/WKString.h> +#include <WebKit2/WKStringCF.h> +#include <wtf/RetainPtr.h> +#include <wtf/Vector.h> + +namespace WTR { + +InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) + : m_page(page) +{ + WKBundlePageClient client = { + 0, + this, + _didStartProvisionalLoadForFrame, + _didReceiveServerRedirectForProvisionalLoadForFrame, + _didFailProvisionalLoadWithErrorForFrame, + _didCommitLoadForFrame, + _didFinishLoadForFrame, + _didFailLoadWithErrorForFrame, + _didReceiveTitleForFrame, + _didClearWindowForFrame + }; + WKBundlePageSetClient(m_page, &client); +} + +InjectedBundlePage::~InjectedBundlePage() +{ +} + +void InjectedBundlePage::_didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didStartProvisionalLoadForFrame(frame); +} + +void InjectedBundlePage::_didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveServerRedirectForProvisionalLoadForFrame(frame); +} + +void InjectedBundlePage::_didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailProvisionalLoadWithErrorForFrame(frame); +} + +void InjectedBundlePage::_didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didCommitLoadForFrame(frame); +} + +void InjectedBundlePage::_didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishLoadForFrame(frame); +} + +void InjectedBundlePage::_didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailLoadWithErrorForFrame(frame); +} + +void InjectedBundlePage::_didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveTitleForFrame(title, frame); +} + +void InjectedBundlePage::_didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, ctx, window); +} + +void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) +{ +} + +void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame) +{ +} + +void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame) +{ +} + +void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame) +{ +} + +static std::auto_ptr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef) +{ + RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef)); + CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1; + std::auto_ptr<Vector<char> > buffer(new Vector<char>(bufferLength)); + if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) { + buffer->shrink(1); + (*buffer)[0] = 0; + } else + buffer->shrink(strlen(buffer->data()) + 1); + return buffer; +} + +void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame) +{ + if (!WKBundleFrameIsMainFrame(frame)) + return; + + WKRetainPtr<WKStringRef> externalRepresentation(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page)); + std::auto_ptr<Vector<char> > utf8String = WKStringToUTF8(externalRepresentation.get()); + + InjectedBundle::shared().os() << utf8String->data(); + InjectedBundle::shared().done(); +} + +void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame) +{ + if (!WKBundleFrameIsMainFrame(frame)) + return; + + InjectedBundle::shared().done(); +} + +void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame) +{ +} + +void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window) +{ + JSValueRef exception = 0; + InjectedBundle::shared().layoutTestController()->makeWindowObject(ctx, window, &exception); +} + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h new file mode 100644 index 0000000..9782827 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundlePage_h +#define InjectedBundlePage_h + +#include <WebKit2/WKBundlePage.h> + +namespace WTR { + +class InjectedBundlePage { +public: + InjectedBundlePage(WKBundlePageRef); + ~InjectedBundlePage(); + + WKBundlePageRef page() const { return m_page; } + +private: + static void _didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); + static void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo); + static void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo); + + void didStartProvisionalLoadForFrame(WKBundleFrameRef frame); + void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame); + void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame); + void didCommitLoadForFrame(WKBundleFrameRef frame); + void didFinishLoadForFrame(WKBundleFrameRef frame); + void didFailLoadWithErrorForFrame(WKBundleFrameRef frame); + void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame); + void didClearWindowForFrame(WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window); + + WKBundlePageRef m_page; +}; + +} // namespace WTR + +#endif // InjectedBundlePage_h diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp new file mode 100644 index 0000000..014851c --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "LayoutTestController.h" + +#include <JavaScriptCore/JSRetainPtr.h> + +namespace WTR { + +PassRefPtr<LayoutTestController> LayoutTestController::create(const std::string& testPathOrURL) +{ + return adoptRef(new LayoutTestController(testPathOrURL)); +} + +LayoutTestController::LayoutTestController(const std::string& testPathOrURL) + : m_dumpAsText(false) + , m_testPathOrURL(testPathOrURL) +{ +} + +LayoutTestController::~LayoutTestController() +{ +} + +static JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setDumpAsText(true); + return JSValueMakeUndefined(context); +} + +// Object Finalization + +static void layoutTestControllerObjectFinalize(JSObjectRef object) +{ + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(object)); + controller->deref(); +} + +// Object Creation + +void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController")); + ref(); + + JSClassRef classRef = getJSClass(); + JSValueRef layoutTestContollerObject = JSObjectMake(context, classRef, this); + JSClassRelease(classRef); + + JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); +} + +JSClassRef LayoutTestController::getJSClass() +{ + static JSStaticFunction* staticFunctions = LayoutTestController::staticFunctions(); + static JSClassDefinition classDefinition = { + 0, kJSClassAttributeNone, "LayoutTestController", 0, 0, staticFunctions, + 0, layoutTestControllerObjectFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + return JSClassCreate(&classDefinition); +} + +JSStaticFunction* LayoutTestController::staticFunctions() +{ + static JSStaticFunction staticFunctions[] = { + { "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } + }; + + return staticFunctions; +} + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h new file mode 100644 index 0000000..56717c1 --- /dev/null +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayoutTestController_h +#define LayoutTestController_h + +#include <JavaScriptCore/JavaScriptCore.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <string> + +namespace WTR { + +class LayoutTestController : public RefCounted<LayoutTestController> { +public: + static PassRefPtr<LayoutTestController> create(const std::string& testPathOrURL); + ~LayoutTestController(); + + void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception); + + bool dumpAsText() const { return m_dumpAsText; } + void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; } + +private: + LayoutTestController(const std::string& testPathOrURL); + + bool m_dumpAsText; + + std::string m_testPathOrURL; + + static JSClassRef getJSClass(); + static JSStaticValue* staticValues(); + static JSStaticFunction* staticFunctions(); +}; + +} // namespace WTR + +#endif // LayoutTestController_h diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp index 5355862..b5b15d1 100644 --- a/WebKitTools/WebKitTestRunner/TestController.cpp +++ b/WebKitTools/WebKitTestRunner/TestController.cpp @@ -25,6 +25,7 @@ #include "TestController.h" +#include "PlatformWebView.h" #include "TestInvocation.h" #include <getopt.h> @@ -93,12 +94,25 @@ void TestController::initialize(int argc, const char *argv[]) } initializeInjectedBundlePath(); + + m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath())); + + WKContextInjectedBundleClient injectedBundlePathClient = { + 0, + this, + _didRecieveMessageFromInjectedBundle + }; + WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient); + + m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get())); + m_mainWebView = new PlatformWebView(m_pageNamespace.get()); } void TestController::runTest(const char* test) { - TestInvocation invocation(test); - invocation.invoke(); + m_currentInvocation.set(new TestInvocation(test)); + m_currentInvocation->invoke(); + m_currentInvocation.clear(); } void TestController::runTestingServerLoop() @@ -128,5 +142,14 @@ bool TestController::run() return true; } -} // namespace WTR +void TestController::_didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo) +{ + static_cast<TestController*>(const_cast<void*>(clientInfo))->didRecieveMessageFromInjectedBundle(message); +} +void TestController::didRecieveMessageFromInjectedBundle(WKStringRef message) +{ + m_currentInvocation->didRecieveMessageFromInjectedBundle(message); +} + +} // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h index 86eaa7c..7ad11fe 100644 --- a/WebKitTools/WebKitTestRunner/TestController.h +++ b/WebKitTools/WebKitTestRunner/TestController.h @@ -29,9 +29,13 @@ #include <WebKit2/WKRetainPtr.h> #include <string> #include <vector> +#include <wtf/OwnPtr.h> namespace WTR { +class TestInvocation; +class PlatformWebView; + class TestController { public: static TestController& shared(); @@ -46,6 +50,10 @@ public: WKStringRef injectedBundlePath() { return m_injectedBundlePath.get(); } + PlatformWebView* mainWebView() { return m_mainWebView; } + WKPageNamespaceRef pageNamespace() { return m_pageNamespace.get(); } + WKContextRef context() { return m_context.get(); } + private: TestController(); ~TestController(); @@ -55,15 +63,25 @@ private: void initializeInjectedBundlePath(); + // WKContextInjectedBundleClient + static void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*); + void didRecieveMessageFromInjectedBundle(WKStringRef message); + + OwnPtr<TestInvocation> m_currentInvocation; + bool m_dumpTree; bool m_dumpPixels; bool m_threaded; - bool m_forceComplexText; + bool m_forceComplexText; bool m_verbose; bool m_printSeparators; bool m_usingServerMode; std::vector<std::string> m_paths; WKRetainPtr<WKStringRef> m_injectedBundlePath; + + PlatformWebView* m_mainWebView; + WKRetainPtr<WKContextRef> m_context; + WKRetainPtr<WKPageNamespaceRef> m_pageNamespace; }; } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp index 80efd62..72d07ae 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp +++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp @@ -25,13 +25,14 @@ #include "TestInvocation.h" +#include "PlatformWebView.h" #include "TestController.h" -#include <JavaScriptCore/RetainPtr.h> #include <WebKit2/WKContextPrivate.h> -#include <WebKit2/WKPagePrivate.h> #include <WebKit2/WKRetainPtr.h> #include <WebKit2/WKStringCF.h> #include <WebKit2/WKURLCF.h> +#include <wtf/Vector.h> +#include <wtf/RetainPtr.h> using namespace WebKit; @@ -48,123 +49,85 @@ static WKURLRef createWKURL(const char* pathOrURL) return WKURLCreateWithCFURL(cfURL.get()); } +static std::auto_ptr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef) +{ + RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef)); + CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1; + std::auto_ptr<Vector<char> > buffer(new Vector<char>(bufferLength)); + if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) { + buffer->shrink(1); + (*buffer)[0] = 0; + } else + buffer->shrink(strlen(buffer->data()) + 1); + return buffer; +} + TestInvocation::TestInvocation(const char* pathOrURL) : m_url(AdoptWK, createWKURL(pathOrURL)) - , m_mainWebView(0) - , m_loadDone(false) - , m_renderTreeFetchDone(false) - , m_failed(false) + , m_gotInitialResponse(false) + , m_gotFinalMessage(false) + , m_error(false) { } TestInvocation::~TestInvocation() { - delete m_mainWebView; - m_mainWebView = 0; } void TestInvocation::invoke() { - initializeMainWebView(); - - WKPageLoadURL(m_mainWebView->page(), m_url.get()); - runUntil(m_loadDone); + WKRetainPtr<WKStringRef> message(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest"))); + WKContextPostMessageToInjectedBundle(TestController::shared().context(), message.get()); - if (m_failed) + runUntil(m_gotInitialResponse); + if (m_error) { + dump("FAIL\n"); return; + } - WKPageRenderTreeExternalRepresentation(m_mainWebView->page(), this, renderTreeExternalRepresentationFunction, renderTreeExternalRepresentationDisposeFunction); - runUntil(m_renderTreeFetchDone); + WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get()); + + runUntil(m_gotFinalMessage); + if (m_error) { + dump("FAIL\n"); + return; + } } void TestInvocation::dump(const char* stringToDump) { printf("Content-Type: text/plain\n"); printf("%s", stringToDump); - printf("#EOF\n"); -} - -void TestInvocation::initializeMainWebView() -{ - WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreateWithInjectedBundlePath(TestController::shared().injectedBundlePath())); - WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get())); - m_mainWebView = new PlatformWebView(pageNamespace.get()); - - WKPageLoaderClient loaderClient = { - 0, - this, - didStartProvisionalLoadForFrame, - didReceiveServerRedirectForProvisionalLoadForFrame, - didFailProvisionalLoadWithErrorForFrame, - didCommitLoadForFrame, - didFinishLoadForFrame, - didFailLoadForFrame, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - }; - WKPageSetPageLoaderClient(m_mainWebView->page(), &loaderClient); -} - -void TestInvocation::didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ -} - -void TestInvocation::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ -} -void TestInvocation::didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ - TestInvocation* self = reinterpret_cast<TestInvocation*>(const_cast<void*>(clientInfo)); - self->m_loadDone = true; - self->m_failed = true; -} - -void TestInvocation::didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ -} - -void TestInvocation::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ - TestInvocation* self = reinterpret_cast<TestInvocation*>(const_cast<void*>(clientInfo)); - self->m_loadDone = true; -} + fputs("#EOF\n", stdout); + fputs("#EOF\n", stdout); + fputs("#EOF\n", stderr); -void TestInvocation::didFailLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo) -{ - TestInvocation* self = reinterpret_cast<TestInvocation*>(const_cast<void*>(clientInfo)); - - self->m_loadDone = true; - self->m_failed = true; + fflush(stdout); + fflush(stderr); } -void TestInvocation::renderTreeExternalRepresentationFunction(WKStringRef wkResult, void* context) +void TestInvocation::didRecieveMessageFromInjectedBundle(WKStringRef message) { - TestInvocation* self = reinterpret_cast<TestInvocation*>(context); - - RetainPtr<CFStringRef> result(AdoptCF, WKStringCopyCFString(0, wkResult)); - CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(result.get()), kCFStringEncodingUTF8) + 1; - char* buffer = (char*)malloc(bufferLength); - CFStringGetCString(result.get(), buffer, bufferLength, kCFStringEncodingUTF8); - - self->dump(buffer); - free(buffer); + RetainPtr<CFStringRef> cfMessage(AdoptCF, WKStringCopyCFString(0, message)); + + if (CFEqual(cfMessage.get(), CFSTR("Error"))) { + // Set all states to true to stop spinning the runloop. + m_gotInitialResponse = true; + m_gotFinalMessage = true; + m_error = true; + return; + } - self->m_renderTreeFetchDone = true; -} + if (CFEqual(cfMessage.get(), CFSTR("BeginTestAck"))) { + m_gotInitialResponse = true; + return; + } -void TestInvocation::renderTreeExternalRepresentationDisposeFunction(void* context) -{ - TestInvocation* self = reinterpret_cast<TestInvocation*>(context); + std::auto_ptr<Vector<char> > utf8Message = WKStringToUTF8(message); - self->m_renderTreeFetchDone = true; - self->m_failed = true; + dump(utf8Message->data()); + m_gotFinalMessage = true; } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.h b/WebKitTools/WebKitTestRunner/TestInvocation.h index 4552203..fb03150 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.h +++ b/WebKitTools/WebKitTestRunner/TestInvocation.h @@ -26,47 +26,31 @@ #ifndef TestInvocation_h #define TestInvocation_h -#include "PlatformWebView.h" #include <WebKit2/WKRetainPtr.h> -#include <JavaScriptCore/Noncopyable.h> +#include <wtf/Noncopyable.h> namespace WTR { -class TestInvocation : Noncopyable { +class TestInvocation : public Noncopyable { public: TestInvocation(const char*); ~TestInvocation(); void invoke(); + void didRecieveMessageFromInjectedBundle(WKStringRef message); private: - void initializeMainWebView(); void dump(const char*); // Helper static void runUntil(bool& done); - // PageLoaderClient - static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef, const void*); - static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, const void*); - static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, const void*); - static void didCommitLoadForFrame(WKPageRef, WKFrameRef, const void*); - static void didFinishLoadForFrame(WKPageRef, WKFrameRef, const void*); - static void didFailLoadForFrame(WKPageRef, WKFrameRef, const void*); - - // RenderTreeExternalRepresentation callbacks - static void renderTreeExternalRepresentationFunction(WKStringRef, void*); - static void renderTreeExternalRepresentationDisposeFunction(void*); - - WKStringRef injectedBundlePath(); - WKRetainPtr<WKURLRef> m_url; - PlatformWebView* m_mainWebView; // Invocation state - bool m_loadDone; - bool m_renderTreeFetchDone; - bool m_failed; + bool m_gotInitialResponse; + bool m_gotFinalMessage; + bool m_error; }; } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj index bef50b5..caf26a4 100644 --- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj +++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj @@ -17,6 +17,9 @@ BC7934AC1190658C005EA8E2 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7934AB1190658C005EA8E2 /* WebKit2.framework */; }; BC7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */; }; BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8C795B11D2785D004535A1 /* TestControllerMac.mm */; }; + BCC997A411D3C8F60017BCA2 /* InjectedBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */; }; + BCC997A511D3C8F60017BCA2 /* InjectedBundlePage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */; }; + BCC9981811D3F51E0017BCA2 /* LayoutTestController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC9981711D3F51E0017BCA2 /* LayoutTestController.cpp */; }; BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD7D2F711921278006DB7EE /* TestInvocation.cpp */; }; BCDA2ABF1190B51A00C3BC47 /* TestInvocationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCDA2ABE1190B51A00C3BC47 /* TestInvocationMac.mm */; }; BCDA2B9A1191051F00C3BC47 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */; }; @@ -62,6 +65,12 @@ BC7934DD119066EC005EA8E2 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = "<group>"; }; BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = "<group>"; }; BC8C795B11D2785D004535A1 /* TestControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestControllerMac.mm; sourceTree = "<group>"; }; + BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundle.cpp; sourceTree = "<group>"; }; + BCC997A111D3C8F60017BCA2 /* InjectedBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundle.h; sourceTree = "<group>"; }; + BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePage.cpp; sourceTree = "<group>"; }; + BCC997A311D3C8F60017BCA2 /* InjectedBundlePage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePage.h; sourceTree = "<group>"; }; + BCC9981611D3F51E0017BCA2 /* LayoutTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutTestController.h; sourceTree = "<group>"; }; + BCC9981711D3F51E0017BCA2 /* LayoutTestController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutTestController.cpp; sourceTree = "<group>"; }; BCD7D2F611921278006DB7EE /* TestInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestInvocation.h; sourceTree = "<group>"; }; BCD7D2F711921278006DB7EE /* TestInvocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInvocation.cpp; sourceTree = "<group>"; }; BCDA2ABE1190B51A00C3BC47 /* TestInvocationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestInvocationMac.mm; sourceTree = "<group>"; }; @@ -141,7 +150,13 @@ BC25183511D1571D002EBC01 /* InjectedBundle */ = { isa = PBXGroup; children = ( + BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */, + BCC997A111D3C8F60017BCA2 /* InjectedBundle.h */, BC25184611D15767002EBC01 /* InjectedBundleMain.cpp */, + BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */, + BCC997A311D3C8F60017BCA2 /* InjectedBundlePage.h */, + BCC9981611D3F51E0017BCA2 /* LayoutTestController.h */, + BCC9981711D3F51E0017BCA2 /* LayoutTestController.cpp */, ); path = InjectedBundle; sourceTree = "<group>"; @@ -262,6 +277,9 @@ buildActionMask = 2147483647; files = ( BC251A3E11D16831002EBC01 /* InjectedBundleMain.cpp in Sources */, + BCC997A411D3C8F60017BCA2 /* InjectedBundle.cpp in Sources */, + BCC997A511D3C8F60017BCA2 /* InjectedBundlePage.cpp in Sources */, + BCC9981811D3F51E0017BCA2 /* LayoutTestController.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |