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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 281663002: Create RenderFrameProxyHost at time of swap-out instead of commit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 6 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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 new_view->Release(); 481 new_view->Release();
482 } 482 }
483 483
484 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is 484 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is
485 // already swapped out. http://crbug.com/93427. 485 // already swapped out. http://crbug.com/93427.
486 TEST_F(RenderViewImplTest, SendSwapOutACK) { 486 TEST_F(RenderViewImplTest, SendSwapOutACK) {
487 LoadHTML("<div>Page A</div>"); 487 LoadHTML("<div>Page A</div>");
488 int initial_page_id = view()->GetPageId(); 488 int initial_page_id = view()->GetPageId();
489 489
490 // Respond to a swap out request. 490 // Respond to a swap out request.
491 view()->main_render_frame()->OnSwapOut(); 491 view()->main_render_frame()->OnSwapOut(MSG_ROUTING_NONE);
Charlie Reis 2014/05/15 00:32:50 Doesn't RenderFrameProxy's constructor assume that
nasko 2014/05/15 18:47:13 Contrary to its name, this is actually an unit tes
492 492
493 // Ensure the swap out commits synchronously. 493 // Ensure the swap out commits synchronously.
494 EXPECT_NE(initial_page_id, view()->GetPageId()); 494 EXPECT_NE(initial_page_id, view()->GetPageId());
495 495
496 // Check for a valid OnSwapOutACK. 496 // Check for a valid OnSwapOutACK.
497 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 497 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
498 FrameHostMsg_SwapOut_ACK::ID); 498 FrameHostMsg_SwapOut_ACK::ID);
499 ASSERT_TRUE(msg); 499 ASSERT_TRUE(msg);
500 500
501 // It is possible to get another swap out request. Ensure that we send 501 // It is possible to get another swap out request. Ensure that we send
502 // an ACK, even if we don't have to do anything else. 502 // an ACK, even if we don't have to do anything else.
503 render_thread_->sink().ClearMessages(); 503 render_thread_->sink().ClearMessages();
504 view()->main_render_frame()->OnSwapOut(); 504 view()->main_render_frame()->OnSwapOut(MSG_ROUTING_NONE);
505 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching( 505 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching(
506 FrameHostMsg_SwapOut_ACK::ID); 506 FrameHostMsg_SwapOut_ACK::ID);
507 ASSERT_TRUE(msg2); 507 ASSERT_TRUE(msg2);
508 508
509 // If we navigate back to this RenderView, ensure we don't send a state 509 // If we navigate back to this RenderView, ensure we don't send a state
510 // update for the swapped out URL. (http://crbug.com/72235) 510 // update for the swapped out URL. (http://crbug.com/72235)
511 FrameMsg_Navigate_Params nav_params; 511 FrameMsg_Navigate_Params nav_params;
512 nav_params.url = GURL("data:text/html,<div>Page B</div>"); 512 nav_params.url = GURL("data:text/html,<div>Page B</div>");
513 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 513 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
514 nav_params.transition = PAGE_TRANSITION_TYPED; 514 nav_params.transition = PAGE_TRANSITION_TYPED;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 params_A.transition = PAGE_TRANSITION_FORWARD_BACK; 549 params_A.transition = PAGE_TRANSITION_FORWARD_BACK;
550 params_A.current_history_list_length = 2; 550 params_A.current_history_list_length = 2;
551 params_A.current_history_list_offset = 1; 551 params_A.current_history_list_offset = 1;
552 params_A.pending_history_list_offset = 0; 552 params_A.pending_history_list_offset = 0;
553 params_A.page_id = 1; 553 params_A.page_id = 1;
554 params_A.page_state = state_A; 554 params_A.page_state = state_A;
555 frame()->OnNavigate(params_A); 555 frame()->OnNavigate(params_A);
556 ProcessPendingMessages(); 556 ProcessPendingMessages();
557 557
558 // Respond to a swap out request. 558 // Respond to a swap out request.
559 view()->main_render_frame()->OnSwapOut(); 559 view()->main_render_frame()->OnSwapOut(MSG_ROUTING_NONE);
560 560
561 // Check for a OnSwapOutACK. 561 // Check for a OnSwapOutACK.
562 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 562 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
563 FrameHostMsg_SwapOut_ACK::ID); 563 FrameHostMsg_SwapOut_ACK::ID);
564 ASSERT_TRUE(msg); 564 ASSERT_TRUE(msg);
565 render_thread_->sink().ClearMessages(); 565 render_thread_->sink().ClearMessages();
566 566
567 // It is possible to get a reload request at this point, containing the 567 // It is possible to get a reload request at this point, containing the
568 // params.page_state of the initial page (e.g., if the new page fails the 568 // params.page_state of the initial page (e.g., if the new page fails the
569 // provisional load in the renderer process, after we unload the old page). 569 // provisional load in the renderer process, after we unload the old page).
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 view()->renderer_accessibility()->GetType()); 2361 view()->renderer_accessibility()->GetType());
2362 2362
2363 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); 2363 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly);
2364 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); 2364 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode());
2365 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); 2365 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility());
2366 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, 2366 ASSERT_EQ(RendererAccessibilityTypeFocusOnly,
2367 view()->renderer_accessibility()->GetType()); 2367 view()->renderer_accessibility()->GetType());
2368 } 2368 }
2369 2369
2370 } // namespace content 2370 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698