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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 1785153005: Remove SiteIsolationPolicy::IsSwappedOutStateForbidden(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_proxy.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 6e85b39491aab0220323b9a88573d62fad42f48c..7682b4bf0b2161571617294a2a90c509a623d914 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -768,144 +768,6 @@ TEST_F(RenderViewImplTest, DecideNavigationPolicyForWebUI) {
new_view->Release();
}
-// Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is
-// already swapped out. http://crbug.com/93427.
-TEST_F(RenderViewImplTest, SendSwapOutACK) {
- // This test is invalid in --site-per-process mode, as swapped-out is no
- // longer used.
- if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
- return;
- }
- LoadHTML("<div>Page A</div>");
- int initial_page_id = view_page_id();
-
- // Increment the ref count so that we don't exit when swapping out.
- RenderProcess::current()->AddRefProcess();
-
- // Respond to a swap out request.
- frame()->SwapOut(kProxyRoutingId, true,
- ReconstructReplicationStateForTesting(frame()));
-
- // Ensure the swap out commits synchronously.
- EXPECT_NE(initial_page_id, view_page_id());
-
- // Check for a valid OnSwapOutACK.
- const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
- FrameHostMsg_SwapOut_ACK::ID);
- ASSERT_TRUE(msg);
-
- // It is possible to get another swap out request. Ensure that we send
- // an ACK, even if we don't have to do anything else.
- render_thread_->sink().ClearMessages();
- frame()->SwapOut(kProxyRoutingId, false,
- ReconstructReplicationStateForTesting(frame()));
- const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching(
- FrameHostMsg_SwapOut_ACK::ID);
- ASSERT_TRUE(msg2);
-
- // If we navigate back to this RenderView, ensure we don't send a state
- // update for the swapped out URL. (http://crbug.com/72235)
- CommonNavigationParams common_params;
- RequestNavigationParams request_params;
- common_params.url = GURL("data:text/html,<div>Page B</div>");
- common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
- common_params.transition = ui::PAGE_TRANSITION_TYPED;
- request_params.current_history_list_length = 1;
- request_params.current_history_list_offset = 0;
- request_params.pending_history_list_offset = 1;
- request_params.page_id = -1;
- frame()->Navigate(common_params, StartNavigationParams(), request_params);
- ProcessPendingMessages();
- const IPC::Message* msg3 = render_thread_->sink().GetUniqueMessageMatching(
- ViewHostMsg_UpdateState::ID);
- EXPECT_FALSE(msg3);
-}
-
-// Ensure the RenderViewImpl reloads the previous page if a reload request
-// arrives while it is showing swappedout://. http://crbug.com/143155.
-TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) {
- // This test is invalid in --site-per-process mode, as swapped-out is no
- // longer used.
- if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
- return;
- }
-
- // Load page A.
- LoadHTML("<div>Page A</div>");
-
- // Load page B, which will trigger an UpdateState message for page A.
- LoadHTML("<div>Page B</div>");
-
- // Check for a valid UpdateState message for page A.
- ProcessPendingMessages();
- const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching(
- ViewHostMsg_UpdateState::ID);
- ASSERT_TRUE(msg_A);
- ViewHostMsg_UpdateState::Param params;
- ViewHostMsg_UpdateState::Read(msg_A, &params);
- int page_id_A = base::get<0>(params);
- PageState state_A = base::get<1>(params);
- EXPECT_EQ(1, page_id_A);
- render_thread_->sink().ClearMessages();
-
- // Back to page A (page_id 1) and commit.
- CommonNavigationParams common_params_A;
- RequestNavigationParams request_params_A;
- common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL;
- common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
- request_params_A.current_history_list_length = 2;
- request_params_A.current_history_list_offset = 1;
- request_params_A.pending_history_list_offset = 0;
- request_params_A.page_id = 1;
- request_params_A.nav_entry_id = 1;
- request_params_A.page_state = state_A;
- frame()->Navigate(common_params_A, StartNavigationParams(), request_params_A);
- EXPECT_EQ(1, view()->historyBackListCount());
- EXPECT_EQ(2, view()->historyBackListCount() +
- view()->historyForwardListCount() + 1);
- ProcessPendingMessages();
-
- // Respond to a swap out request.
- frame()->SwapOut(kProxyRoutingId, true,
- ReconstructReplicationStateForTesting(frame()));
-
- // Check for a OnSwapOutACK.
- const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
- FrameHostMsg_SwapOut_ACK::ID);
- ASSERT_TRUE(msg);
- render_thread_->sink().ClearMessages();
-
- // It is possible to get a reload request at this point, containing the
- // params.page_state of the initial page (e.g., if the new page fails the
- // provisional load in the renderer process, after we unload the old page).
- // Ensure the old page gets reloaded, not swappedout://.
- CommonNavigationParams common_params;
- RequestNavigationParams request_params;
- common_params.url = GURL("data:text/html,<div>Page A</div>");
- common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD;
- common_params.transition = ui::PAGE_TRANSITION_RELOAD;
- request_params.current_history_list_length = 2;
- request_params.current_history_list_offset = 0;
- request_params.pending_history_list_offset = 0;
- request_params.page_id = 1;
- request_params.nav_entry_id = 1;
- request_params.page_state = state_A;
- frame()->Navigate(common_params, StartNavigationParams(), request_params);
- ProcessPendingMessages();
-
- // Verify page A committed, not swappedout://.
- const IPC::Message* frame_navigate_msg =
- render_thread_->sink().GetUniqueMessageMatching(
- FrameHostMsg_DidCommitProvisionalLoad::ID);
- EXPECT_TRUE(frame_navigate_msg);
-
- // Read URL out of the parent trait of the params object.
- FrameHostMsg_DidCommitProvisionalLoad::Param commit_load_params;
- FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg,
- &commit_load_params);
- EXPECT_NE(GURL("swappedout://"), base::get<0>(commit_load_params).url);
-}
-
// Verify that security origins are replicated properly to RenderFrameProxies
// when swapping out.
TEST_F(RenderViewImplTest, OriginReplicationForSwapOut) {
« no previous file with comments | « content/renderer/render_frame_proxy.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698