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

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

Issue 1851633002: Fix flaky DontReusePendingDeleteRenderViewHostForSubframe test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | 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 4158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 } 4169 }
4170 4170
4171 // Test for https://crbug.com/591478, where navigating to a cross-site page with 4171 // Test for https://crbug.com/591478, where navigating to a cross-site page with
4172 // a subframe on the old site could cause the old RenderViewHost (now pending 4172 // a subframe on the old site could cause the old RenderViewHost (now pending
4173 // deletion) to be reused. 4173 // deletion) to be reused.
4174 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 4174 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
4175 DontReusePendingDeleteRenderViewHostForSubframe) { 4175 DontReusePendingDeleteRenderViewHostForSubframe) {
4176 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); 4176 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
4177 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 4177 EXPECT_TRUE(NavigateToURL(shell(), main_url));
4178 4178
4179 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
4180 ->GetFrameTree()
4181 ->root();
4182 RenderViewHostImpl* rvh_a = root->current_frame_host()->render_view_host();
4183 int rvh_a_routing_id = rvh_a->GetRoutingID();
4184
4185 std::string script = 4179 std::string script =
4186 "window.onunload = function() { " 4180 "window.onunload = function() { "
4187 " var start = Date.now();" 4181 " var start = Date.now();"
4188 " while (Date.now() - start < 1000);" 4182 " while (Date.now() - start < 1000);"
4189 "}"; 4183 "}";
4190 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), script)); 4184 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), script));
4191 4185
4186 // Navigating cross-site with an iframe to the original site shouldn't crash.
4192 GURL second_url(embedded_test_server()->GetURL( 4187 GURL second_url(embedded_test_server()->GetURL(
4193 "b.com", "/cross_site_iframe_factory.html?b(a)")); 4188 "b.com", "/cross_site_iframe_factory.html?b(a)"));
4194 EXPECT_TRUE(NavigateToURL(shell(), second_url)); 4189 EXPECT_TRUE(NavigateToURL(shell(), second_url));
4195 4190
4196 // We should have a different RVH for a.com. 4191 // If the subframe is created while the main frame is pending deletion, then
4197 RenderViewHostImpl* rvh_a2 = 4192 // the RVH will be different.
4198 root->child_at(0)->current_frame_host()->render_view_host(); 4193 // TODO(creis, alexmos): Find a way to assert this that isn't flaky. For now,
4199 EXPECT_NE(rvh_a_routing_id, rvh_a2->GetRoutingID()); 4194 // the test is just likely (not certain) to catch regressions by crashing.
4200 } 4195 }
4201 4196
4202 // Check that when a cross-process frame acquires focus, the old focused frame 4197 // Check that when a cross-process frame acquires focus, the old focused frame
4203 // loses focus and fires blur events. Starting on a page with a cross-site 4198 // loses focus and fires blur events. Starting on a page with a cross-site
4204 // subframe, simulate mouse clicks to switch focus from root frame to subframe 4199 // subframe, simulate mouse clicks to switch focus from root frame to subframe
4205 // and then back to root frame. 4200 // and then back to root frame.
4206 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 4201 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
4207 CrossProcessFocusChangeFiresBlurEvents) { 4202 CrossProcessFocusChangeFiresBlurEvents) {
4208 GURL main_url( 4203 GURL main_url(
4209 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html")); 4204 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html"));
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
6311 EXPECT_EQ(b_url, root->current_url()); 6306 EXPECT_EQ(b_url, root->current_url());
6312 6307
6313 // Verify that the same RenderViewHost is preserved and that it is no longer 6308 // Verify that the same RenderViewHost is preserved and that it is no longer
6314 // in swapped out state. 6309 // in swapped out state.
6315 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( 6310 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost(
6316 root->current_frame_host()->GetSiteInstance())); 6311 root->current_frame_host()->GetSiteInstance()));
6317 EXPECT_FALSE(rvh->is_swapped_out_); 6312 EXPECT_FALSE(rvh->is_swapped_out_);
6318 } 6313 }
6319 6314
6320 } // namespace content 6315 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698