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

Side by Side Diff: content/browser/renderer_host/test_render_view_host.cc

Issue 14727006: Check that the files the renderer wants to preserve as part of a session restore are already availa… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . not -> Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/test_render_view_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/renderer_host/test_render_view_host.h" 5 #include "content/browser/renderer_host/test_render_view_host.h"
6 6
7 #include "content/browser/dom_storage/dom_storage_context_impl.h" 7 #include "content/browser/dom_storage/dom_storage_context_impl.h"
8 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 8 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
9 #include "content/browser/renderer_host/test_backing_store.h" 9 #include "content/browser/renderer_host/test_backing_store.h"
10 #include "content/browser/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 void TestRenderViewHost::SendNavigateWithTransition( 283 void TestRenderViewHost::SendNavigateWithTransition(
284 int page_id, const GURL& url, PageTransition transition) { 284 int page_id, const GURL& url, PageTransition transition) {
285 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); 285 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200);
286 } 286 }
287 287
288 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( 288 void TestRenderViewHost::SendNavigateWithOriginalRequestURL(
289 int page_id, const GURL& url, const GURL& original_request_url) { 289 int page_id, const GURL& url, const GURL& original_request_url) {
290 OnDidStartProvisionalLoadForFrame(0, -1, true, url); 290 OnDidStartProvisionalLoadForFrame(0, -1, true, url);
291 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, 291 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK,
292 original_request_url, 200); 292 original_request_url, 200, 0);
293 }
294
295 void TestRenderViewHost::SendNavigateWithFile(
296 int page_id, const GURL& url, const base::FilePath& file_path) {
297 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK,
298 url, 200, &file_path);
293 } 299 }
294 300
295 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( 301 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode(
296 int page_id, const GURL& url, PageTransition transition, 302 int page_id, const GURL& url, PageTransition transition,
297 int response_code) { 303 int response_code) {
298 OnDidStartProvisionalLoadForFrame(0, -1, true, url); 304 OnDidStartProvisionalLoadForFrame(0, -1, true, url);
299 SendNavigateWithParameters(page_id, url, transition, url, response_code); 305 SendNavigateWithParameters(page_id, url, transition, url, response_code, 0);
300 } 306 }
301 307
302 void TestRenderViewHost::SendNavigateWithParameters( 308 void TestRenderViewHost::SendNavigateWithParameters(
303 int page_id, const GURL& url, PageTransition transition, 309 int page_id, const GURL& url, PageTransition transition,
304 const GURL& original_request_url, int response_code) { 310 const GURL& original_request_url, int response_code,
311 const base::FilePath* file_path_for_history_item) {
305 ViewHostMsg_FrameNavigate_Params params; 312 ViewHostMsg_FrameNavigate_Params params;
306
307 params.page_id = page_id; 313 params.page_id = page_id;
308 params.frame_id = 0; 314 params.frame_id = 0;
309 params.url = url; 315 params.url = url;
310 params.referrer = Referrer(); 316 params.referrer = Referrer();
311 params.transition = transition; 317 params.transition = transition;
312 params.redirects = std::vector<GURL>(); 318 params.redirects = std::vector<GURL>();
313 params.should_update_history = true; 319 params.should_update_history = true;
314 params.searchable_form_url = GURL(); 320 params.searchable_form_url = GURL();
315 params.searchable_form_encoding = std::string(); 321 params.searchable_form_encoding = std::string();
316 params.password_form = PasswordForm(); 322 params.password_form = PasswordForm();
317 params.security_info = std::string(); 323 params.security_info = std::string();
318 params.gesture = NavigationGestureUser; 324 params.gesture = NavigationGestureUser;
319 params.contents_mime_type = contents_mime_type_; 325 params.contents_mime_type = contents_mime_type_;
320 params.is_post = false; 326 params.is_post = false;
321 params.was_within_same_page = false; 327 params.was_within_same_page = false;
322 params.http_status_code = response_code; 328 params.http_status_code = response_code;
323 params.socket_address.set_host("2001:db8::1"); 329 params.socket_address.set_host("2001:db8::1");
324 params.socket_address.set_port(80); 330 params.socket_address.set_port(80);
325 params.was_fetched_via_proxy = simulate_fetch_via_proxy_; 331 params.was_fetched_via_proxy = simulate_fetch_via_proxy_;
326 params.history_list_was_cleared = simulate_history_list_was_cleared_; 332 params.history_list_was_cleared = simulate_history_list_was_cleared_;
327 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
328 params.original_request_url = original_request_url; 333 params.original_request_url = original_request_url;
329 334
335 WebKit::WebHTTPBody http_body;
336 http_body.initialize();
337
338 WebKit::WebHistoryItem history_item;
339 history_item.initialize();
340 history_item.setURLString(WebKit::WebString::fromUTF8(url.spec()));
341 if (file_path_for_history_item) {
342 const char char_data[] = "data";
343 http_body.appendData(WebKit::WebData(char_data, arraysize(char_data)-1));
344 http_body.appendFile(WebKit::WebString::fromUTF8(
345 file_path_for_history_item->MaybeAsASCII()));
346 history_item.setHTTPBody(http_body);
347 }
348 params.content_state = webkit_glue::HistoryItemToString(history_item);
349
330 ViewHostMsg_FrameNavigate msg(1, params); 350 ViewHostMsg_FrameNavigate msg(1, params);
331 OnNavigate(msg); 351 OnNavigate(msg);
332 } 352 }
333 353
334 void TestRenderViewHost::SendShouldCloseACK(bool proceed) { 354 void TestRenderViewHost::SendShouldCloseACK(bool proceed) {
335 base::TimeTicks now = base::TimeTicks::Now(); 355 base::TimeTicks now = base::TimeTicks::Now();
336 OnShouldCloseACK(proceed, now, now); 356 OnShouldCloseACK(proceed, now, now);
337 } 357 }
338 358
339 void TestRenderViewHost::SetContentsMimeType(const std::string& mime_type) { 359 void TestRenderViewHost::SetContentsMimeType(const std::string& mime_type) {
(...skipping 13 matching lines...) Expand all
353 } 373 }
354 374
355 void TestRenderViewHost::TestOnStartDragging( 375 void TestRenderViewHost::TestOnStartDragging(
356 const WebDropData& drop_data) { 376 const WebDropData& drop_data) {
357 WebKit::WebDragOperationsMask drag_operation = WebKit::WebDragOperationEvery; 377 WebKit::WebDragOperationsMask drag_operation = WebKit::WebDragOperationEvery;
358 DragEventSourceInfo event_info; 378 DragEventSourceInfo event_info;
359 OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(), 379 OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(),
360 event_info); 380 event_info);
361 } 381 }
362 382
383 void TestRenderViewHost::TestOnUpdateStateWithFile(
384 int process_id,
385 const base::FilePath& file_path) {
386 WebKit::WebHTTPBody http_body;
387 http_body.initialize();
388 const char char_data[] = "data";
389 http_body.appendData(WebKit::WebData(char_data, arraysize(char_data)-1));
390 http_body.appendFile(WebKit::WebString::fromUTF8(file_path.MaybeAsASCII()));
391
392 WebKit::WebHistoryItem history_item;
393 history_item.initialize();
394 history_item.setURLString("http://www.google.com");
395 history_item.setHTTPBody(http_body);
396 OnUpdateState(process_id, webkit_glue::HistoryItemToString(history_item));
397 }
398
363 void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) { 399 void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) {
364 simulate_fetch_via_proxy_ = proxy; 400 simulate_fetch_via_proxy_ = proxy;
365 } 401 }
366 402
367 void TestRenderViewHost::set_simulate_history_list_was_cleared(bool cleared) { 403 void TestRenderViewHost::set_simulate_history_list_was_cleared(bool cleared) {
368 simulate_history_list_was_cleared_ = cleared; 404 simulate_history_list_was_cleared_ = cleared;
369 } 405 }
370 406
371 RenderViewHostImplTestHarness::RenderViewHostImplTestHarness() { 407 RenderViewHostImplTestHarness::RenderViewHostImplTestHarness() {
372 } 408 }
(...skipping 11 matching lines...) Expand all
384 420
385 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { 421 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() {
386 return static_cast<TestRenderViewHost*>(active_rvh()); 422 return static_cast<TestRenderViewHost*>(active_rvh());
387 } 423 }
388 424
389 TestWebContents* RenderViewHostImplTestHarness::contents() { 425 TestWebContents* RenderViewHostImplTestHarness::contents() {
390 return static_cast<TestWebContents*>(web_contents()); 426 return static_cast<TestWebContents*>(web_contents());
391 } 427 }
392 428
393 } // namespace content 429 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/test_render_view_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698