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

Side by Side Diff: content/browser/frame_host/frame_tree_browsertest.cc

Issue 2479963002: Fix more flaky OOPIF tests by waiting for the old RenderFrame to be deleted. (Closed)
Patch Set: Fix another case. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/macros.h" 5 #include "base/macros.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "content/browser/frame_host/frame_tree.h" 7 #include "content/browser/frame_host/frame_tree.h"
8 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 GURL main_url(embedded_test_server()->GetURL( 317 GURL main_url(embedded_test_server()->GetURL(
318 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); 318 "a.com", "/cross_site_iframe_factory.html?a(b(c))"));
319 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 319 EXPECT_TRUE(NavigateToURL(shell(), main_url));
320 320
321 // The root node will initiate the navigation; its grandchild node will be the 321 // The root node will initiate the navigation; its grandchild node will be the
322 // target of the navigation. 322 // target of the navigation.
323 FrameTreeNode* target = root->child_at(0)->child_at(0); 323 FrameTreeNode* target = root->child_at(0)->child_at(0);
324 324
325 std::string blob_url_string; 325 std::string blob_url_string;
326 RenderFrameDeletedObserver deleted_observer(target->current_frame_host());
326 EXPECT_TRUE(ExecuteScriptAndExtractString( 327 EXPECT_TRUE(ExecuteScriptAndExtractString(
327 root, 328 root,
328 "function receiveMessage(event) {" 329 "function receiveMessage(event) {"
329 " document.body.appendChild(document.createTextNode(event.data));" 330 " document.body.appendChild(document.createTextNode(event.data));"
330 " domAutomationController.send(event.source.location.href);" 331 " domAutomationController.send(event.source.location.href);"
331 "}" 332 "}"
332 "window.addEventListener('message', receiveMessage, false);" 333 "window.addEventListener('message', receiveMessage, false);"
333 "var blob = new Blob([" 334 "var blob = new Blob(["
334 " '<html><body><div>This is blob content.</div><script>" 335 " '<html><body><div>This is blob content.</div><script>"
335 " window.parent.parent.postMessage(\"HI\", document.origin);" 336 " window.parent.parent.postMessage(\"HI\", document.origin);"
336 " </script></body></html>'], {type: 'text/html'});" 337 " </script></body></html>'], {type: 'text/html'});"
337 "var blob_url = URL.createObjectURL(blob);" 338 "var blob_url = URL.createObjectURL(blob);"
338 "frames[0][0].location.href = blob_url;", 339 "frames[0][0].location.href = blob_url;",
339 &blob_url_string)); 340 &blob_url_string));
341 // Wait for the RenderFrame to go away, if this will be cross-process.
342 if (AreAllSitesIsolatedForTesting())
343 deleted_observer.WaitUntilDeleted();
340 EXPECT_EQ(GURL(blob_url_string), target->current_url()); 344 EXPECT_EQ(GURL(blob_url_string), target->current_url());
341 EXPECT_EQ(url::kBlobScheme, target->current_url().scheme()); 345 EXPECT_EQ(url::kBlobScheme, target->current_url().scheme());
342 EXPECT_FALSE(target->current_origin().unique()); 346 EXPECT_FALSE(target->current_origin().unique());
343 EXPECT_EQ("a.com", target->current_origin().host()); 347 EXPECT_EQ("a.com", target->current_origin().host());
344 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme()); 348 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme());
345 349
346 std::string document_body; 350 std::string document_body;
347 EXPECT_TRUE(ExecuteScriptAndExtractString( 351 EXPECT_TRUE(ExecuteScriptAndExtractString(
348 target, 352 target,
349 "domAutomationController.send(document.body.children[0].innerHTML);", 353 "domAutomationController.send(document.body.children[0].innerHTML);",
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 // Make sure we did a process transfer back to "b.is". 756 // Make sure we did a process transfer back to "b.is".
753 EXPECT_EQ( 757 EXPECT_EQ(
754 " Site A ------------ proxies for B\n" 758 " Site A ------------ proxies for B\n"
755 " +--Site B ------- proxies for A\n" 759 " +--Site B ------- proxies for A\n"
756 "Where A = http://a.com/\n" 760 "Where A = http://a.com/\n"
757 " B = http://b.is/", 761 " B = http://b.is/",
758 FrameTreeVisualizer().DepictFrameTree(root)); 762 FrameTreeVisualizer().DepictFrameTree(root));
759 } 763 }
760 764
761 } // namespace content 765 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698