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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 1874923002: Fix flakiness when disabling swap out timer in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('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/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 " postToOpenerOfSibling('subframe2', 'msg', '*'));", 4088 " postToOpenerOfSibling('subframe2', 'msg', '*'));",
4089 &success)); 4089 &success));
4090 EXPECT_TRUE(success); 4090 EXPECT_TRUE(success);
4091 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 4091 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
4092 } 4092 }
4093 4093
4094 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and 4094 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and
4095 // delay the SwapOut ACK from the A->B navigation, so that the second B->A 4095 // delay the SwapOut ACK from the A->B navigation, so that the second B->A
4096 // navigation is initiated before the first page receives the SwapOut ACK. 4096 // navigation is initiated before the first page receives the SwapOut ACK.
4097 // Ensure that the RVH(A) that's pending deletion is not reused in that case. 4097 // Ensure that the RVH(A) that's pending deletion is not reused in that case.
4098 // crbug.com/554825
4099 #if defined(THREAD_SANITIZER)
4100 #define MAYBE_RenderViewHostPendingDeletionIsNotReused \
4101 DISABLED_RenderViewHostPendingDeletionIsNotReused
4102 #else
4103 #define MAYBE_RenderViewHostPendingDeletionIsNotReused \
4104 RenderViewHostPendingDeletionIsNotReused
4105 #endif
4106 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 4098 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
4107 MAYBE_RenderViewHostPendingDeletionIsNotReused) { 4099 RenderViewHostPendingDeletionIsNotReused) {
4108 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); 4100 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
4109 NavigateToURL(shell(), a_url); 4101 NavigateToURL(shell(), a_url);
4110 4102
4111 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) 4103 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
4112 ->GetFrameTree() 4104 ->GetFrameTree()
4113 ->root(); 4105 ->root();
4114 RenderFrameHostImpl* rfh = root->current_frame_host(); 4106 RenderFrameHostImpl* rfh = root->current_frame_host();
4115 RenderViewHostImpl* rvh = rfh->render_view_host(); 4107 RenderViewHostImpl* rvh = rfh->render_view_host();
4116 int rvh_routing_id = rvh->GetRoutingID(); 4108 int rvh_routing_id = rvh->GetRoutingID();
4117 SiteInstanceImpl* site_instance = rfh->GetSiteInstance(); 4109 SiteInstanceImpl* site_instance = rfh->GetSiteInstance();
4118 RenderFrameDeletedObserver deleted_observer(rfh); 4110 RenderFrameDeletedObserver deleted_observer(rfh);
4119 4111
4120 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's 4112 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's
4121 // process. 4113 // process.
4122 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter(); 4114 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter();
4123 rfh->GetProcess()->AddFilter(filter.get()); 4115 rfh->GetProcess()->AddFilter(filter.get());
4116 rfh->DisableSwapOutTimerForTesting();
4124 4117
4125 // Navigate to B. This must wait for DidCommitProvisionalLoad, as opposed to 4118 // Navigate to B. This must wait for DidCommitProvisionalLoad, as opposed to
4126 // DidStopLoading, since otherwise the SwapOut timer might call OnSwappedOut 4119 // DidStopLoading, since otherwise the SwapOut timer might call OnSwappedOut
4127 // and destroy |rvh| before its pending deletion status is checked. 4120 // and destroy |rvh| before its pending deletion status is checked.
4128 GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html")); 4121 GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
4129 TestFrameNavigationObserver commit_observer(root); 4122 TestFrameNavigationObserver commit_observer(root);
4130 shell()->LoadURL(b_url); 4123 shell()->LoadURL(b_url);
4131 commit_observer.WaitForCommit(); 4124 commit_observer.WaitForCommit();
4132 EXPECT_FALSE(deleted_observer.deleted()); 4125 EXPECT_FALSE(deleted_observer.deleted());
4133 rfh->ResetSwapOutTimerForTesting();
4134 4126
4135 // Since the SwapOut ACK for A->B is dropped, the first page's 4127 // Since the SwapOut ACK for A->B is dropped, the first page's
4136 // RenderFrameHost and RenderViewHost should be pending deletion after the 4128 // RenderFrameHost and RenderViewHost should be pending deletion after the
4137 // last navigation. 4129 // last navigation.
4138 EXPECT_FALSE(rfh->is_active()); 4130 EXPECT_FALSE(rfh->is_active());
4139 EXPECT_TRUE(root->render_manager()->IsViewPendingDeletion(rvh)); 4131 EXPECT_TRUE(root->render_manager()->IsViewPendingDeletion(rvh));
4140 4132
4141 // Wait for process A to exit so we can reinitialize it cleanly for the next 4133 // Wait for process A to exit so we can reinitialize it cleanly for the next
4142 // navigation. This can be removed once https://crbug.com/535246 is fixed. 4134 // navigation. This can be removed once https://crbug.com/535246 is fixed.
4143 RenderProcessHostWatcher process_exit_observer( 4135 RenderProcessHostWatcher process_exit_observer(
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
6527 root->current_frame_host()->GetRenderWidgetHost(); 6519 root->current_frame_host()->GetRenderWidgetHost();
6528 press_tab_and_wait_for_state_change(root_rwh); 6520 press_tab_and_wait_for_state_change(root_rwh);
6529 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type); 6521 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type);
6530 6522
6531 // Crash the tab renderer and observer the input state going back to none. 6523 // Crash the tab renderer and observer the input state going back to none.
6532 RenderProcessHost* host_process = root_rwh->GetProcess(); 6524 RenderProcessHost* host_process = root_rwh->GetProcess();
6533 crash_renderer_and_wait_for_input_state_none(host_process); 6525 crash_renderer_and_wait_for_input_state_none(host_process);
6534 } 6526 }
6535 6527
6536 } // namespace content 6528 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698