Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: Source/web/tests/WebPluginContainerTest.cpp

Issue 1308663004: Don't leak TestPluginWebFrameClient in WebPluginContainerTests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebPluginContainerTest.cpp
diff --git a/Source/web/tests/WebPluginContainerTest.cpp b/Source/web/tests/WebPluginContainerTest.cpp
index 1187ff9ed54465f1dd0113d3371581cfc05c8a54..898bae924d7435a2c028415649cd87a9358ac6f5 100644
--- a/Source/web/tests/WebPluginContainerTest.cpp
+++ b/Source/web/tests/WebPluginContainerTest.cpp
@@ -131,8 +131,9 @@ WebPluginContainer* getWebPluginContainer(WebView* webView, const WebString& id)
TEST_F(WebPluginContainerTest, WindowToLocalPointTest)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_container.html"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, new TestPluginWebFrameClient());
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
@@ -162,9 +163,9 @@ TEST_F(WebPluginContainerTest, PrintOnePage)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- TestPluginWebFrameClient* testClient = new TestPluginWebFrameClient();
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, testClient);
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, &pluginWebFrameClient);
ASSERT(webView);
webView->layout();
runPendingTasks();
@@ -178,16 +179,16 @@ TEST_F(WebPluginContainerTest, PrintOnePage)
SkPictureRecorder recorder;
frame->printPage(0, recorder.beginRecording(IntRect()));
frame->printEnd();
- ASSERT(testClient->printedAtLeastOnePage());
+ ASSERT(pluginWebFrameClient.printedAtLeastOnePage());
}
TEST_F(WebPluginContainerTest, PrintAllPages)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- TestPluginWebFrameClient* testClient = new TestPluginWebFrameClient();
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, testClient);
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, &pluginWebFrameClient);
ASSERT(webView);
webView->layout();
runPendingTasks();
@@ -201,7 +202,7 @@ TEST_F(WebPluginContainerTest, PrintAllPages)
SkPictureRecorder recorder;
frame->printPagesWithBoundaries(recorder.beginRecording(IntRect()), WebSize());
frame->printEnd();
- ASSERT(testClient->printedAtLeastOnePage());
+ ASSERT(pluginWebFrameClient.printedAtLeastOnePage());
}
TEST_F(WebPluginContainerTest, LocalToWindowPointTest)
@@ -238,8 +239,9 @@ TEST_F(WebPluginContainerTest, LocalToWindowPointTest)
TEST_F(WebPluginContainerTest, Copy)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_container.html"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, new TestPluginWebFrameClient());
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
@@ -258,8 +260,9 @@ TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest)
URLTestHelpers::registerMockedURLFromBaseURL(
WebString::fromUTF8(m_baseURL.c_str()),
WebString::fromUTF8("plugin_container.html"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, new TestPluginWebFrameClient());
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
@@ -360,8 +363,9 @@ TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin)
TEST_F(WebPluginContainerTest, IsRectTopmostTest)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_container.html"));
+ TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
- WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, new TestPluginWebFrameClient());
+ WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698