| 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, true); |
| 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, true); |
| 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 5449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7090 } | 7090 } |
| 7091 | 7091 |
| 7092 // Make sure that an embedder-triggered detach with a remote frame parent | 7092 // Make sure that an embedder-triggered detach with a remote frame parent |
| 7093 // doesn't leave behind dangling pointers. | 7093 // doesn't leave behind dangling pointers. |
| 7094 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) | 7094 TEST_P(ParameterizedWebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) |
| 7095 { | 7095 { |
| 7096 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o | 7096 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o |
| 7097 // write tests with a top-level remote frame. | 7097 // write tests with a top-level remote frame. |
| 7098 FrameTestHelpers::TestWebViewClient viewClient; | 7098 FrameTestHelpers::TestWebViewClient viewClient; |
| 7099 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7099 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7100 WebView* view = WebView::create(&viewClient); | 7100 WebView* view = WebView::create(&viewClient, true); |
| 7101 view->setMainFrame(remoteClient.frame()); | 7101 view->setMainFrame(remoteClient.frame()); |
| 7102 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); | 7102 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); |
| 7103 | 7103 |
| 7104 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. | 7104 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. |
| 7105 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame(); | 7105 Persistent<Frame> childCoreFrame = childFrame->toImplBase()->frame(); |
| 7106 view->close(); | 7106 view->close(); |
| 7107 childCoreFrame.clear(); | 7107 childCoreFrame.clear(); |
| 7108 } | 7108 } |
| 7109 | 7109 |
| 7110 class WebFrameSwapTest : public WebFrameTest { | 7110 class WebFrameSwapTest : public WebFrameTest { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7736 TEST_F(WebFrameTest, WindowOpenRemoteClose) | 7736 TEST_F(WebFrameTest, WindowOpenRemoteClose) |
| 7737 { | 7737 { |
| 7738 FrameTestHelpers::WebViewHelper mainWebView; | 7738 FrameTestHelpers::WebViewHelper mainWebView; |
| 7739 mainWebView.initialize(true); | 7739 mainWebView.initialize(true); |
| 7740 | 7740 |
| 7741 // Create a remote window that will be closed later in the test. | 7741 // Create a remote window that will be closed later in the test. |
| 7742 RemoteWindowCloseClient viewClient; | 7742 RemoteWindowCloseClient viewClient; |
| 7743 FrameTestHelpers::TestWebRemoteFrameClient frameClient; | 7743 FrameTestHelpers::TestWebRemoteFrameClient frameClient; |
| 7744 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame(); | 7744 WebRemoteFrameImpl* webRemoteFrame = frameClient.frame(); |
| 7745 | 7745 |
| 7746 WebView* view = WebView::create(&viewClient); | 7746 WebView* view = WebView::create(&viewClient, true); |
| 7747 view->setMainFrame(webRemoteFrame); | 7747 view->setMainFrame(webRemoteFrame); |
| 7748 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame()); | 7748 view->mainFrame()->setOpener(mainWebView.webView()->mainFrame()); |
| 7749 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt
p://127.0.0.1")); | 7749 webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("htt
p://127.0.0.1")); |
| 7750 | 7750 |
| 7751 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to
ImplBase()->frame()); | 7751 LocalFrame* localFrame = toLocalFrame(mainWebView.webView()->mainFrame()->to
ImplBase()->frame()); |
| 7752 RemoteFrame* remoteFrame = webRemoteFrame->frame(); | 7752 RemoteFrame* remoteFrame = webRemoteFrame->frame(); |
| 7753 | 7753 |
| 7754 // Attempt to close the window, which should fail as it isn't opened | 7754 // Attempt to close the window, which should fail as it isn't opened |
| 7755 // by a script. | 7755 // by a script. |
| 7756 remoteFrame->domWindow()->close(localFrame->document()); | 7756 remoteFrame->domWindow()->close(localFrame->document()); |
| 7757 EXPECT_FALSE(viewClient.closed()); | 7757 EXPECT_FALSE(viewClient.closed()); |
| 7758 | 7758 |
| 7759 // Marking it as opened by a script should now allow it to be closed. | 7759 // Marking it as opened by a script should now allow it to be closed. |
| 7760 remoteFrame->page()->setOpenedByDOM(); | 7760 remoteFrame->page()->setOpenedByDOM(); |
| 7761 remoteFrame->domWindow()->close(localFrame->document()); | 7761 remoteFrame->domWindow()->close(localFrame->document()); |
| 7762 EXPECT_TRUE(viewClient.closed()); | 7762 EXPECT_TRUE(viewClient.closed()); |
| 7763 | 7763 |
| 7764 view->close(); | 7764 view->close(); |
| 7765 } | 7765 } |
| 7766 | 7766 |
| 7767 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener) | 7767 TEST_F(WebFrameTest, NavigateRemoteToLocalWithOpener) |
| 7768 { | 7768 { |
| 7769 FrameTestHelpers::WebViewHelper mainWebView; | 7769 FrameTestHelpers::WebViewHelper mainWebView; |
| 7770 mainWebView.initialize(true); | 7770 mainWebView.initialize(true); |
| 7771 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); | 7771 WebFrame* mainFrame = mainWebView.webView()->mainFrame(); |
| 7772 | 7772 |
| 7773 // Create a popup with a remote frame and set its opener to the main frame. | 7773 // Create a popup with a remote frame and set its opener to the main frame. |
| 7774 FrameTestHelpers::TestWebViewClient popupViewClient; | 7774 FrameTestHelpers::TestWebViewClient popupViewClient; |
| 7775 WebView* popupView = WebView::create(&popupViewClient); | 7775 WebView* popupView = WebView::create(&popupViewClient, true); |
| 7776 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; | 7776 FrameTestHelpers::TestWebRemoteFrameClient popupRemoteClient; |
| 7777 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); | 7777 WebRemoteFrame* popupRemoteFrame = popupRemoteClient.frame(); |
| 7778 popupView->setMainFrame(popupRemoteFrame); | 7778 popupView->setMainFrame(popupRemoteFrame); |
| 7779 popupRemoteFrame->setOpener(mainFrame); | 7779 popupRemoteFrame->setOpener(mainFrame); |
| 7780 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); | 7780 popupRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("h
ttp://foo.com")); |
| 7781 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()
->getSecurityOrigin())); | 7781 EXPECT_FALSE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()
->getSecurityOrigin())); |
| 7782 | 7782 |
| 7783 // Do a remote-to-local swap in the popup. | 7783 // Do a remote-to-local swap in the popup. |
| 7784 FrameTestHelpers::TestWebFrameClient popupLocalClient; | 7784 FrameTestHelpers::TestWebFrameClient popupLocalClient; |
| 7785 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None); | 7785 WebLocalFrame* popupLocalFrame = WebLocalFrame::createProvisional(&popupLoca
lClient, popupRemoteFrame, WebSandboxFlags::None); |
| 7786 popupRemoteFrame->swap(popupLocalFrame); | 7786 popupRemoteFrame->swap(popupLocalFrame); |
| 7787 | 7787 |
| 7788 // The initial document created during the remote-to-local swap should have | 7788 // The initial document created during the remote-to-local swap should have |
| 7789 // inherited its opener's SecurityOrigin. | 7789 // inherited its opener's SecurityOrigin. |
| 7790 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()-
>getSecurityOrigin())); | 7790 EXPECT_TRUE(mainFrame->getSecurityOrigin().canAccess(popupView->mainFrame()-
>getSecurityOrigin())); |
| 7791 | 7791 |
| 7792 popupView->close(); | 7792 popupView->close(); |
| 7793 } | 7793 } |
| 7794 | 7794 |
| 7795 TEST_F(WebFrameTest, SwapWithOpenerCycle) | 7795 TEST_F(WebFrameTest, SwapWithOpenerCycle) |
| 7796 { | 7796 { |
| 7797 // First, create a remote main frame with itself as the opener. | 7797 // First, create a remote main frame with itself as the opener. |
| 7798 FrameTestHelpers::TestWebViewClient viewClient; | 7798 FrameTestHelpers::TestWebViewClient viewClient; |
| 7799 WebView* view = WebView::create(&viewClient); | 7799 WebView* view = WebView::create(&viewClient, true); |
| 7800 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7800 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7801 WebRemoteFrame* remoteFrame = remoteClient.frame(); | 7801 WebRemoteFrame* remoteFrame = remoteClient.frame(); |
| 7802 view->setMainFrame(remoteFrame); | 7802 view->setMainFrame(remoteFrame); |
| 7803 remoteFrame->setOpener(remoteFrame); | 7803 remoteFrame->setOpener(remoteFrame); |
| 7804 | 7804 |
| 7805 // Now swap in a local frame. It shouldn't crash. | 7805 // Now swap in a local frame. It shouldn't crash. |
| 7806 FrameTestHelpers::TestWebFrameClient localClient; | 7806 FrameTestHelpers::TestWebFrameClient localClient; |
| 7807 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r
emoteFrame, WebSandboxFlags::None); | 7807 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&localClient, r
emoteFrame, WebSandboxFlags::None); |
| 7808 remoteFrame->swap(localFrame); | 7808 remoteFrame->swap(localFrame); |
| 7809 | 7809 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7828 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} | 7828 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} |
| 7829 | 7829 |
| 7830 private: | 7830 private: |
| 7831 WebHistoryCommitType m_historyCommitType; | 7831 WebHistoryCommitType m_historyCommitType; |
| 7832 }; | 7832 }; |
| 7833 | 7833 |
| 7834 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) | 7834 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) |
| 7835 { | 7835 { |
| 7836 FrameTestHelpers::TestWebViewClient viewClient; | 7836 FrameTestHelpers::TestWebViewClient viewClient; |
| 7837 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7837 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7838 WebView* view = WebView::create(&viewClient); | 7838 WebView* view = WebView::create(&viewClient, true); |
| 7839 view->setMainFrame(remoteClient.frame()); | 7839 view->setMainFrame(remoteClient.frame()); |
| 7840 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); | 7840 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); |
| 7841 | 7841 |
| 7842 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7842 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. |
| 7843 CommitTypeWebFrameClient childFrameClient; | 7843 CommitTypeWebFrameClient childFrameClient; |
| 7844 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame(), "frameName", &childFrameClient); | 7844 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame(), "frameName", &childFrameClient); |
| 7845 registerMockedHttpURLLoad("foo.html"); | 7845 registerMockedHttpURLLoad("foo.html"); |
| 7846 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7846 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7847 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7847 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7848 view->close(); | 7848 view->close(); |
| 7849 } | 7849 } |
| 7850 | 7850 |
| 7851 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 7851 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 7852 public: | 7852 public: |
| 7853 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } | 7853 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } |
| 7854 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled
) override { m_didHandleGestureEvent = true; } | 7854 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled
) override { m_didHandleGestureEvent = true; } |
| 7855 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } | 7855 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } |
| 7856 | 7856 |
| 7857 private: | 7857 private: |
| 7858 bool m_didHandleGestureEvent; | 7858 bool m_didHandleGestureEvent; |
| 7859 }; | 7859 }; |
| 7860 | 7860 |
| 7861 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) | 7861 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) |
| 7862 { | 7862 { |
| 7863 FrameTestHelpers::TestWebViewClient viewClient; | 7863 FrameTestHelpers::TestWebViewClient viewClient; |
| 7864 WebView* view = WebView::create(&viewClient); | 7864 WebView* view = WebView::create(&viewClient, true); |
| 7865 | 7865 |
| 7866 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7866 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7867 view->setMainFrame(remoteClient.frame()); | 7867 view->setMainFrame(remoteClient.frame()); |
| 7868 | 7868 |
| 7869 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); | 7869 WebLocalFrame* childFrame = FrameTestHelpers::createLocalChild(view->mainFra
me()->toWebRemoteFrame()); |
| 7870 | 7870 |
| 7871 GestureEventTestWebViewClient childViewClient; | 7871 GestureEventTestWebViewClient childViewClient; |
| 7872 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient
(), childFrame); | 7872 WebFrameWidget* widget = WebFrameWidget::create(childViewClient.widgetClient
(), childFrame); |
| 7873 | 7873 |
| 7874 view->resize(WebSize(1000, 1000)); | 7874 view->resize(WebSize(1000, 1000)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7924 options.crossOriginRequestPolicy = AllowCrossOriginRequests; | 7924 options.crossOriginRequestPolicy = AllowCrossOriginRequests; |
| 7925 DocumentThreadableLoader::loadResourceSynchronously( | 7925 DocumentThreadableLoader::loadResourceSynchronously( |
| 7926 *frame->document(), request, client, options, resourceLoaderOptions); | 7926 *frame->document(), request, client, options, resourceLoaderOptions); |
| 7927 EXPECT_FALSE(client.failed()); | 7927 EXPECT_FALSE(client.failed()); |
| 7928 } | 7928 } |
| 7929 | 7929 |
| 7930 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) | 7930 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) |
| 7931 { | 7931 { |
| 7932 FrameTestHelpers::TestWebViewClient viewClient; | 7932 FrameTestHelpers::TestWebViewClient viewClient; |
| 7933 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7933 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7934 WebView* view = WebView::create(&viewClient); | 7934 WebView* view = WebView::create(&viewClient, true); |
| 7935 view->setMainFrame(remoteClient.frame()); | 7935 view->setMainFrame(remoteClient.frame()); |
| 7936 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; | 7936 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; |
| 7937 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF
rame()->toWebRemoteFrame(), &childFrameClient); | 7937 WebRemoteFrame* childFrame = FrameTestHelpers::createRemoteChild(view->mainF
rame()->toWebRemoteFrame(), &childFrameClient); |
| 7938 childFrame->detach(); | 7938 childFrame->detach(); |
| 7939 view->close(); | 7939 view->close(); |
| 7940 childFrame->close(); | 7940 childFrame->close(); |
| 7941 } | 7941 } |
| 7942 | 7942 |
| 7943 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { | 7943 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { |
| 7944 public: | 7944 public: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8049 params.screenPosition = WebDeviceEmulationParams::Mobile; | 8049 params.screenPosition = WebDeviceEmulationParams::Mobile; |
| 8050 m_webViewHelper.webView()->enableDeviceEmulation(params); | 8050 m_webViewHelper.webView()->enableDeviceEmulation(params); |
| 8051 EXPECT_EQ("20x20", dumpSize("pointer")); | 8051 EXPECT_EQ("20x20", dumpSize("pointer")); |
| 8052 m_webViewHelper.webView()->disableDeviceEmulation(); | 8052 m_webViewHelper.webView()->disableDeviceEmulation(); |
| 8053 } | 8053 } |
| 8054 | 8054 |
| 8055 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling) | 8055 TEST_P(ParameterizedWebFrameTest, CreateLocalChildWithPreviousSibling) |
| 8056 { | 8056 { |
| 8057 FrameTestHelpers::TestWebViewClient viewClient; | 8057 FrameTestHelpers::TestWebViewClient viewClient; |
| 8058 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8058 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8059 WebView* view = WebView::create(&viewClient); | 8059 WebView* view = WebView::create(&viewClient, true); |
| 8060 view->setMainFrame(remoteClient.frame()); | 8060 view->setMainFrame(remoteClient.frame()); |
| 8061 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); | 8061 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); |
| 8062 | 8062 |
| 8063 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2
")); | 8063 WebLocalFrame* secondFrame(FrameTestHelpers::createLocalChild(parent, "name2
")); |
| 8064 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4
", nullptr, secondFrame)); | 8064 WebLocalFrame* fourthFrame(FrameTestHelpers::createLocalChild(parent, "name4
", nullptr, secondFrame)); |
| 8065 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3"
, nullptr, secondFrame)); | 8065 WebLocalFrame* thirdFrame(FrameTestHelpers::createLocalChild(parent, "name3"
, nullptr, secondFrame)); |
| 8066 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1"
)); | 8066 WebLocalFrame* firstFrame(FrameTestHelpers::createLocalChild(parent, "name1"
)); |
| 8067 | 8067 |
| 8068 EXPECT_EQ(firstFrame, parent->firstChild()); | 8068 EXPECT_EQ(firstFrame, parent->firstChild()); |
| 8069 EXPECT_EQ(nullptr, firstFrame->previousSibling()); | 8069 EXPECT_EQ(nullptr, firstFrame->previousSibling()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8084 EXPECT_EQ(parent, thirdFrame->parent()); | 8084 EXPECT_EQ(parent, thirdFrame->parent()); |
| 8085 EXPECT_EQ(parent, fourthFrame->parent()); | 8085 EXPECT_EQ(parent, fourthFrame->parent()); |
| 8086 | 8086 |
| 8087 view->close(); | 8087 view->close(); |
| 8088 } | 8088 } |
| 8089 | 8089 |
| 8090 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame) | 8090 TEST_P(ParameterizedWebFrameTest, SendBeaconFromChildWithRemoteMainFrame) |
| 8091 { | 8091 { |
| 8092 FrameTestHelpers::TestWebViewClient viewClient; | 8092 FrameTestHelpers::TestWebViewClient viewClient; |
| 8093 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8093 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8094 WebView* view = WebView::create(&viewClient); | 8094 WebView* view = WebView::create(&viewClient, true); |
| 8095 view->settings()->setJavaScriptEnabled(true); | 8095 view->settings()->setJavaScriptEnabled(true); |
| 8096 view->setMainFrame(remoteClient.frame()); | 8096 view->setMainFrame(remoteClient.frame()); |
| 8097 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); | 8097 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); |
| 8098 root->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8098 root->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 8099 | 8099 |
| 8100 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); | 8100 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root); |
| 8101 | 8101 |
| 8102 // Finally, make sure an embedder triggered load in the local frame swapped | 8102 // Finally, make sure an embedder triggered load in the local frame swapped |
| 8103 // back in works. | 8103 // back in works. |
| 8104 registerMockedHttpURLLoad("send_beacon.html"); | 8104 registerMockedHttpURLLoad("send_beacon.html"); |
| 8105 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() | 8105 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() |
| 8106 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); | 8106 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); |
| 8107 | 8107 |
| 8108 view->close(); | 8108 view->close(); |
| 8109 } | 8109 } |
| 8110 | 8110 |
| 8111 // See https://crbug.com/525285. | 8111 // See https://crbug.com/525285. |
| 8112 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) | 8112 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) |
| 8113 { | 8113 { |
| 8114 FrameTestHelpers::TestWebViewClient viewClient; | 8114 FrameTestHelpers::TestWebViewClient viewClient; |
| 8115 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 8115 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 8116 WebView* view = WebView::create(&viewClient); | 8116 WebView* view = WebView::create(&viewClient, true); |
| 8117 view->setMainFrame(remoteClient.frame()); | 8117 view->setMainFrame(remoteClient.frame()); |
| 8118 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); | 8118 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); |
| 8119 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); | 8119 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 8120 | 8120 |
| 8121 FrameTestHelpers::createLocalChild(remoteRoot); | 8121 FrameTestHelpers::createLocalChild(remoteRoot); |
| 8122 | 8122 |
| 8123 // Do a remote-to-local swap of the top frame. | 8123 // Do a remote-to-local swap of the top frame. |
| 8124 FrameTestHelpers::TestWebFrameClient localClient; | 8124 FrameTestHelpers::TestWebFrameClient localClient; |
| 8125 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re
moteRoot, WebSandboxFlags::None); | 8125 WebLocalFrame* localRoot = WebLocalFrame::createProvisional(&localClient, re
moteRoot, WebSandboxFlags::None); |
| 8126 remoteRoot->swap(localRoot); | 8126 remoteRoot->swap(localRoot); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
| 8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
| 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
| 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
| 8689 ASSERT_TRUE(result->IsString()); | 8689 ASSERT_TRUE(result->IsString()); |
| 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
| 8691 } | 8691 } |
| 8692 | 8692 |
| 8693 } // namespace blink | 8693 } // namespace blink |
| OLD | NEW |