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

Side by Side Diff: Source/web/tests/FrameLoaderClientImplTest.cpp

Issue 1303233007: Blink Plugins: Remove Shadow DOM plugin placeholder tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/web/PluginPlaceholderImplTest.cpp ('k') | Source/web/web.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "web/FrameLoaderClientImpl.h" 32 #include "web/FrameLoaderClientImpl.h"
33 33
34 #include "core/loader/FrameLoader.h" 34 #include "core/loader/FrameLoader.h"
35 #include "platform/weborigin/KURL.h" 35 #include "platform/weborigin/KURL.h"
36 #include "public/web/WebFrameClient.h" 36 #include "public/web/WebFrameClient.h"
37 #include "public/web/WebPluginParams.h"
38 #include "public/web/WebPluginPlaceholder.h"
39 #include "public/web/WebSettings.h" 37 #include "public/web/WebSettings.h"
40 #include "public/web/WebView.h" 38 #include "public/web/WebView.h"
41 #include "web/PluginPlaceholderImpl.h"
42 #include "web/WebLocalFrameImpl.h" 39 #include "web/WebLocalFrameImpl.h"
43 #include "web/tests/FrameTestHelpers.h" 40 #include "web/tests/FrameTestHelpers.h"
44 #include "wtf/text/CString.h" 41 #include "wtf/text/CString.h"
45 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
46 #include <gmock/gmock.h> 43 #include <gmock/gmock.h>
47 #include <gtest/gtest.h> 44 #include <gtest/gtest.h>
48 45
49 using testing::_; 46 using testing::_;
50 using testing::Mock; 47 using testing::Mock;
51 using testing::Return; 48 using testing::Return;
52 49
53 namespace blink { 50 namespace blink {
54 namespace { 51 namespace {
55 52
56 class MockWebFrameClient : public WebFrameClient { 53 class MockWebFrameClient : public WebFrameClient {
57 public: 54 public:
58 ~MockWebFrameClient() override { } 55 ~MockWebFrameClient() override { }
59 56
60 MOCK_METHOD2(userAgentOverride, WebString(WebLocalFrame*, const WebURL&)); 57 MOCK_METHOD2(userAgentOverride, WebString(WebLocalFrame*, const WebURL&));
61 MOCK_METHOD2(createPluginPlaceholder, WebPluginPlaceholder*(WebLocalFrame*, const WebPluginParams&));
62 }; 58 };
63 59
64 class FrameLoaderClientImplTest : public ::testing::Test { 60 class FrameLoaderClientImplTest : public ::testing::Test {
65 protected: 61 protected:
66 void SetUp() override 62 void SetUp() override
67 { 63 {
68 ON_CALL(m_webFrameClient, userAgentOverride(_, _)).WillByDefault(Return( WebString())); 64 ON_CALL(m_webFrameClient, userAgentOverride(_, _)).WillByDefault(Return( WebString()));
69 65
70 FrameTestHelpers::TestWebViewClient webViewClient; 66 FrameTestHelpers::TestWebViewClient webViewClient;
71 m_webView = WebView::create(&webViewClient); 67 m_webView = WebView::create(&webViewClient);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Override the user agent and make sure we get it back. 107 // Override the user agent and make sure we get it back.
112 EXPECT_CALL(webFrameClient(), userAgentOverride(_, _)).WillOnce(Return(overr ideUserAgent)); 108 EXPECT_CALL(webFrameClient(), userAgentOverride(_, _)).WillOnce(Return(overr ideUserAgent));
113 EXPECT_TRUE(overrideUserAgent.equals(userAgent())); 109 EXPECT_TRUE(overrideUserAgent.equals(userAgent()));
114 Mock::VerifyAndClearExpectations(&webFrameClient()); 110 Mock::VerifyAndClearExpectations(&webFrameClient());
115 111
116 // Remove the override and make sure we get the original back. 112 // Remove the override and make sure we get the original back.
117 EXPECT_CALL(webFrameClient(), userAgentOverride(_, _)).WillOnce(Return(WebSt ring())); 113 EXPECT_CALL(webFrameClient(), userAgentOverride(_, _)).WillOnce(Return(WebSt ring()));
118 EXPECT_TRUE(defaultUserAgent.equals(userAgent())); 114 EXPECT_TRUE(defaultUserAgent.equals(userAgent()));
119 } 115 }
120 116
121 TEST_F(FrameLoaderClientImplTest, CreatePluginPlaceholderForwardsToWebFrameClien t)
122 {
123 KURL url(ParsedURLString, "http://www.example.com/plugin.swf");
124 Vector<String> paramNames(1, "param");
125 Vector<String> paramValues(1, "value");
126 String mimeType = "application/x-shockwave-flash";
127 bool loadManually = false;
128
129 // Test with a valid WebPluginPlaceholder.
130 {
131 WebPluginPlaceholder* webPluginPlaceholder = new WebPluginPlaceholder;
132 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _))
133 .WillOnce(Return(webPluginPlaceholder));
134 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli ent().createPluginPlaceholder(
135 document(), url, paramNames, paramValues, mimeType, loadManually);
136 ASSERT_TRUE(pluginPlaceholder);
137 EXPECT_EQ(webPluginPlaceholder, static_cast<PluginPlaceholderImpl*>(plug inPlaceholder.get())->webPluginPlaceholder());
138 }
139
140 // Test with no WebPluginPlaceholder.
141 {
142 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _))
143 .WillOnce(Return(nullptr));
144 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli ent().createPluginPlaceholder(
145 document(), url, paramNames, paramValues, mimeType, loadManually);
146 ASSERT_FALSE(pluginPlaceholder);
147 }
148 }
149
150 } // namespace 117 } // namespace
151 } // namespace blink 118 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/PluginPlaceholderImplTest.cpp ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698