[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
aroben at apple.com
aroben at apple.com
Wed Jan 20 22:13:00 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 7523364a8cd85490c4c3b7008ecaea373f288132
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 5 18:14:58 2010 +0000
Share more code in the WebViewDestruction tests
Part of <http://webkit.org/b/33212> Small fixes/improvements to
WebKitAPITest
Reviewed by Sam Weinig.
* WebKitAPITest/tests/WebViewDestruction.cpp:
(WebKitAPITest::createAndInitializeWebView): Renamed from
createWebView. Now initializes the HostWindow and returns the
WebView's HWND via an out-parameter.
(WebKitAPITest::finishWebViewDestructionTest): Added. Code came from
the CloseWithoutDestroyWindow test.
(WebKitAPITest::CloseWithoutDestroyViewWindow): Renamed from
CloseWithoutDestroyWindow and changed to use the new functions.
(WebKitAPITest::MainFrameAfterClose): Changed to use the new
functions.
(WebKitAPITest::NoCloseOrDestroyViewWindow): Renamed from
NoCloseOrDestroyWindow and changed to use the new functions.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index bdd852d..e9c88d2 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,27 @@
2010-01-05 Adam Roben <aroben at apple.com>
+ Share more code in the WebViewDestruction tests
+
+ Part of <http://webkit.org/b/33212> Small fixes/improvements to
+ WebKitAPITest
+
+ Reviewed by Sam Weinig.
+
+ * WebKitAPITest/tests/WebViewDestruction.cpp:
+ (WebKitAPITest::createAndInitializeWebView): Renamed from
+ createWebView. Now initializes the HostWindow and returns the
+ WebView's HWND via an out-parameter.
+ (WebKitAPITest::finishWebViewDestructionTest): Added. Code came from
+ the CloseWithoutDestroyWindow test.
+ (WebKitAPITest::CloseWithoutDestroyViewWindow): Renamed from
+ CloseWithoutDestroyWindow and changed to use the new functions.
+ (WebKitAPITest::MainFrameAfterClose): Changed to use the new
+ functions.
+ (WebKitAPITest::NoCloseOrDestroyViewWindow): Renamed from
+ NoCloseOrDestroyWindow and changed to use the new functions.
+
+2010-01-05 Adam Roben <aroben at apple.com>
+
Don't show HostWindows by default
This was making WebKitAPITest very flashy as windows appeared and
diff --git a/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp b/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp
index 53f4eb4..0c4637e 100644
--- a/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp
+++ b/WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp
@@ -48,19 +48,21 @@ static int webViewCount()
return count;
}
-static COMPtr<IWebView> createWebView(const HostWindow& window)
+static void createAndInitializeWebView(COMPtr<IWebView>& outWebView, HostWindow& window, HWND& viewWindow)
{
COMPtr<IWebView> webView;
- if (FAILED(WebKitCreateInstance(__uuidof(WebView), &webView)))
- return 0;
+ TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView)));
- if (FAILED(webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(window.window()))))
- return 0;
+ TEST_ASSERT(window.initialize());
+ TEST_ASSERT(SUCCEEDED(webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(window.window()))));
+ TEST_ASSERT(SUCCEEDED(webView->initWithFrame(window.clientRect(), 0, 0)));
- if (FAILED(webView->initWithFrame(window.clientRect(), 0, 0)))
- return 0;
+ COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
+ TEST_ASSERT(viewPrivate);
+ TEST_ASSERT(SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))));
+ TEST_ASSERT(IsWindow(viewWindow));
- return webView;
+ outWebView.adoptRef(webView.releaseRef());
}
static void runMessagePump(DWORD timeoutMilliseconds)
@@ -76,60 +78,58 @@ static void runMessagePump(DWORD timeoutMilliseconds)
}
}
-// Tests that calling IWebView::close without calling DestroyWindow, then releasing a WebView doesn't crash. <http://webkit.org/b/32827>
-TEST(WebViewDestruction, CloseWithoutDestroyWindow)
+static void finishWebViewDestructionTest(COMPtr<IWebView>& webView, HWND viewWindow)
{
- HostWindow window;
- TEST_ASSERT(window.initialize());
- COMPtr<IWebView> webView = createWebView(window);
- TEST_ASSERT(webView);
-
- TEST_ASSERT(SUCCEEDED(webView->close()));
-
- // Allow window messages to be processed to trigger the crash.
+ // 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 gets destroyed and the WebView doesn't leak.
- COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
- TEST_ASSERT(viewPrivate);
-
- HWND viewWindow;
- TEST_ASSERT(SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))));
- TEST_ASSERT(viewWindow);
-
+ // 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;
- viewPrivate = 0;
TEST_ASSERT(webViewCount() == currentWebViewCount - 1);
TEST_ASSERT(!IsWindow(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);
+}
+
// 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;
- TEST_ASSERT(window.initialize());
- COMPtr<IWebView> webView = createWebView(window);
- TEST_ASSERT(webView);
+ HWND viewWindow;
+ createAndInitializeWebView(webView, window, viewWindow);
TEST_ASSERT(SUCCEEDED(webView->close()));
COMPtr<IWebFrame> mainFrame;
TEST_ASSERT(SUCCEEDED(webView->mainFrame(&mainFrame)));
+
+ finishWebViewDestructionTest(webView, viewWindow);
}
// Tests that releasing a WebView without calling IWebView::close or DestroyWindow doesn't leak. <http://webkit.org/b/33162>
-TEST(WebViewDestruction, NoCloseOrDestroyWindow)
+TEST(WebViewDestruction, NoCloseOrDestroyViewWindow)
{
+ COMPtr<IWebView> webView;
HostWindow window;
- TEST_ASSERT(window.initialize());
- COMPtr<IWebView> webView = createWebView(window);
- TEST_ASSERT(webView);
+ HWND viewWindow;
+ createAndInitializeWebView(webView, window, viewWindow);
- webView = 0;
- TEST_ASSERT(!webViewCount());
+ finishWebViewDestructionTest(webView, viewWindow);
}
} // namespace WebKitAPITest
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list