RESOLVED FIXED Bug 33167
Add a test harness for the Windows WebKit API, and a few tests
https://bugs.webkit.org/show_bug.cgi?id=33167
Summary Add a test harness for the Windows WebKit API, and a few tests
Adam Roben (:aroben)
Reported 2010-01-04 12:02:59 PST
Created attachment 45814 [details] Patch We currently only have tests for a handful of bugs regarding WebView destruction, but more tests can easily be added later. Eventually we'll run these tests as part of run-webkit-tests. Need a short description and bug URL (OOPS!) Reviewed by NOBODY (OOPS!). WebKit/win: * WebKit.vcproj/WebKit.sln: Added WebKitAPITest.vcproj. It builds just after DumpRenderTree.vcproj. WebKitTools: * WebKitAPITest/HostWindow.cpp: Added. (WebKitAPITest::HostWindow::HostWindow): Initialize m_window. (WebKitAPITest::HostWindow::~HostWindow): Destroy our window if needed. (WebKitAPITest::HostWindow::initialize): Create our window. (WebKitAPITest::HostWindow::clientRect): Return our window's client rect. (WebKitAPITest::HostWindow::registerWindowClass): Does what it says. (WebKitAPITest::hostWindow): Return the HostWindow associated with this HWND. (WebKitAPITest::HostWindow::wndProc): Just call through to DefWindowProcW. * WebKitAPITest/HostWindow.h: Added. (WebKitAPITest::HostWindow::window): Simple getter. * WebKitAPITest/Test.h: Added. This file defines some macros useful for writing tests. * WebKitAPITest/TestsController.cpp: Added. (WebKitAPITest::TestsController::TestsController): Initialize our members. (WebKitAPITest::TestsController::shared): Return the shared instance. (WebKitAPITest::TestsController::runAllTests): Run a message pump until a WM_QUIT message is received, then return whether all tests succeeded. (WebKitAPITest::TestsController::addTest): Add the test to m_tests and start running tests soon. (WebKitAPITest::TestsController::testFailed): Record the failure and print a message about it to stdout. (WebKitAPITest::TestsController::runNextTest): If we don't have any tests to run, post a WM_QUIT message to stop the message pump. Otherwise, run the test and print whether it passed, then schedule the next test. (WebKitAPITest::TestsController::runNextTestSoon): Set a 0-delay timer to run the next test. (WebKitAPITest::TestsController::registerWindowClass): Does what it says. (WebKitAPITest::TestsController::wndProc): If the runNextTestTimer fired, call runNextTest(). Pass everything else through to DefWindowProcW. * WebKitAPITest/TestsController.h: Added. * WebKitAPITest/WebKitAPITest.vcproj: Added. * WebKitAPITest/WebKitAPITestCommon.vsprops: Added. * WebKitAPITest/main.cpp: Added. (main): (Mostly) just calls TestsController::runAllTests. * WebKitAPITest/tests/WebViewDestruction.cpp: Added. (WebKitAPITest::WebKitCreateInstance): Helper function template to call through to the real WebKitCreateInstance. (WebKitAPITest::webViewCount): Helper function to call through to IWebKitStatistics::webViewCount. (WebKitAPITest::createWebView): Helper function to create a WebView and put it inside a HostWindow. (WebKitAPITest::runMessagePump): Helper function to run a message pump for a specified number of milliseconds, or until a WM_QUIT message is received. (WebKitAPITest::CloseWithoutDestroyWindow): Test for <http://webkit.org/b/32827>. (WebKitAPITest::MainFrameAfterClose): Test for <http://webkit.org/b/32868>. (WebKitAPITest::NoCloseOrDestroyWindow): Test for <http://webkit.org/b/33162>. --- 12 files changed, 1026 insertions(+), 0 deletions(-)
Attachments
Patch (51.63 KB, patch)
2010-01-04 12:02 PST, Adam Roben (:aroben)
sam: review+
WebKit Review Bot
Comment 1 2010-01-04 12:06:57 PST
Attachment 45814 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebKitTools/WebKitAPITest/HostWindow.cpp:25: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] WebKitTools/WebKitAPITest/main.cpp:25: Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] WebKitTools/WebKitAPITest/Test.h:51: TEST_CLASS_NAME is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] WebKitTools/WebKitAPITest/Test.h:53: TEST_CLASS_NAME is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] WebKitTools/WebKitAPITest/Test.h:55: More than one command on the same line [whitespace/newline] [4] WebKitTools/WebKitAPITest/Test.h:57: One line control clauses should not use braces. [whitespace/braces] [4] WebKitTools/WebKitAPITest/TestsController.cpp:25: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] WebKitTools/WebKitAPITest/TestsController.h:30: Alphabetical sorting problem. [build/include_order] [4] WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp:25: Found other header before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] Total errors found: 9
Adam Roben (:aroben)
Comment 2 2010-01-04 12:09:38 PST
I think most/all of the style errors in comment 1 are bugs with the style queue. I will file bugs about the issues.
Sam Weinig
Comment 3 2010-01-04 12:55:50 PST
Comment on attachment 45814 [details] Patch You may want to switch to COMPtr to appease the masses, but otherwise, r=me.
Adam Roben (:aroben)
Comment 4 2010-01-04 13:20:28 PST
Note You need to log in before you can comment on or make changes to this bug.