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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebHelperPluginTest.cpp

Issue 2041263002: Remove the use of OwnedPtrDeleter in WebHelperPlugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "public/web/WebHelperPlugin.h" 5 #include "public/web/WebHelperPlugin.h"
6 6
7 #include "platform/testing/UnitTestHelpers.h" 7 #include "platform/testing/UnitTestHelpers.h"
8 #include "public/web/WebFrameClient.h" 8 #include "public/web/WebFrameClient.h"
9 #include "public/web/WebLocalFrame.h" 9 #include "public/web/WebLocalFrame.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void destroyHelperPlugin() 53 void destroyHelperPlugin()
54 { 54 {
55 m_plugin.reset(); 55 m_plugin.reset();
56 // WebHelperPlugin is destroyed by a task posted to the message loop. 56 // WebHelperPlugin is destroyed by a task posted to the message loop.
57 testing::runPendingTasks(); 57 testing::runPendingTasks();
58 } 58 }
59 59
60 FrameTestHelpers::WebViewHelper m_helper; 60 FrameTestHelpers::WebViewHelper m_helper;
61 WebHelperPluginFrameClient m_frameClient; 61 WebHelperPluginFrameClient m_frameClient;
62 OwnPtr<WebHelperPlugin> m_plugin; 62 WebHelperPluginUniquePtr m_plugin;
63 }; 63 };
64 64
65 TEST_F(WebHelperPluginTest, CreateAndDestroyAfterWebViewDestruction) 65 TEST_F(WebHelperPluginTest, CreateAndDestroyAfterWebViewDestruction)
66 { 66 {
67 m_plugin = adoptPtr(WebHelperPlugin::create("hello", m_helper.webView()->mai nFrame()->toWebLocalFrame())); 67 m_plugin.reset(WebHelperPlugin::create("hello", m_helper.webView()->mainFram e()->toWebLocalFrame()));
68 EXPECT_TRUE(m_plugin); 68 EXPECT_TRUE(m_plugin);
69 EXPECT_TRUE(m_plugin->getPlugin()); 69 EXPECT_TRUE(m_plugin->getPlugin());
70 70
71 m_helper.reset(); 71 m_helper.reset();
72 destroyHelperPlugin(); 72 destroyHelperPlugin();
73 } 73 }
74 74
75 TEST_F(WebHelperPluginTest, CreateAndDestroyBeforeWebViewDestruction) 75 TEST_F(WebHelperPluginTest, CreateAndDestroyBeforeWebViewDestruction)
76 { 76 {
77 m_plugin = adoptPtr(WebHelperPlugin::create("hello", m_helper.webView()->mai nFrame()->toWebLocalFrame())); 77 m_plugin.reset(WebHelperPlugin::create("hello", m_helper.webView()->mainFram e()->toWebLocalFrame()));
78 EXPECT_TRUE(m_plugin); 78 EXPECT_TRUE(m_plugin);
79 EXPECT_TRUE(m_plugin->getPlugin()); 79 EXPECT_TRUE(m_plugin->getPlugin());
80 80
81 destroyHelperPlugin(); 81 destroyHelperPlugin();
82 m_helper.reset(); 82 m_helper.reset();
83 } 83 }
84 84
85 TEST_F(WebHelperPluginTest, CreateFailsWithPlaceholder) 85 TEST_F(WebHelperPluginTest, CreateFailsWithPlaceholder)
86 { 86 {
87 m_frameClient.setCreatePlaceholder(true); 87 m_frameClient.setCreatePlaceholder(true);
88 88
89 m_plugin = adoptPtr(WebHelperPlugin::create("hello", m_helper.webView()->mai nFrame()->toWebLocalFrame())); 89 m_plugin.reset(WebHelperPlugin::create("hello", m_helper.webView()->mainFram e()->toWebLocalFrame()));
90 EXPECT_EQ(0, m_plugin.get()); 90 EXPECT_EQ(0, m_plugin.get());
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 94
95 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698