OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 7691 matching lines...) Loading... |
7702 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); | 7702 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); |
7703 | 7703 |
7704 // Create a popup with a remote frame and set its opener to the main frame. | 7704 // Create a popup with a remote frame and set its opener to the main frame. |
7705 FrameTestHelpers::TestWebViewClient popupViewClient; | 7705 FrameTestHelpers::TestWebViewClient popupViewClient; |
7706 WebView* popupView = WebView::create(&popupViewClient); | 7706 WebView* popupView = WebView::create(&popupViewClient); |
7707 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; | 7707 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; |
7708 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); | 7708 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); |
7709 popupView->setMainFrame(popupRemoteFrame); | 7709 popupView->setMainFrame(popupRemoteFrame); |
7710 popupRemoteFrame->setOpener(mainFrame); | 7710 popupRemoteFrame->setOpener(mainFrame); |
7711 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); | 7711 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); |
7712 EXPECT_FALSE(mainFrame->securityOrigin().canAccess(popupView->mainFrame()->s
ecurityOrigin())); | 7712 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()
->getSecurityOrigin())); |
7713 | 7713 |
7714 // Do a remote-to-local swap in the popup. | 7714 // Do a remote-to-local swap in the popup. |
7715 FrameTestHelpers::TestWebFrameClient popupLocalClient; | 7715 FrameTestHelpers::TestWebFrameClient popupLocalClient; |
7716 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None, WebFrameOwnerProperties()); | 7716 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None, WebFrameOwnerProperties()); |
7717 popupRemoteFrame->swap(popupLocalFrame); | 7717 popupRemoteFrame->swap(popupLocalFrame); |
7718 | 7718 |
7719 // The initial document created during the remote-to-local swap should have | 7719 // The initial document created during the remote-to-local swap should have |
7720 // inherited its opener's SecurityOrigin. | 7720 // inherited its opener's SecurityOrigin. |
7721 EXPECT_TRUE(mainFrame->securityOrigin().canAccess(popupView->mainFrame()->se
curityOrigin())); | 7721 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()-
>getSecurityOrigin())); |
7722 | 7722 |
7723 popupView->close(); | 7723 popupView->close(); |
7724 } | 7724 } |
7725 | 7725 |
7726 TEST_F(WebFrameTest, SwapWithOpenerCycle) | 7726 TEST_F(WebFrameTest, SwapWithOpenerCycle) |
7727 { | 7727 { |
7728 // First, create a remote main frame with itself as the opener. | 7728 // First, create a remote main frame with itself as the opener. |
7729 FrameTestHelpers::TestWebViewClient viewClient; | 7729 FrameTestHelpers::TestWebViewClient viewClient; |
7730 WebView* view = WebView::create(&viewClient); | 7730 WebView* view = WebView::create(&viewClient); |
7731 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7731 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
(...skipping 773 matching lines...) Loading... |
8505 } | 8505 } |
8506 | 8506 |
8507 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8507 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
8508 { | 8508 { |
8509 swapLocalFrameToRemoteFrame(); | 8509 swapLocalFrameToRemoteFrame(); |
8510 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8510 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
8511 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8511 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
8512 } | 8512 } |
8513 | 8513 |
8514 } // namespace blink | 8514 } // namespace blink |
OLD | NEW |