OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 TEST_F(CreatePluginPlaceholderTest, MissingPlugin) { | 127 TEST_F(CreatePluginPlaceholderTest, MissingPlugin) { |
128 GURL url("http://www.example.com/example.swf"); | 128 GURL url("http://www.example.com/example.swf"); |
129 std::string mime_type("application/x-shockwave-flash"); | 129 std::string mime_type("application/x-shockwave-flash"); |
130 | 130 |
131 blink::WebPluginParams params; | 131 blink::WebPluginParams params; |
132 params.url = url; | 132 params.url = url; |
133 params.mimeType = base::ASCIIToUTF16(mime_type); | 133 params.mimeType = base::ASCIIToUTF16(mime_type); |
134 | 134 |
135 ChromeViewHostMsg_GetPluginInfo_Output output; | 135 ChromeViewHostMsg_GetPluginInfo_Output output; |
136 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; | 136 output.status = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; |
137 | 137 |
138 ScopedMockPluginInfoFilter filter(render_thread_.get()); | 138 ScopedMockPluginInfoFilter filter(render_thread_.get()); |
139 #if defined(ENABLE_PLUGINS) | 139 #if defined(ENABLE_PLUGINS) |
140 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) | 140 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) |
141 .WillOnce(SetArgPointee<4>(output)); | 141 .WillOnce(SetArgPointee<4>(output)); |
142 #endif | 142 #endif |
143 | 143 |
144 scoped_ptr<blink::WebPluginPlaceholder> placeholder = | 144 scoped_ptr<blink::WebPluginPlaceholder> placeholder = |
145 content_renderer_client_->CreatePluginPlaceholder( | 145 content_renderer_client_->CreatePluginPlaceholder( |
146 GetMainRenderFrame(), GetMainFrame(), params); | 146 GetMainRenderFrame(), GetMainFrame(), params); |
147 ASSERT_NE(nullptr, placeholder); | 147 ASSERT_NE(nullptr, placeholder); |
148 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_SUPPORTED), | 148 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_SUPPORTED), |
149 placeholder->message()); | 149 placeholder->message()); |
150 } | 150 } |
151 | 151 |
152 TEST_F(CreatePluginPlaceholderTest, PluginFound) { | 152 TEST_F(CreatePluginPlaceholderTest, PluginFound) { |
153 GURL url("http://www.example.com/example.swf"); | 153 GURL url("http://www.example.com/example.swf"); |
154 std::string mime_type(content::kFlashPluginSwfMimeType); | 154 std::string mime_type(content::kFlashPluginSwfMimeType); |
155 | 155 |
156 blink::WebPluginParams params; | 156 blink::WebPluginParams params; |
157 params.url = url; | 157 params.url = url; |
158 params.mimeType = base::ASCIIToUTF16(mime_type); | 158 params.mimeType = base::ASCIIToUTF16(mime_type); |
159 | 159 |
160 ChromeViewHostMsg_GetPluginInfo_Output output; | 160 ChromeViewHostMsg_GetPluginInfo_Output output; |
161 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; | 161 output.status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; |
162 | 162 |
163 ScopedMockPluginInfoFilter filter(render_thread_.get()); | 163 ScopedMockPluginInfoFilter filter(render_thread_.get()); |
164 #if defined(ENABLE_PLUGINS) | 164 #if defined(ENABLE_PLUGINS) |
165 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) | 165 EXPECT_CALL(filter, OnGetPluginInfo(GetRoutingID(), url, _, mime_type, _)) |
166 .WillOnce(SetArgPointee<4>(output)); | 166 .WillOnce(SetArgPointee<4>(output)); |
167 #endif | 167 #endif |
168 | 168 |
169 scoped_ptr<blink::WebPluginPlaceholder> placeholder = | 169 scoped_ptr<blink::WebPluginPlaceholder> placeholder = |
170 content_renderer_client_->CreatePluginPlaceholder( | 170 content_renderer_client_->CreatePluginPlaceholder( |
171 GetMainRenderFrame(), GetMainFrame(), params); | 171 GetMainRenderFrame(), GetMainFrame(), params); |
172 EXPECT_EQ(nullptr, placeholder); | 172 EXPECT_EQ(nullptr, placeholder); |
173 } | 173 } |
OLD | NEW |