| 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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, hitP
oint, hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSou
rceTouchscreen); | 1588 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, hitP
oint, hitPoint, IntSize(0, 0), 0, PlatformEvent::NoModifiers, PlatformGestureSou
rceTouchscreen); |
| 1589 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle
GestureEvent(gestureEvent); | 1589 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle
GestureEvent(gestureEvent); |
| 1590 // when pressed, the button changes its own text to "updatedValue" | 1590 // when pressed, the button changes its own text to "updatedValue" |
| 1591 EXPECT_EQ(String("updatedValue"), element->innerText()); | 1591 EXPECT_EQ(String("updatedValue"), element->innerText()); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) | 1594 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) |
| 1595 { | 1595 { |
| 1596 FrameTestHelpers::TestWebViewClient viewClient; | 1596 FrameTestHelpers::TestWebViewClient viewClient; |
| 1597 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 1597 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 1598 WebView* view = WebView::create(&viewClient); | 1598 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 1599 view->settings()->setJavaScriptEnabled(true); | 1599 view->settings()->setJavaScriptEnabled(true); |
| 1600 view->setMainFrame(remoteClient.frame()); | 1600 view->setMainFrame(remoteClient.frame()); |
| 1601 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); | 1601 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); |
| 1602 root->setReplicatedOrigin(SecurityOrigin::createUnique()); | 1602 root->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 1603 | 1603 |
| 1604 WebFrameOwnerProperties properties; | 1604 WebFrameOwnerProperties properties; |
| 1605 properties.marginWidth = 11; | 1605 properties.marginWidth = 11; |
| 1606 properties.marginHeight = 22; | 1606 properties.marginHeight = 22; |
| 1607 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN
ame", nullptr, nullptr, properties); | 1607 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN
ame", nullptr, nullptr, properties); |
| 1608 | 1608 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1620 EXPECT_NE(nullptr, frameView->horizontalScrollbar()); | 1620 EXPECT_NE(nullptr, frameView->horizontalScrollbar()); |
| 1621 EXPECT_NE(nullptr, frameView->verticalScrollbar()); | 1621 EXPECT_NE(nullptr, frameView->verticalScrollbar()); |
| 1622 | 1622 |
| 1623 view->close(); | 1623 view->close(); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling) | 1626 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling) |
| 1627 { | 1627 { |
| 1628 FrameTestHelpers::TestWebViewClient viewClient; | 1628 FrameTestHelpers::TestWebViewClient viewClient; |
| 1629 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 1629 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 1630 WebView* view = WebView::create(&viewClient); | 1630 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 1631 view->settings()->setJavaScriptEnabled(true); | 1631 view->settings()->setJavaScriptEnabled(true); |
| 1632 view->setMainFrame(remoteClient.frame()); | 1632 view->setMainFrame(remoteClient.frame()); |
| 1633 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); | 1633 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); |
| 1634 root->setReplicatedOrigin(SecurityOrigin::createUnique()); | 1634 root->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 1635 | 1635 |
| 1636 WebFrameOwnerProperties properties; | 1636 WebFrameOwnerProperties properties; |
| 1637 // Turn off scrolling in the subframe. | 1637 // Turn off scrolling in the subframe. |
| 1638 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff
; | 1638 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff
; |
| 1639 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN
ame", nullptr, nullptr, properties); | 1639 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root, "frameN
ame", nullptr, nullptr, properties); |
| 1640 | 1640 |
| (...skipping 5442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7083 } | 7083 } |
| 7084 | 7084 |
| 7085 // Make sure that an embedder-triggered detach with a remote frame parent | 7085 // Make sure that an embedder-triggered detach with a remote frame parent |
| 7086 // doesn't leave behind dangling pointers. | 7086 // doesn't leave behind dangling pointers. |
| 7087 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) | 7087 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) |
| 7088 { | 7088 { |
| 7089 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o | 7089 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o |
| 7090 // write tests with a top-level remote frame. | 7090 // write tests with a top-level remote frame. |
| 7091 FrameTestHelpers::TestWebViewClient viewClient; | 7091 FrameTestHelpers::TestWebViewClient viewClient; |
| 7092 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7092 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7093 WebView* view = WebView::create(&viewClient); | 7093 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7094 view->setMainFrame(remoteClient.frame()); | 7094 view->setMainFrame(remoteClient.frame()); |
| 7095 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); | 7095 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); |
| 7096 | 7096 |
| 7097 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. | 7097 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. |
| 7098 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame(); | 7098 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame(); |
| 7099 view->close(); | 7099 view->close(); |
| 7100 childCoreFrame.clear(); | 7100 childCoreFrame.clear(); |
| 7101 } | 7101 } |
| 7102 | 7102 |
| 7103 class WebFrameSwapTest : public WebFrameTest { | 7103 class WebFrameSwapTest : public WebFrameTest { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7729 TEST_F(WebFrameTest, WindowOpenRemoteClose) | 7729 TEST_F(WebFrameTest, WindowOpenRemoteClose) |
| 7730 { | 7730 { |
| 7731 FrameTestHelpers::WebViewHelper mainWebView; | 7731 FrameTestHelpers::WebViewHelper mainWebView; |
| 7732 mainWebView.initialize(true); | 7732 mainWebView.initialize(true); |
| 7733 | 7733 |
| 7734 // Create a remote window that will be closed later in the test. | 7734 // Create a remote window that will be closed later in the test. |
| 7735 RemoteWindowCloseClient viewClient; | 7735 RemoteWindowCloseClient viewClient; |
| 7736 FrameTestHelpers::TestWebRemoteFrameClient frameClient; | 7736 FrameTestHelpers::TestWebRemoteFrameClient frameClient; |
| 7737 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame(); | 7737 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame(); |
| 7738 | 7738 |
| 7739 WebView* view = WebView::create(&viewClient); | 7739 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7740 view->setMainFrame(webRemoteFrame); | 7740 view->setMainFrame(webRemoteFrame); |
| 7741 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame()); | 7741 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame()); |
| 7742 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt
p://127.0.0.1")); | 7742 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt
p://127.0.0.1")); |
| 7743 | 7743 |
| 7744 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to
ImplBase()->frame()); | 7744 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to
ImplBase()->frame()); |
| 7745 RemoteFrame* remoteFrame = webRemoteFrame->frame(); | 7745 RemoteFrame* remoteFrame = webRemoteFrame->frame(); |
| 7746 | 7746 |
| 7747 // Attempt to close the window, which should fail as it isn't opened | 7747 // Attempt to close the window, which should fail as it isn't opened |
| 7748 // by a script. | 7748 // by a script. |
| 7749 remoteFrame->domWindow()->close(localFrame->document()); | 7749 remoteFrame->domWindow()->close(localFrame->document()); |
| 7750 EXPECT_FALSE(viewClient.closed()); | 7750 EXPECT_FALSE(viewClient.closed()); |
| 7751 | 7751 |
| 7752 // Marking it as opened by a script should now allow it to be closed. | 7752 // Marking it as opened by a script should now allow it to be closed. |
| 7753 remoteFrame->page()->setOpenedByDOM(); | 7753 remoteFrame->page()->setOpenedByDOM(); |
| 7754 remoteFrame->domWindow()->close(localFrame->document()); | 7754 remoteFrame->domWindow()->close(localFrame->document()); |
| 7755 EXPECT_TRUE(viewClient.closed()); | 7755 EXPECT_TRUE(viewClient.closed()); |
| 7756 | 7756 |
| 7757 view->close(); | 7757 view->close(); |
| 7758 } | 7758 } |
| 7759 | 7759 |
| 7760 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener) | 7760 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener) |
| 7761 { | 7761 { |
| 7762 FrameTestHelpers::WebViewHelper mainWebView; | 7762 FrameTestHelpers::WebViewHelper mainWebView; |
| 7763 mainWebView.initialize(true); | 7763 mainWebView.initialize(true); |
| 7764 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); | 7764 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); |
| 7765 | 7765 |
| 7766 // Create a popup with a remote frame and set its opener to the main frame. | 7766 // Create a popup with a remote frame and set its opener to the main frame. |
| 7767 FrameTestHelpers::TestWebViewClient popupViewClient; | 7767 FrameTestHelpers::TestWebViewClient popupViewClient; |
| 7768 WebView* popupView = WebView::create(&popupViewClient); | 7768 WebView* popupView = WebView::create(&popupViewClient, WebPageVisibilityStat
eVisible); |
| 7769 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; | 7769 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; |
| 7770 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); | 7770 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); |
| 7771 popupView->setMainFrame(popupRemoteFrame); | 7771 popupView->setMainFrame(popupRemoteFrame); |
| 7772 popupRemoteFrame->setOpener(mainFrame); | 7772 popupRemoteFrame->setOpener(mainFrame); |
| 7773 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); | 7773 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); |
| 7774 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()
->getSecurityOrigin())); | 7774 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()
->getSecurityOrigin())); |
| 7775 | 7775 |
| 7776 // Do a remote-to-local swap in the popup. | 7776 // Do a remote-to-local swap in the popup. |
| 7777 FrameTestHelpers::TestWebFrameClient popupLocalClient; | 7777 FrameTestHelpers::TestWebFrameClient popupLocalClient; |
| 7778 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None); | 7778 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None); |
| 7779 popupRemoteFrame->swap(popupLocalFrame); | 7779 popupRemoteFrame->swap(popupLocalFrame); |
| 7780 | 7780 |
| 7781 // The initial document created during the remote-to-local swap should have | 7781 // The initial document created during the remote-to-local swap should have |
| 7782 // inherited its opener's SecurityOrigin. | 7782 // inherited its opener's SecurityOrigin. |
| 7783 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()-
>getSecurityOrigin())); | 7783 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()-
>getSecurityOrigin())); |
| 7784 | 7784 |
| 7785 popupView->close(); | 7785 popupView->close(); |
| 7786 } | 7786 } |
| 7787 | 7787 |
| 7788 TEST_F(WebFrameTest, SwapWithOpenerCycle) | 7788 TEST_F(WebFrameTest, SwapWithOpenerCycle) |
| 7789 { | 7789 { |
| 7790 // First, create a remote main frame with itself as the opener. | 7790 // First, create a remote main frame with itself as the opener. |
| 7791 FrameTestHelpers::TestWebViewClient viewClient; | 7791 FrameTestHelpers::TestWebViewClient viewClient; |
| 7792 WebView* view = WebView::create(&viewClient); | 7792 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7793 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7793 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7794 WebRemoteFrame* remoteFrame = remoteClient.frame(); | 7794 WebRemoteFrame* remoteFrame = remoteClient.frame(); |
| 7795 view->setMainFrame(remoteFrame); | 7795 view->setMainFrame(remoteFrame); |
| 7796 remoteFrame->setOpener(remoteFrame); | 7796 remoteFrame->setOpener(remoteFrame); |
| 7797 | 7797 |
| 7798 // Now swap in a local frame. It shouldn't crash. | 7798 // Now swap in a local frame. It shouldn't crash. |
| 7799 FrameTestHelpers::TestWebFrameClient localClient; | 7799 FrameTestHelpers::TestWebFrameClient localClient; |
| 7800 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r
emoteFrame, WebSandboxFlags::None); | 7800 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r
emoteFrame, WebSandboxFlags::None); |
| 7801 remoteFrame->swap(localFrame); | 7801 remoteFrame->swap(localFrame); |
| 7802 | 7802 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7821 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} | 7821 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} |
| 7822 | 7822 |
| 7823 private: | 7823 private: |
| 7824 WebHistoryCommitType m_historyCommitType; | 7824 WebHistoryCommitType m_historyCommitType; |
| 7825 }; | 7825 }; |
| 7826 | 7826 |
| 7827 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) | 7827 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) |
| 7828 { | 7828 { |
| 7829 FrameTestHelpers::TestWebViewClient viewClient; | 7829 FrameTestHelpers::TestWebViewClient viewClient; |
| 7830 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7830 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7831 WebView* view = WebView::create(&viewClient); | 7831 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7832 view->setMainFrame(remoteClient.frame()); | 7832 view->setMainFrame(remoteClient.frame()); |
| 7833 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); | 7833 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); |
| 7834 | 7834 |
| 7835 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7835 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. |
| 7836 CommitTypeWebFrameClient childFrameClient; | 7836 CommitTypeWebFrameClient childFrameClient; |
| 7837 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame(), "frameName", &childFrameClient); | 7837 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame(), "frameName", &childFrameClient); |
| 7838 registerMockedHttpURLLoad("foo.html"); | 7838 registerMockedHttpURLLoad("foo.html"); |
| 7839 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7839 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7840 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7840 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7841 view->close(); | 7841 view->close(); |
| 7842 } | 7842 } |
| 7843 | 7843 |
| 7844 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 7844 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 7845 public: | 7845 public: |
| 7846 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } | 7846 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } |
| 7847 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled
) override { m_didHandleGestureEvent = true; } | 7847 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled
) override { m_didHandleGestureEvent = true; } |
| 7848 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } | 7848 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } |
| 7849 | 7849 |
| 7850 private: | 7850 private: |
| 7851 bool m_didHandleGestureEvent; | 7851 bool m_didHandleGestureEvent; |
| 7852 }; | 7852 }; |
| 7853 | 7853 |
| 7854 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) | 7854 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) |
| 7855 { | 7855 { |
| 7856 FrameTestHelpers::TestWebViewClient viewClient; | 7856 FrameTestHelpers::TestWebViewClient viewClient; |
| 7857 WebView* view = WebView::create(&viewClient); | 7857 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7858 | 7858 |
| 7859 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7859 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7860 view->setMainFrame(remoteClient.frame()); | 7860 view->setMainFrame(remoteClient.frame()); |
| 7861 | 7861 |
| 7862 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); | 7862 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); |
| 7863 | 7863 |
| 7864 GestureEventTestWebViewClient childViewClient; | 7864 GestureEventTestWebViewClient childViewClient; |
| 7865 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient
(), childFrame); | 7865 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient
(), childFrame); |
| 7866 | 7866 |
| 7867 view->resize(WebSize(1000, 1000)); | 7867 view->resize(WebSize(1000, 1000)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7917 options.crossOriginRequestPolicy = AllowCrossOriginRequests; | 7917 options.crossOriginRequestPolicy = AllowCrossOriginRequests; |
| 7918 DocumentThreadableLoader::loadResourceSynchronously( | 7918 DocumentThreadableLoader::loadResourceSynchronously( |
| 7919 *frame->document(), request, client, options, resourceLoaderOptions); | 7919 *frame->document(), request, client, options, resourceLoaderOptions); |
| 7920 EXPECT_FALSE(client.failed()); | 7920 EXPECT_FALSE(client.failed()); |
| 7921 } | 7921 } |
| 7922 | 7922 |
| 7923 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) | 7923 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) |
| 7924 { | 7924 { |
| 7925 FrameTestHelpers::TestWebViewClient viewClient; | 7925 FrameTestHelpers::TestWebViewClient viewClient; |
| 7926 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7926 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7927 WebView* view = WebView::create(&viewClient); | 7927 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 7928 view->setMainFrame(remoteClient.frame()); | 7928 view->setMainFrame(remoteClient.frame()); |
| 7929 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; | 7929 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; |
| 7930 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF
rame()->toWebRemoteFrame(), &childFrameClient); | 7930 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF
rame()->toWebRemoteFrame(), &childFrameClient); |
| 7931 childFrame->detach(); | 7931 childFrame->detach(); |
| 7932 view->close(); | 7932 view->close(); |
| 7933 childFrame->close(); | 7933 childFrame->close(); |
| 7934 } | 7934 } |
| 7935 | 7935 |
| 7936 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { | 7936 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { |
| 7937 public: | 7937 public: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8042 params.screenPosition = WebDeviceEmulationParams::Mobile; | 8042 params.screenPosition = WebDeviceEmulationParams::Mobile; |
| 8043 m_webViewHelper.webView()->enableDeviceEmulation(params); | 8043 m_webViewHelper.webView()->enableDeviceEmulation(params); |
| 8044 EXPECT_EQ("20x20", dumpSize("pointer")); | 8044 EXPECT_EQ("20x20", dumpSize("pointer")); |
| 8045 m_webViewHelper.webView()->disableDeviceEmulation(); | 8045 m_webViewHelper.webView()->disableDeviceEmulation(); |
| 8046 } | 8046 } |
| 8047 | 8047 |
| 8048 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling) | 8048 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling) |
| 8049 { | 8049 { |
| 8050 FrameTestHelpers::TestWebViewClient viewClient; | 8050 FrameTestHelpers::TestWebViewClient viewClient; |
| 8051 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8051 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8052 WebView* view = WebView::create(&viewClient); | 8052 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 8053 view->setMainFrame(remoteClient.frame()); | 8053 view->setMainFrame(remoteClient.frame()); |
| 8054 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); | 8054 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); |
| 8055 | 8055 |
| 8056 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2
")); | 8056 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2
")); |
| 8057 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4
", nullptr, secondFrame)); | 8057 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4
", nullptr, secondFrame)); |
| 8058 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3"
, nullptr, secondFrame)); | 8058 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3"
, nullptr, secondFrame)); |
| 8059 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1"
)); | 8059 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1"
)); |
| 8060 | 8060 |
| 8061 EXPECT_EQ(firstFrame, parent->firstChild()); | 8061 EXPECT_EQ(firstFrame, parent->firstChild()); |
| 8062 EXPECT_EQ(nullptr, firstFrame->previousSibling()); | 8062 EXPECT_EQ(nullptr, firstFrame->previousSibling()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8077 EXPECT_EQ(parent, thirdFrame->parent()); | 8077 EXPECT_EQ(parent, thirdFrame->parent()); |
| 8078 EXPECT_EQ(parent, fourthFrame->parent()); | 8078 EXPECT_EQ(parent, fourthFrame->parent()); |
| 8079 | 8079 |
| 8080 view->close(); | 8080 view->close(); |
| 8081 } | 8081 } |
| 8082 | 8082 |
| 8083 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame) | 8083 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame) |
| 8084 { | 8084 { |
| 8085 FrameTestHelpers::TestWebViewClient viewClient; | 8085 FrameTestHelpers::TestWebViewClient viewClient; |
| 8086 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8086 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8087 WebView* view = WebView::create(&viewClient); | 8087 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 8088 view->settings()->setJavaScriptEnabled(true); | 8088 view->settings()->setJavaScriptEnabled(true); |
| 8089 view->setMainFrame(remoteClient.frame()); | 8089 view->setMainFrame(remoteClient.frame()); |
| 8090 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); | 8090 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); |
| 8091 root->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8091 root->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 8092 | 8092 |
| 8093 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); | 8093 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); |
| 8094 | 8094 |
| 8095 // Finally, make sure an embedder triggered load in the local frame swapped | 8095 // Finally, make sure an embedder triggered load in the local frame swapped |
| 8096 // back in works. | 8096 // back in works. |
| 8097 registerMockedHttpURLLoad("send_beacon.html"); | 8097 registerMockedHttpURLLoad("send_beacon.html"); |
| 8098 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() | 8098 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() |
| 8099 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); | 8099 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); |
| 8100 | 8100 |
| 8101 view->close(); | 8101 view->close(); |
| 8102 } | 8102 } |
| 8103 | 8103 |
| 8104 TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesFromChildWithRemoteMainFra
me) | 8104 TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesFromChildWithRemoteMainFra
me) |
| 8105 { | 8105 { |
| 8106 FrameTestHelpers::TestWebViewClient viewClient; | 8106 FrameTestHelpers::TestWebViewClient viewClient; |
| 8107 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8107 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8108 WebView* view = WebView::create(&viewClient); | 8108 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 8109 view->setMainFrame(remoteClient.frame()); | 8109 view->setMainFrame(remoteClient.frame()); |
| 8110 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); | 8110 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); |
| 8111 root->setReplicatedOrigin(SecurityOrigin::create(toKURL(m_notBaseURL))); | 8111 root->setReplicatedOrigin(SecurityOrigin::create(toKURL(m_notBaseURL))); |
| 8112 | 8112 |
| 8113 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); | 8113 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); |
| 8114 | 8114 |
| 8115 registerMockedHttpURLLoad("foo.html"); | 8115 registerMockedHttpURLLoad("foo.html"); |
| 8116 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "foo.html"); | 8116 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "foo.html"); |
| 8117 EXPECT_EQ(WebURL(SecurityOrigin::urlWithUniqueSecurityOrigin()), localFrame-
>document().firstPartyForCookies()); | 8117 EXPECT_EQ(WebURL(SecurityOrigin::urlWithUniqueSecurityOrigin()), localFrame-
>document().firstPartyForCookies()); |
| 8118 | 8118 |
| 8119 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); | 8119 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); |
| 8120 EXPECT_EQ(WebURL(toKURL(m_notBaseURL)), localFrame->document().firstPartyFor
Cookies()); | 8120 EXPECT_EQ(WebURL(toKURL(m_notBaseURL)), localFrame->document().firstPartyFor
Cookies()); |
| 8121 SchemeRegistry::removeURLSchemeAsFirstPartyWhenTopLevel("http"); | 8121 SchemeRegistry::removeURLSchemeAsFirstPartyWhenTopLevel("http"); |
| 8122 | 8122 |
| 8123 view->close(); | 8123 view->close(); |
| 8124 } | 8124 } |
| 8125 | 8125 |
| 8126 // See https://crbug.com/525285. | 8126 // See https://crbug.com/525285. |
| 8127 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) | 8127 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) |
| 8128 { | 8128 { |
| 8129 FrameTestHelpers::TestWebViewClient viewClient; | 8129 FrameTestHelpers::TestWebViewClient viewClient; |
| 8130 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8130 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8131 WebView* view = WebView::create(&viewClient); | 8131 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); |
| 8132 view->setMainFrame(remoteClient.frame()); | 8132 view->setMainFrame(remoteClient.frame()); |
| 8133 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); | 8133 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); |
| 8134 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8134 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 8135 | 8135 |
| 8136 FrameTestHelpers::createLocalChild(remoteRoot); | 8136 FrameTestHelpers::createLocalChild(remoteRoot); |
| 8137 | 8137 |
| 8138 // Do a remote-to-local swap of the top frame. | 8138 // Do a remote-to-local swap of the top frame. |
| 8139 FrameTestHelpers::TestWebFrameClient localClient; | 8139 FrameTestHelpers::TestWebFrameClient localClient; |
| 8140 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re
moteRoot, WebSandboxFlags::None); | 8140 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re
moteRoot, WebSandboxFlags::None); |
| 8141 remoteRoot->swap(localRoot); | 8141 remoteRoot->swap(localRoot); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8757 ASSERT_FALSE(grandchildFrame->canHaveSecureChild()); | 8757 ASSERT_FALSE(grandchildFrame->canHaveSecureChild()); |
| 8758 Document* mainDocument = mainFrame->document(); | 8758 Document* mainDocument = mainFrame->document(); |
| 8759 Document* childDocument = childFrame->document(); | 8759 Document* childDocument = childFrame->document(); |
| 8760 Document* grandchildDocument = grandchildFrame->document(); | 8760 Document* grandchildDocument = grandchildFrame->document(); |
| 8761 ASSERT_FALSE(mainDocument->isSecureContext()); | 8761 ASSERT_FALSE(mainDocument->isSecureContext()); |
| 8762 ASSERT_TRUE(childDocument->isSecureContext()); | 8762 ASSERT_TRUE(childDocument->isSecureContext()); |
| 8763 ASSERT_FALSE(grandchildDocument->isSecureContext()); | 8763 ASSERT_FALSE(grandchildDocument->isSecureContext()); |
| 8764 } | 8764 } |
| 8765 | 8765 |
| 8766 } // namespace blink | 8766 } // namespace blink |
| OLD | NEW |