diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/WebKitAPITest | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/WebKitAPITest')
-rw-r--r-- | WebKitTools/WebKitAPITest/HostWindow.cpp | 83 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/HostWindow.h | 51 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/Test.h | 59 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/TestsController.cpp | 147 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/TestsController.h | 65 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/WebKitAPITest.vcproj | 419 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops | 29 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/main.cpp | 35 | ||||
-rw-r--r-- | WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp | 230 |
9 files changed, 0 insertions, 1118 deletions
diff --git a/WebKitTools/WebKitAPITest/HostWindow.cpp b/WebKitTools/WebKitAPITest/HostWindow.cpp deleted file mode 100644 index b364831..0000000 --- a/WebKitTools/WebKitAPITest/HostWindow.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 "HostWindow.h" - -namespace WebKitAPITest { - -static LPCWSTR hostWindowClassName = L"HostWindow"; - -HostWindow::HostWindow() - : m_window(0) -{ -} - -bool HostWindow::initialize() -{ - registerWindowClass(); - m_window = CreateWindowExW(0, hostWindowClassName, L"WebKitAPITest", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, GetModuleHandle(0), 0); - return m_window; -} - -HostWindow::~HostWindow() -{ - if (!IsWindow(m_window)) - return; - DestroyWindow(m_window); -} - -RECT HostWindow::clientRect() const -{ - RECT rect = {0}; - if (!GetClientRect(m_window, &rect)) { - RECT emptyRect = {0}; - return emptyRect; - } - return rect; -} - -void HostWindow::registerWindowClass() -{ - static bool initialized; - if (initialized) - return; - initialized = true; - - WNDCLASSEXW wndClass = {0}; - wndClass.cbSize = sizeof(wndClass); - wndClass.style = CS_HREDRAW | CS_VREDRAW; - wndClass.lpfnWndProc = wndProc; - wndClass.hCursor = LoadCursor(0, IDC_ARROW); - wndClass.hInstance = GetModuleHandle(0); - wndClass.lpszClassName = hostWindowClassName; - - RegisterClassExW(&wndClass); -} - -LRESULT HostWindow::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProcW(hWnd, uMsg, wParam, lParam); -} - -} // namespace WebKitAPITest diff --git a/WebKitTools/WebKitAPITest/HostWindow.h b/WebKitTools/WebKitAPITest/HostWindow.h deleted file mode 100644 index a2734ed..0000000 --- a/WebKitTools/WebKitAPITest/HostWindow.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 HostWindow_h -#define HostWindow_h - -#include <windows.h> -#include <wtf/Noncopyable.h> - -namespace WebKitAPITest { - -class HostWindow : public Noncopyable { -public: - HostWindow(); - ~HostWindow(); - bool initialize(); - - RECT clientRect() const; - HWND window() const { return m_window; } - -private: - static void registerWindowClass(); - static LRESULT CALLBACK wndProc(HWND, UINT uMsg, WPARAM, LPARAM); - - HWND m_window; -}; - -} // namespace WebKitAPITest - -#endif // HostWindow_h diff --git a/WebKitTools/WebKitAPITest/Test.h b/WebKitTools/WebKitAPITest/Test.h deleted file mode 100644 index 33b07c9..0000000 --- a/WebKitTools/WebKitAPITest/Test.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 Test_h -#define Test_h - -#include "TestsController.h" - -namespace WebKitAPITest { - -// Abstract base class that all tests inherit from. -class Test { -public: - ~Test() { } - virtual const char* name() const = 0; - virtual void run() = 0; -}; - -#define TEST_CLASS_NAME(testCaseName, testName) testCaseName##_##testName##_Test - -// Use this to define a new test. -#define TEST(testCaseName, testName) \ - class TEST_CLASS_NAME(testCaseName, testName) : public Test { \ - public: \ - virtual const char* name() const { return #testCaseName ": " #testName; } \ - virtual void run(); \ - static const bool initialized; \ - }; \ - \ - const bool TEST_CLASS_NAME(testCaseName, testName)::initialized = (TestsController::shared().addTest(new TEST_CLASS_NAME(testCaseName, testName)), true); \ - \ - void TEST_CLASS_NAME(testCaseName, testName)::run() - -#define TEST_ASSERT(expression) do { if (!(expression)) { TestsController::shared().testFailed(__FILE__, __LINE__, #expression); return; } } while (0) - -} // namespace WebKitAPITest - -#endif // Test_h diff --git a/WebKitTools/WebKitAPITest/TestsController.cpp b/WebKitTools/WebKitAPITest/TestsController.cpp deleted file mode 100644 index 08b193a..0000000 --- a/WebKitTools/WebKitAPITest/TestsController.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 "TestsController.h" - -#include "Test.h" -#include <wtf/PassOwnPtr.h> - -using namespace std; - -namespace WebKitAPITest { - -static const LPCWSTR testsControllerWindowClassName = L"TestsControllerWindowClass"; - -enum { runNextTestTimerID = 1 }; - -inline TestsController::TestsController() - : m_testFailed(false) - , m_anyTestFailed(false) -{ - registerWindowClass(); - m_window = CreateWindowExW(0, testsControllerWindowClassName, 0, WS_CHILD, 0, 0, 0, 0, HWND_MESSAGE, 0, GetModuleHandle(0), 0); -} - -TestsController& TestsController::shared() -{ - static TestsController& shared = *new TestsController; - return shared; -} - -bool TestsController::runAllTests() -{ - if (m_tests.isEmpty()) - return true; - - MSG msg; - BOOL result; - while ((result = GetMessage(&msg, 0, 0, 0))) { - if (result == -1) - break; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if (msg.message != WM_QUIT) - return false; - - return !m_anyTestFailed; -} - -void TestsController::addTest(PassOwnPtr<Test> test) -{ - m_tests.append(test.leakPtr()); - runNextTestSoon(); -} - -void TestsController::testFailed(const char* file, int line, const char* message) -{ - ASSERT(!m_tests.isEmpty()); - - m_testFailed = true; - m_anyTestFailed = true; - - printf("FAIL: %s\n\t%s (%s:%d)\n", m_tests.first()->name(), message, file, line); - fflush(stdout); -} - -void TestsController::runNextTest() -{ - if (m_tests.isEmpty()) { - PostQuitMessage(0); - return; - } - - Test* test = m_tests.first(); - - m_testFailed = false; - printf("RUN: %s\n", test->name()); - fflush(stdout); - test->run(); - - if (!m_testFailed) { - printf("PASS: %s\n", test->name()); - fflush(stdout); - } - - m_tests.removeFirst(); - delete test; - - runNextTestSoon(); -} - -void TestsController::runNextTestSoon() -{ - SetTimer(m_window, runNextTestTimerID, 0, 0); -} - -void TestsController::registerWindowClass() -{ - static bool initialized; - if (initialized) - return; - initialized = true; - - WNDCLASSEXW wndClass = {0}; - wndClass.cbSize = sizeof(wndClass); - wndClass.lpfnWndProc = wndProc; - wndClass.hCursor = LoadCursor(0, IDC_ARROW); - wndClass.hInstance = GetModuleHandle(0); - wndClass.lpszClassName = testsControllerWindowClassName; - - RegisterClassExW(&wndClass); -} - -LRESULT TestsController::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - if (uMsg == WM_TIMER && wParam == runNextTestTimerID) { - KillTimer(hWnd, runNextTestTimerID); - TestsController::shared().runNextTest(); - return 0; - } - - return DefWindowProcW(hWnd, uMsg, wParam, lParam); -} - -} // namespace WebKitAPITest diff --git a/WebKitTools/WebKitAPITest/TestsController.h b/WebKitTools/WebKitAPITest/TestsController.h deleted file mode 100644 index 11b457d..0000000 --- a/WebKitTools/WebKitAPITest/TestsController.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 TestsController_h -#define TestsController_h - -#include <windows.h> -#include <wtf/Forward.h> -#include <wtf/Deque.h> -#include <wtf/Noncopyable.h> - -namespace WebKitAPITest { - -class Test; - -class TestsController : public Noncopyable { -public: - static TestsController& shared(); - - // Returns true if all the tests passed, false otherwise. - bool runAllTests(); - - void addTest(PassOwnPtr<Test>); - void testFailed(const char* file, int line, const char* message); - -private: - TestsController(); - ~TestsController(); - - void runNextTest(); - void runNextTestSoon(); - - static void registerWindowClass(); - static LRESULT CALLBACK wndProc(HWND, UINT uMsg, WPARAM, LPARAM); - - HWND m_window; - Deque<Test*> m_tests; - bool m_testFailed; - bool m_anyTestFailed; -}; - -} // namespace WebKitAPITest - -#endif // TestsController_h diff --git a/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj b/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj deleted file mode 100644 index c8fcbe9..0000000 --- a/WebKitTools/WebKitAPITest/WebKitAPITest.vcproj +++ /dev/null @@ -1,419 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="WebKitAPITest"
- ProjectGUID="{626089A3-25D3-4883-A96C-B8C66E036397}"
- RootNamespace="WebKitAPITest"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_LTCG|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WebKitAPITestCommon.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\HostWindow.cpp"
- >
- </File>
- <File
- RelativePath=".\HostWindow.h"
- >
- </File>
- <File
- RelativePath=".\main.cpp"
- >
- </File>
- <File
- RelativePath=".\Test.h"
- >
- </File>
- <File
- RelativePath=".\TestsController.cpp"
- >
- </File>
- <File
- RelativePath=".\TestsController.h"
- >
- </File>
- <File
- RelativePath=".\tests\WebViewDestruction.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops b/WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops deleted file mode 100644 index 789ec7e..0000000 --- a/WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="WebKitAPITestCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\WebCore\ForwardingHeaders""
- PreprocessorDefinitions="_CONSOLE;NOMINMAX"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="user32.lib ole32.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib"
- SubSystem="1"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
- />
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/WebKitAPITest/main.cpp b/WebKitTools/WebKitAPITest/main.cpp deleted file mode 100644 index a941c30..0000000 --- a/WebKitTools/WebKitAPITest/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 "TestsController.h" - -using namespace WebKitAPITest; - -int main(int, char*[]) -{ - // FIXME: Remove this line once <http://webkit.org/b/32867> is fixed. - OleInitialize(0); - - return !TestsController::shared().runAllTests(); -} diff --git a/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp b/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp deleted file mode 100644 index 6c09e6f..0000000 --- a/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * 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 "HostWindow.h" -#include "Test.h" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> -#include <wtf/PassOwnPtr.h> - -namespace WebKitAPITest { - -template <typename T> -static HRESULT WebKitCreateInstance(REFCLSID clsid, T** object) -{ - return WebKitCreateInstance(clsid, 0, __uuidof(T), reinterpret_cast<void**>(object)); -} - -static int webViewCount() -{ - COMPtr<IWebKitStatistics> statistics; - if (FAILED(WebKitCreateInstance(__uuidof(WebKitStatistics), &statistics))) - return -1; - int count; - if (FAILED(statistics->webViewCount(&count))) - return -1; - return count; -} - -static void createAndInitializeWebView(COMPtr<IWebView>& outWebView, HostWindow& window, HWND& viewWindow) -{ - COMPtr<IWebView> webView; - TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView))); - - TEST_ASSERT(window.initialize()); - TEST_ASSERT(SUCCEEDED(webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(window.window())))); - TEST_ASSERT(SUCCEEDED(webView->initWithFrame(window.clientRect(), 0, 0))); - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - TEST_ASSERT(viewPrivate); - TEST_ASSERT(SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))); - TEST_ASSERT(IsWindow(viewWindow)); - - outWebView.adoptRef(webView.releaseRef()); -} - -static void runMessagePump(DWORD timeoutMilliseconds) -{ - DWORD startTickCount = GetTickCount(); - MSG msg; - BOOL result; - while ((result = PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) && GetTickCount() - startTickCount <= timeoutMilliseconds) { - if (result == -1) - break; - TranslateMessage(&msg); - DispatchMessage(&msg); - } -} - -static void finishWebViewDestructionTest(COMPtr<IWebView>& webView, HWND viewWindow) -{ - // Allow window messages to be processed, because in some cases that would trigger a crash (e.g., <http://webkit.org/b/32827>). - runMessagePump(50); - - // We haven't crashed. Release the WebView and ensure that its view window has been destroyed and the WebView doesn't leak. - int currentWebViewCount = webViewCount(); - TEST_ASSERT(currentWebViewCount > 0); - - webView = 0; - - TEST_ASSERT(webViewCount() == currentWebViewCount - 1); - TEST_ASSERT(!IsWindow(viewWindow)); -} - -// Tests that releasing a WebView without calling IWebView::initWithFrame works. -TEST(WebViewDestruction, NoInitWithFrame) -{ - COMPtr<IWebView> webView; - TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView))); - - finishWebViewDestructionTest(webView, 0); -} - -TEST(WebViewDestruction, CloseWithoutInitWithFrame) -{ - COMPtr<IWebView> webView; - TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView))); - - TEST_ASSERT(SUCCEEDED(webView->close())); - - finishWebViewDestructionTest(webView, 0); -} - -// Tests that releasing a WebView without calling IWebView::close or DestroyWindow doesn't leak. <http://webkit.org/b/33162> -TEST(WebViewDestruction, NoCloseOrDestroyViewWindow) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - finishWebViewDestructionTest(webView, viewWindow); -} - -// Tests that calling IWebView::close without calling DestroyWindow, then releasing a WebView doesn't crash. <http://webkit.org/b/32827> -TEST(WebViewDestruction, CloseWithoutDestroyViewWindow) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - TEST_ASSERT(SUCCEEDED(webView->close())); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, DestroyViewWindowWithoutClose) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - DestroyWindow(viewWindow); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, CloseThenDestroyViewWindow) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - TEST_ASSERT(SUCCEEDED(webView->close())); - DestroyWindow(viewWindow); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, DestroyViewWindowThenClose) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - DestroyWindow(viewWindow); - TEST_ASSERT(SUCCEEDED(webView->close())); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, DestroyHostWindow) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - DestroyWindow(window.window()); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, DestroyHostWindowThenClose) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - DestroyWindow(window.window()); - TEST_ASSERT(SUCCEEDED(webView->close())); - - finishWebViewDestructionTest(webView, viewWindow); -} - -TEST(WebViewDestruction, CloseThenDestroyHostWindow) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - TEST_ASSERT(SUCCEEDED(webView->close())); - DestroyWindow(window.window()); - - finishWebViewDestructionTest(webView, viewWindow); -} - -// Tests that calling IWebView::mainFrame after calling IWebView::close doesn't crash. <http://webkit.org/b/32868> -TEST(WebViewDestruction, MainFrameAfterClose) -{ - COMPtr<IWebView> webView; - HostWindow window; - HWND viewWindow; - createAndInitializeWebView(webView, window, viewWindow); - - TEST_ASSERT(SUCCEEDED(webView->close())); - COMPtr<IWebFrame> mainFrame; - TEST_ASSERT(SUCCEEDED(webView->mainFrame(&mainFrame))); - - finishWebViewDestructionTest(webView, viewWindow); -} - -} // namespace WebKitAPITest |