OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
11 #include "content/browser/frame_host/render_frame_host_impl.h" | 11 #include "content/browser/frame_host/render_frame_host_impl.h" |
12 #include "content/browser/renderer_host/render_message_filter.h" | 12 #include "content/browser/frame_host/render_frame_message_filter.h" |
13 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 13 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
14 #include "content/browser/renderer_host/render_widget_helper.h" | 14 #include "content/browser/renderer_host/render_widget_helper.h" |
15 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
16 #include "content/common/input_messages.h" | 16 #include "content/common/input_messages.h" |
17 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
18 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/storage_partition.h" | 20 #include "content/public/browser/storage_partition.h" |
21 #include "content/public/common/bindings_policy.h" | 21 #include "content/public/common/bindings_policy.h" |
22 #include "content/public/common/drop_data.h" | 22 #include "content/public/common/drop_data.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 TEST_F(RenderViewHostTest, RoutingIdSane) { | 239 TEST_F(RenderViewHostTest, RoutingIdSane) { |
240 RenderFrameHostImpl* root_rfh = | 240 RenderFrameHostImpl* root_rfh = |
241 contents()->GetFrameTree()->root()->current_frame_host(); | 241 contents()->GetFrameTree()->root()->current_frame_host(); |
242 EXPECT_EQ(contents()->GetMainFrame(), root_rfh); | 242 EXPECT_EQ(contents()->GetMainFrame(), root_rfh); |
243 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); | 243 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); |
244 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); | 244 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); |
245 } | 245 } |
246 | 246 |
247 class TestSaveImageFromDataURL : public RenderMessageFilter { | 247 class TestSaveImageFromDataURL : public RenderFrameMessageFilter { |
248 public: | 248 public: |
249 TestSaveImageFromDataURL(BrowserContext* context) | 249 TestSaveImageFromDataURL(BrowserContext* context) |
250 : RenderMessageFilter(0, | 250 : RenderFrameMessageFilter( |
251 context, | 251 0, |
252 BrowserContext::GetDefaultStoragePartition(context) | 252 nullptr, |
253 ->GetURLRequestContext(), | 253 context, |
254 nullptr, | 254 BrowserContext::GetDefaultStoragePartition(context) |
255 nullptr, | 255 ->GetURLRequestContext(), |
256 nullptr, | 256 nullptr) { |
257 nullptr, | |
258 nullptr) { | |
259 Reset(); | 257 Reset(); |
260 } | 258 } |
261 | 259 |
262 void Reset() { | 260 void Reset() { |
263 url_string_ = std::string(); | 261 url_string_ = std::string(); |
264 is_downloaded_ = false; | 262 is_downloaded_ = false; |
265 } | 263 } |
266 | 264 |
267 std::string& UrlString() const { | 265 std::string& UrlString() const { |
268 return url_string_; | 266 return url_string_; |
269 } | 267 } |
270 | 268 |
271 bool IsDownloaded() const { | 269 bool IsDownloaded() const { |
272 return is_downloaded_; | 270 return is_downloaded_; |
273 } | 271 } |
274 | 272 |
275 void Test(const std::string& url) { | 273 void Test(const std::string& url) { |
276 OnMessageReceived(ViewHostMsg_SaveImageFromDataURL(0, 0, url)); | 274 OnMessageReceived(FrameHostMsg_SaveImageFromDataURL(0, 0, url)); |
277 } | 275 } |
278 | 276 |
279 protected: | 277 protected: |
280 ~TestSaveImageFromDataURL() override {} | 278 ~TestSaveImageFromDataURL() override {} |
281 void DownloadUrl(int render_view_id, | 279 void DownloadUrl(int render_view_id, |
282 int render_frame_id, | 280 int render_frame_id, |
283 const GURL& url, | 281 const GURL& url, |
284 const Referrer& referrer, | 282 const Referrer& referrer, |
285 const base::string16& suggested_name, | 283 const base::string16& suggested_name, |
286 const bool use_prompt) const override { | 284 const bool use_prompt) const override { |
(...skipping 18 matching lines...) Expand all Loading... |
305 const std::string data_url = "data:image/gif;base64," | 303 const std::string data_url = "data:image/gif;base64," |
306 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; | 304 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; |
307 | 305 |
308 tester->Reset(); | 306 tester->Reset(); |
309 tester->Test(data_url); | 307 tester->Test(data_url); |
310 EXPECT_EQ(tester->UrlString(), data_url); | 308 EXPECT_EQ(tester->UrlString(), data_url); |
311 EXPECT_TRUE(tester->IsDownloaded()); | 309 EXPECT_TRUE(tester->IsDownloaded()); |
312 } | 310 } |
313 | 311 |
314 } // namespace content | 312 } // namespace content |
OLD | NEW |