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

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

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. Created 4 years, 6 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
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 27 matching lines...) Expand all
38 void SetUpOnMainThread() override { 38 void SetUpOnMainThread() override {
39 host_resolver()->AddRule("*", "127.0.0.1"); 39 host_resolver()->AddRule("*", "127.0.0.1");
40 ASSERT_TRUE(embedded_test_server()->Start()); 40 ASSERT_TRUE(embedded_test_server()->Start());
41 SetupCrossSiteRedirector(embedded_test_server()); 41 SetupCrossSiteRedirector(embedded_test_server());
42 } 42 }
43 43
44 protected: 44 protected:
45 std::string GetOriginFromRenderer(FrameTreeNode* node) { 45 std::string GetOriginFromRenderer(FrameTreeNode* node) {
46 std::string origin; 46 std::string origin;
47 EXPECT_TRUE(ExecuteScriptAndExtractString( 47 EXPECT_TRUE(ExecuteScriptAndExtractString(
48 node->current_frame_host(), 48 node, "window.domAutomationController.send(document.origin);",
49 "window.domAutomationController.send(document.origin);", &origin)); 49 &origin));
50 return origin; 50 return origin;
51 } 51 }
52 52
53 private: 53 private:
54 DISALLOW_COPY_AND_ASSIGN(FrameTreeBrowserTest); 54 DISALLOW_COPY_AND_ASSIGN(FrameTreeBrowserTest);
55 }; 55 };
56 56
57 // Ensures FrameTree correctly reflects page structure during navigations. 57 // Ensures FrameTree correctly reflects page structure during navigations.
58 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, FrameTreeShape) { 58 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, FrameTreeShape) {
59 GURL base_url = embedded_test_server()->GetURL("A.com", "/site_isolation/"); 59 GURL base_url = embedded_test_server()->GetURL("A.com", "/site_isolation/");
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 GURL main_url(embedded_test_server()->GetURL( 313 GURL main_url(embedded_test_server()->GetURL(
314 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); 314 "a.com", "/cross_site_iframe_factory.html?a(b(c))"));
315 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 315 EXPECT_TRUE(NavigateToURL(shell(), main_url));
316 316
317 // The root node will initiate the navigation; its grandchild node will be the 317 // The root node will initiate the navigation; its grandchild node will be the
318 // target of the navigation. 318 // target of the navigation.
319 FrameTreeNode* target = root->child_at(0)->child_at(0); 319 FrameTreeNode* target = root->child_at(0)->child_at(0);
320 320
321 std::string blob_url_string; 321 std::string blob_url_string;
322 EXPECT_TRUE(ExecuteScriptAndExtractString( 322 EXPECT_TRUE(ExecuteScriptAndExtractString(
323 root->current_frame_host(), 323 root,
324 "function receiveMessage(event) {" 324 "function receiveMessage(event) {"
325 " document.body.appendChild(document.createTextNode(event.data));" 325 " document.body.appendChild(document.createTextNode(event.data));"
326 " domAutomationController.send(event.source.location.href);" 326 " domAutomationController.send(event.source.location.href);"
327 "}" 327 "}"
328 "window.addEventListener('message', receiveMessage, false);" 328 "window.addEventListener('message', receiveMessage, false);"
329 "var blob = new Blob([" 329 "var blob = new Blob(["
330 " '<html><body><div>This is blob content.</div><script>" 330 " '<html><body><div>This is blob content.</div><script>"
331 " window.parent.parent.postMessage(\"HI\", document.origin);" 331 " window.parent.parent.postMessage(\"HI\", document.origin);"
332 " </script></body></html>'], {type: 'text/html'});" 332 " </script></body></html>'], {type: 'text/html'});"
333 "var blob_url = URL.createObjectURL(blob);" 333 "var blob_url = URL.createObjectURL(blob);"
334 "frames[0][0].location.href = blob_url;", 334 "frames[0][0].location.href = blob_url;",
335 &blob_url_string)); 335 &blob_url_string));
336 EXPECT_EQ(GURL(blob_url_string), target->current_url()); 336 EXPECT_EQ(GURL(blob_url_string), target->current_url());
337 EXPECT_EQ(url::kBlobScheme, target->current_url().scheme()); 337 EXPECT_EQ(url::kBlobScheme, target->current_url().scheme());
338 EXPECT_FALSE(target->current_origin().unique()); 338 EXPECT_FALSE(target->current_origin().unique());
339 EXPECT_EQ("a.com", target->current_origin().host()); 339 EXPECT_EQ("a.com", target->current_origin().host());
340 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme()); 340 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme());
341 341
342 std::string document_body; 342 std::string document_body;
343 EXPECT_TRUE(ExecuteScriptAndExtractString( 343 EXPECT_TRUE(ExecuteScriptAndExtractString(
344 target->current_frame_host(), 344 target,
345 "domAutomationController.send(document.body.children[0].innerHTML);", 345 "domAutomationController.send(document.body.children[0].innerHTML);",
346 &document_body)); 346 &document_body));
347 EXPECT_EQ("This is blob content.", document_body); 347 EXPECT_EQ("This is blob content.", document_body);
348 EXPECT_EQ(reference_tree, FrameTreeVisualizer().DepictFrameTree(root)); 348 EXPECT_EQ(reference_tree, FrameTreeVisualizer().DepictFrameTree(root));
349 } 349 }
350 350
351 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, NavigateChildToAboutBlank) { 351 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, NavigateChildToAboutBlank) {
352 GURL main_url(embedded_test_server()->GetURL( 352 GURL main_url(embedded_test_server()->GetURL(
353 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); 353 "a.com", "/cross_site_iframe_factory.html?a(b(c))"));
354 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 354 EXPECT_TRUE(NavigateToURL(shell(), main_url));
355 WebContentsImpl* contents = 355 WebContentsImpl* contents =
356 static_cast<WebContentsImpl*>(shell()->web_contents()); 356 static_cast<WebContentsImpl*>(shell()->web_contents());
357 357
358 // The leaf node (c.com) will be navigated. Its parent node (b.com) will 358 // The leaf node (c.com) will be navigated. Its parent node (b.com) will
359 // initiate the navigation. 359 // initiate the navigation.
360 FrameTreeNode* target = 360 FrameTreeNode* target =
361 contents->GetFrameTree()->root()->child_at(0)->child_at(0); 361 contents->GetFrameTree()->root()->child_at(0)->child_at(0);
362 FrameTreeNode* initiator = target->parent(); 362 FrameTreeNode* initiator = target->parent();
363 363
364 // Give the target a name. 364 // Give the target a name.
365 EXPECT_TRUE( 365 EXPECT_TRUE(ExecuteScript(target, "window.name = 'target';"));
366 ExecuteScript(target->current_frame_host(), "window.name = 'target';"));
367 366
368 // Use window.open(about:blank), then poll the document for access. 367 // Use window.open(about:blank), then poll the document for access.
369 std::string about_blank_origin; 368 std::string about_blank_origin;
370 EXPECT_TRUE(ExecuteScriptAndExtractString( 369 EXPECT_TRUE(ExecuteScriptAndExtractString(
371 initiator->current_frame_host(), 370 initiator,
372 "var didNavigate = false;" 371 "var didNavigate = false;"
373 "var intervalID = setInterval(function() {" 372 "var intervalID = setInterval(function() {"
374 " if (!didNavigate) {" 373 " if (!didNavigate) {"
375 " didNavigate = true;" 374 " didNavigate = true;"
376 " window.open('about:blank', 'target');" 375 " window.open('about:blank', 'target');"
377 " }" 376 " }"
378 " // Poll the document until it doesn't throw a SecurityError.\n" 377 " // Poll the document until it doesn't throw a SecurityError.\n"
379 " try {" 378 " try {"
380 " frames[0].document.write('Hi from ' + document.domain);" 379 " frames[0].document.write('Hi from ' + document.domain);"
381 " } catch (e) { return; }" 380 " } catch (e) { return; }"
382 " clearInterval(intervalID);" 381 " clearInterval(intervalID);"
383 " domAutomationController.send(frames[0].document.origin);" 382 " domAutomationController.send(frames[0].document.origin);"
384 "}, 16);", 383 "}, 16);",
385 &about_blank_origin)); 384 &about_blank_origin));
386 EXPECT_EQ(GURL(url::kAboutBlankURL), target->current_url()); 385 EXPECT_EQ(GURL(url::kAboutBlankURL), target->current_url());
387 EXPECT_EQ(url::kAboutScheme, target->current_url().scheme()); 386 EXPECT_EQ(url::kAboutScheme, target->current_url().scheme());
388 EXPECT_FALSE(target->current_origin().unique()); 387 EXPECT_FALSE(target->current_origin().unique());
389 EXPECT_EQ("b.com", target->current_origin().host()); 388 EXPECT_EQ("b.com", target->current_origin().host());
390 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme()); 389 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme());
391 EXPECT_EQ(target->current_origin().Serialize(), about_blank_origin); 390 EXPECT_EQ(target->current_origin().Serialize(), about_blank_origin);
392 391
393 std::string document_body; 392 std::string document_body;
394 EXPECT_TRUE(ExecuteScriptAndExtractString( 393 EXPECT_TRUE(ExecuteScriptAndExtractString(
395 target->current_frame_host(), 394 target, "domAutomationController.send(document.body.innerHTML);",
396 "domAutomationController.send(document.body.innerHTML);",
397 &document_body)); 395 &document_body));
398 EXPECT_EQ("Hi from b.com", document_body); 396 EXPECT_EQ("Hi from b.com", document_body);
399 } 397 }
400 398
401 // Nested iframes, three origins: A(B(C)). Frame A navigates C to about:blank 399 // Nested iframes, three origins: A(B(C)). Frame A navigates C to about:blank
402 // (via window.open). This should wind up in A's origin per the spec. Test fails 400 // (via window.open). This should wind up in A's origin per the spec. Test fails
403 // because of http://crbug.com/564292 401 // because of http://crbug.com/564292
404 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, 402 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest,
405 DISABLED_NavigateGrandchildToAboutBlank) { 403 DISABLED_NavigateGrandchildToAboutBlank) {
406 GURL main_url(embedded_test_server()->GetURL( 404 GURL main_url(embedded_test_server()->GetURL(
407 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); 405 "a.com", "/cross_site_iframe_factory.html?a(b(c))"));
408 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 406 EXPECT_TRUE(NavigateToURL(shell(), main_url));
409 WebContentsImpl* contents = 407 WebContentsImpl* contents =
410 static_cast<WebContentsImpl*>(shell()->web_contents()); 408 static_cast<WebContentsImpl*>(shell()->web_contents());
411 409
412 // The leaf node (c.com) will be navigated. Its grandparent node (a.com) will 410 // The leaf node (c.com) will be navigated. Its grandparent node (a.com) will
413 // initiate the navigation. 411 // initiate the navigation.
414 FrameTreeNode* target = 412 FrameTreeNode* target =
415 contents->GetFrameTree()->root()->child_at(0)->child_at(0); 413 contents->GetFrameTree()->root()->child_at(0)->child_at(0);
416 FrameTreeNode* initiator = target->parent()->parent(); 414 FrameTreeNode* initiator = target->parent()->parent();
417 415
418 // Give the target a name. 416 // Give the target a name.
419 EXPECT_TRUE( 417 EXPECT_TRUE(ExecuteScript(target, "window.name = 'target';"));
420 ExecuteScript(target->current_frame_host(), "window.name = 'target';"));
421 418
422 // Use window.open(about:blank), then poll the document for access. 419 // Use window.open(about:blank), then poll the document for access.
423 std::string about_blank_origin; 420 std::string about_blank_origin;
424 EXPECT_TRUE(ExecuteScriptAndExtractString( 421 EXPECT_TRUE(ExecuteScriptAndExtractString(
425 initiator->current_frame_host(), 422 initiator,
426 "var didNavigate = false;" 423 "var didNavigate = false;"
427 "var intervalID = setInterval(function() {" 424 "var intervalID = setInterval(function() {"
428 " if (!didNavigate) {" 425 " if (!didNavigate) {"
429 " didNavigate = true;" 426 " didNavigate = true;"
430 " window.open('about:blank', 'target');" 427 " window.open('about:blank', 'target');"
431 " }" 428 " }"
432 " // May raise a SecurityError, that's expected.\n" 429 " // May raise a SecurityError, that's expected.\n"
433 " frames[0][0].document.write('Hi from ' + document.domain);" 430 " frames[0][0].document.write('Hi from ' + document.domain);"
434 " clearInterval(intervalID);" 431 " clearInterval(intervalID);"
435 " domAutomationController.send(frames[0][0].document.origin);" 432 " domAutomationController.send(frames[0][0].document.origin);"
436 "}, 16);", 433 "}, 16);",
437 &about_blank_origin)); 434 &about_blank_origin));
438 EXPECT_EQ(GURL(url::kAboutBlankURL), target->current_url()); 435 EXPECT_EQ(GURL(url::kAboutBlankURL), target->current_url());
439 EXPECT_EQ(url::kAboutScheme, target->current_url().scheme()); 436 EXPECT_EQ(url::kAboutScheme, target->current_url().scheme());
440 EXPECT_FALSE(target->current_origin().unique()); 437 EXPECT_FALSE(target->current_origin().unique());
441 EXPECT_EQ("a.com", target->current_origin().host()); 438 EXPECT_EQ("a.com", target->current_origin().host());
442 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme()); 439 EXPECT_EQ(url::kHttpScheme, target->current_origin().scheme());
443 EXPECT_EQ(target->current_origin().Serialize(), about_blank_origin); 440 EXPECT_EQ(target->current_origin().Serialize(), about_blank_origin);
444 441
445 std::string document_body; 442 std::string document_body;
446 EXPECT_TRUE(ExecuteScriptAndExtractString( 443 EXPECT_TRUE(ExecuteScriptAndExtractString(
447 target->current_frame_host(), 444 target, "domAutomationController.send(document.body.innerHTML);",
448 "domAutomationController.send(document.body.innerHTML);",
449 &document_body)); 445 &document_body));
450 EXPECT_EQ("Hi from a.com", document_body); 446 EXPECT_EQ("Hi from a.com", document_body);
451 } 447 }
452 448
453 // Ensures that iframe with srcdoc is always put in the same origin as its 449 // Ensures that iframe with srcdoc is always put in the same origin as its
454 // parent frame. 450 // parent frame.
455 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, ChildFrameWithSrcdoc) { 451 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, ChildFrameWithSrcdoc) {
456 GURL main_url(embedded_test_server()->GetURL( 452 GURL main_url(embedded_test_server()->GetURL(
457 "a.com", "/cross_site_iframe_factory.html?a(b)")); 453 "a.com", "/cross_site_iframe_factory.html?a(b)"));
458 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 454 EXPECT_TRUE(NavigateToURL(shell(), main_url));
459 WebContentsImpl* contents = 455 WebContentsImpl* contents =
460 static_cast<WebContentsImpl*>(shell()->web_contents()); 456 static_cast<WebContentsImpl*>(shell()->web_contents());
461 FrameTreeNode* root = contents->GetFrameTree()->root(); 457 FrameTreeNode* root = contents->GetFrameTree()->root();
462 EXPECT_EQ(1U, root->child_count()); 458 EXPECT_EQ(1U, root->child_count());
463 459
464 FrameTreeNode* child = root->child_at(0); 460 FrameTreeNode* child = root->child_at(0);
465 std::string frame_origin; 461 std::string frame_origin;
466 EXPECT_TRUE(ExecuteScriptAndExtractString( 462 EXPECT_TRUE(ExecuteScriptAndExtractString(
467 child->current_frame_host(), 463 child, "domAutomationController.send(document.origin);", &frame_origin));
468 "domAutomationController.send(document.origin);", &frame_origin));
469 EXPECT_TRUE( 464 EXPECT_TRUE(
470 child->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith( 465 child->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith(
471 url::Origin(GURL(frame_origin)))); 466 url::Origin(GURL(frame_origin))));
472 EXPECT_FALSE( 467 EXPECT_FALSE(
473 root->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith( 468 root->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith(
474 url::Origin(GURL(frame_origin)))); 469 url::Origin(GURL(frame_origin))));
475 470
476 // Create a new iframe with srcdoc and add it to the main frame. It should 471 // Create a new iframe with srcdoc and add it to the main frame. It should
477 // be created in the same SiteInstance as the parent. 472 // be created in the same SiteInstance as the parent.
478 { 473 {
479 std::string script("var f = document.createElement('iframe');" 474 std::string script("var f = document.createElement('iframe');"
480 "f.srcdoc = 'some content';" 475 "f.srcdoc = 'some content';"
481 "document.body.appendChild(f)"); 476 "document.body.appendChild(f)");
482 TestNavigationObserver observer(shell()->web_contents()); 477 TestNavigationObserver observer(shell()->web_contents());
483 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), script)); 478 EXPECT_TRUE(ExecuteScript(root, script));
484 EXPECT_EQ(2U, root->child_count()); 479 EXPECT_EQ(2U, root->child_count());
485 observer.Wait(); 480 observer.Wait();
486 481
487 EXPECT_EQ(GURL(url::kAboutBlankURL), root->child_at(1)->current_url()); 482 EXPECT_EQ(GURL(url::kAboutBlankURL), root->child_at(1)->current_url());
488 EXPECT_TRUE(ExecuteScriptAndExtractString( 483 EXPECT_TRUE(ExecuteScriptAndExtractString(
489 root->child_at(1)->current_frame_host(), 484 root->child_at(1), "domAutomationController.send(document.origin);",
490 "domAutomationController.send(document.origin);", &frame_origin)); 485 &frame_origin));
491 EXPECT_EQ(root->current_frame_host()->GetLastCommittedURL().GetOrigin(), 486 EXPECT_EQ(root->current_frame_host()->GetLastCommittedURL().GetOrigin(),
492 GURL(frame_origin)); 487 GURL(frame_origin));
493 EXPECT_NE(child->current_frame_host()->GetLastCommittedURL().GetOrigin(), 488 EXPECT_NE(child->current_frame_host()->GetLastCommittedURL().GetOrigin(),
494 GURL(frame_origin)); 489 GURL(frame_origin));
495 } 490 }
496 491
497 // Set srcdoc on the existing cross-site frame. It should navigate the frame 492 // Set srcdoc on the existing cross-site frame. It should navigate the frame
498 // back to the origin of the parent. 493 // back to the origin of the parent.
499 { 494 {
500 std::string script("var f = document.getElementById('child-0');" 495 std::string script("var f = document.getElementById('child-0');"
501 "f.srcdoc = 'some content';"); 496 "f.srcdoc = 'some content';");
502 TestNavigationObserver observer(shell()->web_contents()); 497 TestNavigationObserver observer(shell()->web_contents());
503 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), script)); 498 EXPECT_TRUE(ExecuteScript(root, script));
504 observer.Wait(); 499 observer.Wait();
505 500
506 EXPECT_EQ(GURL(url::kAboutBlankURL), child->current_url()); 501 EXPECT_EQ(GURL(url::kAboutBlankURL), child->current_url());
507 EXPECT_TRUE(ExecuteScriptAndExtractString( 502 EXPECT_TRUE(ExecuteScriptAndExtractString(
508 child->current_frame_host(), 503 child, "domAutomationController.send(document.origin);",
509 "domAutomationController.send(document.origin);", &frame_origin)); 504 &frame_origin));
510 EXPECT_EQ(root->current_frame_host()->GetLastCommittedURL().GetOrigin(), 505 EXPECT_EQ(root->current_frame_host()->GetLastCommittedURL().GetOrigin(),
511 GURL(frame_origin)); 506 GURL(frame_origin));
512 } 507 }
513 } 508 }
514 509
515 // Ensure that sandbox flags are correctly set when child frames are created. 510 // Ensure that sandbox flags are correctly set when child frames are created.
516 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, SandboxFlagsSetForChildFrames) { 511 IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, SandboxFlagsSetForChildFrames) {
517 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html")); 512 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html"));
518 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 513 EXPECT_TRUE(NavigateToURL(shell(), main_url));
519 514
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 553 EXPECT_TRUE(NavigateToURL(shell(), main_url));
559 554
560 // It is safe to obtain the root frame tree node here, as it doesn't change. 555 // It is safe to obtain the root frame tree node here, as it doesn't change.
561 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) 556 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
562 ->GetFrameTree() 557 ->GetFrameTree()
563 ->root(); 558 ->root();
564 559
565 // Open a new window from a subframe. 560 // Open a new window from a subframe.
566 ShellAddedObserver new_shell_observer; 561 ShellAddedObserver new_shell_observer;
567 GURL popup_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); 562 GURL popup_url(embedded_test_server()->GetURL("foo.com", "/title1.html"));
568 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), 563 EXPECT_TRUE(ExecuteScript(root->child_at(0),
569 "window.open('" + popup_url.spec() + "');")); 564 "window.open('" + popup_url.spec() + "');"));
570 Shell* new_shell = new_shell_observer.GetShell(); 565 Shell* new_shell = new_shell_observer.GetShell();
571 WebContents* new_contents = new_shell->web_contents(); 566 WebContents* new_contents = new_shell->web_contents();
572 WaitForLoadStop(new_contents); 567 WaitForLoadStop(new_contents);
573 568
574 // Check that the new window's opener points to the correct subframe on 569 // Check that the new window's opener points to the correct subframe on
575 // original window. 570 // original window.
576 FrameTreeNode* popup_root = 571 FrameTreeNode* popup_root =
577 static_cast<WebContentsImpl*>(new_contents)->GetFrameTree()->root(); 572 static_cast<WebContentsImpl*>(new_contents)->GetFrameTree()->root();
578 EXPECT_EQ(root->child_at(0), popup_root->opener()); 573 EXPECT_EQ(root->child_at(0), popup_root->opener());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 685
691 GURL data_url("data:text/html,foo"); 686 GURL data_url("data:text/html,foo");
692 NavigateFrameToURL(root->child_at(1), data_url); 687 NavigateFrameToURL(root->child_at(1), data_url);
693 688
694 // Navigating to a data URL should set a unique origin. This is represented 689 // Navigating to a data URL should set a unique origin. This is represented
695 // as "null" per RFC 6454. 690 // as "null" per RFC 6454.
696 EXPECT_EQ(root->child_at(1)->current_origin().Serialize(), "null"); 691 EXPECT_EQ(root->child_at(1)->current_origin().Serialize(), "null");
697 } 692 }
698 693
699 } // namespace content 694 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698