| 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 5608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5619 , m_willSendRequestCallCount(0) | 5619 , m_willSendRequestCallCount(0) |
| 5620 , m_childFrameCreationCount(0) | 5620 , m_childFrameCreationCount(0) |
| 5621 { | 5621 { |
| 5622 } | 5622 } |
| 5623 | 5623 |
| 5624 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child
Client = client; } | 5624 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child
Client = client; } |
| 5625 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; } | 5625 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; } |
| 5626 int willSendRequestCallCount() const { return m_willSendRequestCallCount; } | 5626 int willSendRequestCallCount() const { return m_willSendRequestCallCount; } |
| 5627 int childFrameCreationCount() const { return m_childFrameCreationCount; } | 5627 int childFrameCreationCount() const { return m_childFrameCreationCount; } |
| 5628 | 5628 |
| 5629 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s
cope, const WebString&, WebSandboxFlags) | 5629 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString&,
WebSandboxFlags) |
| 5630 { | 5630 { |
| 5631 ASSERT(m_childClient); | 5631 ASSERT(m_childClient); |
| 5632 m_childFrameCreationCount++; | 5632 m_childFrameCreationCount++; |
| 5633 WebFrame* frame = WebLocalFrame::create(scope, m_childClient); | 5633 WebFrame* frame = WebLocalFrame::create(m_childClient); |
| 5634 parent->appendChild(frame); | 5634 parent->appendChild(frame); |
| 5635 return frame; | 5635 return frame; |
| 5636 } | 5636 } |
| 5637 | 5637 |
| 5638 virtual void didStartLoading(bool toDifferentDocument) | 5638 virtual void didStartLoading(bool toDifferentDocument) |
| 5639 { | 5639 { |
| 5640 if (m_parentClient) { | 5640 if (m_parentClient) { |
| 5641 m_parentClient->didStartLoading(toDifferentDocument); | 5641 m_parentClient->didStartLoading(toDifferentDocument); |
| 5642 return; | 5642 return; |
| 5643 } | 5643 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5989 // After commit, there is. | 5989 // After commit, there is. |
| 5990 HistoryItem* item = mainFrameLoader.currentItem(); | 5990 HistoryItem* item = mainFrameLoader.currentItem(); |
| 5991 ASSERT_TRUE(item); | 5991 ASSERT_TRUE(item); |
| 5992 EXPECT_EQ(WTF::String(url.data()), item->urlString()); | 5992 EXPECT_EQ(WTF::String(url.data()), item->urlString()); |
| 5993 } | 5993 } |
| 5994 | 5994 |
| 5995 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { | 5995 class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient { |
| 5996 public: | 5996 public: |
| 5997 FailCreateChildFrame() : m_callCount(0) { } | 5997 FailCreateChildFrame() : m_callCount(0) { } |
| 5998 | 5998 |
| 5999 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s
cope, const WebString& frameName, WebSandboxFlags sandboxFlags) override | 5999 virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& f
rameName, WebSandboxFlags sandboxFlags) override |
| 6000 { | 6000 { |
| 6001 ++m_callCount; | 6001 ++m_callCount; |
| 6002 return 0; | 6002 return 0; |
| 6003 } | 6003 } |
| 6004 | 6004 |
| 6005 int callCount() const { return m_callCount; } | 6005 int callCount() const { return m_callCount; } |
| 6006 | 6006 |
| 6007 private: | 6007 private: |
| 6008 int m_callCount; | 6008 int m_callCount; |
| 6009 }; | 6009 }; |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6681 // doesn't leave behind dangling pointers. | 6681 // doesn't leave behind dangling pointers. |
| 6682 TEST_F(WebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) | 6682 TEST_F(WebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame) |
| 6683 { | 6683 { |
| 6684 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o | 6684 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t
o |
| 6685 // write tests with a top-level remote frame. | 6685 // write tests with a top-level remote frame. |
| 6686 FrameTestHelpers::TestWebViewClient viewClient; | 6686 FrameTestHelpers::TestWebViewClient viewClient; |
| 6687 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 6687 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 6688 WebView* view = WebView::create(&viewClient); | 6688 WebView* view = WebView::create(&viewClient); |
| 6689 view->setMainFrame(remoteClient.frame()); | 6689 view->setMainFrame(remoteClient.frame()); |
| 6690 FrameTestHelpers::TestWebFrameClient childFrameClient; | 6690 FrameTestHelpers::TestWebFrameClient childFrameClient; |
| 6691 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); | 6691 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild("", WebSandboxFlags::None, &childFrameClient, nullptr); |
| 6692 | 6692 |
| 6693 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. | 6693 // Purposely keep the LocalFrame alive so it's the last thing to be destroye
d. |
| 6694 RefPtrWillBePersistent<Frame> childCoreFrame = toCoreFrame(childFrame); | 6694 RefPtrWillBePersistent<Frame> childCoreFrame = toCoreFrame(childFrame); |
| 6695 view->close(); | 6695 view->close(); |
| 6696 childCoreFrame.clear(); | 6696 childCoreFrame.clear(); |
| 6697 } | 6697 } |
| 6698 | 6698 |
| 6699 class WebFrameSwapTest : public WebFrameTest { | 6699 class WebFrameSwapTest : public WebFrameTest { |
| 6700 protected: | 6700 protected: |
| 6701 WebFrameSwapTest() | 6701 WebFrameSwapTest() |
| 6702 { | 6702 { |
| 6703 registerMockedHttpURLLoad("frame-a-b-c.html"); | 6703 registerMockedHttpURLLoad("frame-a-b-c.html"); |
| 6704 registerMockedHttpURLLoad("subframe-a.html"); | 6704 registerMockedHttpURLLoad("subframe-a.html"); |
| 6705 registerMockedHttpURLLoad("subframe-b.html"); | 6705 registerMockedHttpURLLoad("subframe-b.html"); |
| 6706 registerMockedHttpURLLoad("subframe-c.html"); | 6706 registerMockedHttpURLLoad("subframe-c.html"); |
| 6707 registerMockedHttpURLLoad("subframe-hello.html"); | 6707 registerMockedHttpURLLoad("subframe-hello.html"); |
| 6708 | 6708 |
| 6709 m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true); | 6709 m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true); |
| 6710 } | 6710 } |
| 6711 | 6711 |
| 6712 void reset() { m_webViewHelper.reset(); } | 6712 void reset() { m_webViewHelper.reset(); } |
| 6713 WebFrame* mainFrame() const { return m_webViewHelper.webView()->mainFrame();
} | 6713 WebFrame* mainFrame() const { return m_webViewHelper.webView()->mainFrame();
} |
| 6714 | 6714 |
| 6715 private: | 6715 private: |
| 6716 FrameTestHelpers::WebViewHelper m_webViewHelper; | 6716 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 6717 }; | 6717 }; |
| 6718 | 6718 |
| 6719 TEST_F(WebFrameSwapTest, SwapMainFrame) | 6719 TEST_F(WebFrameSwapTest, SwapMainFrame) |
| 6720 { | 6720 { |
| 6721 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 6721 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(nullptr); |
| 6722 mainFrame()->swap(remoteFrame); | 6722 mainFrame()->swap(remoteFrame); |
| 6723 | 6723 |
| 6724 FrameTestHelpers::TestWebFrameClient client; | 6724 FrameTestHelpers::TestWebFrameClient client; |
| 6725 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6725 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6726 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6726 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6727 remoteFrame->swap(localFrame); | 6727 remoteFrame->swap(localFrame); |
| 6728 | 6728 |
| 6729 // Finally, make sure an embedder triggered load in the local frame swapped | 6729 // Finally, make sure an embedder triggered load in the local frame swapped |
| 6730 // back in works. | 6730 // back in works. |
| 6731 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 6731 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 6732 std::string content = localFrame->contentAsText(1024).utf8(); | 6732 std::string content = localFrame->contentAsText(1024).utf8(); |
| 6733 EXPECT_EQ("hello", content); | 6733 EXPECT_EQ("hello", content); |
| 6734 | 6734 |
| 6735 // Manually reset to break WebViewHelper's dependency on the stack allocated | 6735 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 6736 // TestWebFrameClient. | 6736 // TestWebFrameClient. |
| 6737 reset(); | 6737 reset(); |
| 6738 remoteFrame->close(); | 6738 remoteFrame->close(); |
| 6739 } | 6739 } |
| 6740 | 6740 |
| 6741 void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* par
ent, WebFrame* newChild) | 6741 void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* par
ent, WebFrame* newChild) |
| 6742 { | 6742 { |
| 6743 SCOPED_TRACE(message); | 6743 SCOPED_TRACE(message); |
| 6744 parent->firstChild()->swap(newChild); | 6744 parent->firstChild()->swap(newChild); |
| 6745 | 6745 |
| 6746 EXPECT_EQ(newChild, parent->firstChild()); | 6746 EXPECT_EQ(newChild, parent->firstChild()); |
| 6747 EXPECT_EQ(newChild->parent(), parent); | 6747 EXPECT_EQ(newChild->parent(), parent); |
| 6748 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()->previousSibling(
)); | 6748 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()->previousSibling(
)); |
| 6749 EXPECT_EQ(newChild->nextSibling(), parent->lastChild()->previousSibling()); | 6749 EXPECT_EQ(newChild->nextSibling(), parent->lastChild()->previousSibling()); |
| 6750 } | 6750 } |
| 6751 | 6751 |
| 6752 TEST_F(WebFrameSwapTest, SwapFirstChild) | 6752 TEST_F(WebFrameSwapTest, SwapFirstChild) |
| 6753 { | 6753 { |
| 6754 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 6754 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(nullptr); |
| 6755 swapAndVerifyFirstChildConsistency("local->remote", mainFrame(), remoteFrame
); | 6755 swapAndVerifyFirstChildConsistency("local->remote", mainFrame(), remoteFrame
); |
| 6756 | 6756 |
| 6757 FrameTestHelpers::TestWebFrameClient client; | 6757 FrameTestHelpers::TestWebFrameClient client; |
| 6758 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6758 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6759 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6759 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6760 swapAndVerifyFirstChildConsistency("remote->local", mainFrame(), localFrame)
; | 6760 swapAndVerifyFirstChildConsistency("remote->local", mainFrame(), localFrame)
; |
| 6761 | 6761 |
| 6762 // FIXME: This almost certainly fires more load events on the iframe element | 6762 // FIXME: This almost certainly fires more load events on the iframe element |
| 6763 // than it should. | 6763 // than it should. |
| 6764 // Finally, make sure an embedder triggered load in the local frame swapped | 6764 // Finally, make sure an embedder triggered load in the local frame swapped |
| 6765 // back in works. | 6765 // back in works. |
| 6766 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 6766 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 6767 std::string content = localFrame->contentAsText(1024).utf8(); | 6767 std::string content = localFrame->contentAsText(1024).utf8(); |
| 6768 EXPECT_EQ("hello", content); | 6768 EXPECT_EQ("hello", content); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6782 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()); | 6782 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()); |
| 6783 EXPECT_EQ(newChild->parent(), parent); | 6783 EXPECT_EQ(newChild->parent(), parent); |
| 6784 EXPECT_EQ(newChild, parent->firstChild()->nextSibling()); | 6784 EXPECT_EQ(newChild, parent->firstChild()->nextSibling()); |
| 6785 EXPECT_EQ(newChild->previousSibling(), parent->firstChild()); | 6785 EXPECT_EQ(newChild->previousSibling(), parent->firstChild()); |
| 6786 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()); | 6786 EXPECT_EQ(newChild, parent->lastChild()->previousSibling()); |
| 6787 EXPECT_EQ(newChild->nextSibling(), parent->lastChild()); | 6787 EXPECT_EQ(newChild->nextSibling(), parent->lastChild()); |
| 6788 } | 6788 } |
| 6789 | 6789 |
| 6790 TEST_F(WebFrameSwapTest, SwapMiddleChild) | 6790 TEST_F(WebFrameSwapTest, SwapMiddleChild) |
| 6791 { | 6791 { |
| 6792 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 6792 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(nullptr); |
| 6793 swapAndVerifyMiddleChildConsistency("local->remote", mainFrame(), remoteFram
e); | 6793 swapAndVerifyMiddleChildConsistency("local->remote", mainFrame(), remoteFram
e); |
| 6794 | 6794 |
| 6795 FrameTestHelpers::TestWebFrameClient client; | 6795 FrameTestHelpers::TestWebFrameClient client; |
| 6796 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6796 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6797 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6797 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6798 swapAndVerifyMiddleChildConsistency("remote->local", mainFrame(), localFrame
); | 6798 swapAndVerifyMiddleChildConsistency("remote->local", mainFrame(), localFrame
); |
| 6799 | 6799 |
| 6800 // FIXME: This almost certainly fires more load events on the iframe element | 6800 // FIXME: This almost certainly fires more load events on the iframe element |
| 6801 // than it should. | 6801 // than it should. |
| 6802 // Finally, make sure an embedder triggered load in the local frame swapped | 6802 // Finally, make sure an embedder triggered load in the local frame swapped |
| 6803 // back in works. | 6803 // back in works. |
| 6804 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 6804 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 6805 std::string content = localFrame->contentAsText(1024).utf8(); | 6805 std::string content = localFrame->contentAsText(1024).utf8(); |
| 6806 EXPECT_EQ("hello", content); | 6806 EXPECT_EQ("hello", content); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6817 parent->lastChild()->swap(newChild); | 6817 parent->lastChild()->swap(newChild); |
| 6818 | 6818 |
| 6819 EXPECT_EQ(newChild, parent->lastChild()); | 6819 EXPECT_EQ(newChild, parent->lastChild()); |
| 6820 EXPECT_EQ(newChild->parent(), parent); | 6820 EXPECT_EQ(newChild->parent(), parent); |
| 6821 EXPECT_EQ(newChild, parent->firstChild()->nextSibling()->nextSibling()); | 6821 EXPECT_EQ(newChild, parent->firstChild()->nextSibling()->nextSibling()); |
| 6822 EXPECT_EQ(newChild->previousSibling(), parent->firstChild()->nextSibling()); | 6822 EXPECT_EQ(newChild->previousSibling(), parent->firstChild()->nextSibling()); |
| 6823 } | 6823 } |
| 6824 | 6824 |
| 6825 TEST_F(WebFrameSwapTest, SwapLastChild) | 6825 TEST_F(WebFrameSwapTest, SwapLastChild) |
| 6826 { | 6826 { |
| 6827 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 6827 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(nullptr); |
| 6828 swapAndVerifyLastChildConsistency("local->remote", mainFrame(), remoteFrame)
; | 6828 swapAndVerifyLastChildConsistency("local->remote", mainFrame(), remoteFrame)
; |
| 6829 | 6829 |
| 6830 FrameTestHelpers::TestWebFrameClient client; | 6830 FrameTestHelpers::TestWebFrameClient client; |
| 6831 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6831 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6832 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6832 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6833 swapAndVerifyLastChildConsistency("remote->local", mainFrame(), localFrame); | 6833 swapAndVerifyLastChildConsistency("remote->local", mainFrame(), localFrame); |
| 6834 | 6834 |
| 6835 // FIXME: This almost certainly fires more load events on the iframe element | 6835 // FIXME: This almost certainly fires more load events on the iframe element |
| 6836 // than it should. | 6836 // than it should. |
| 6837 // Finally, make sure an embedder triggered load in the local frame swapped | 6837 // Finally, make sure an embedder triggered load in the local frame swapped |
| 6838 // back in works. | 6838 // back in works. |
| 6839 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 6839 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 6840 std::string content = localFrame->contentAsText(1024).utf8(); | 6840 std::string content = localFrame->contentAsText(1024).utf8(); |
| 6841 EXPECT_EQ("hello", content); | 6841 EXPECT_EQ("hello", content); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6852 | 6852 |
| 6853 EXPECT_TRUE(oldFrame->firstChild()); | 6853 EXPECT_TRUE(oldFrame->firstChild()); |
| 6854 oldFrame->swap(newFrame); | 6854 oldFrame->swap(newFrame); |
| 6855 | 6855 |
| 6856 EXPECT_FALSE(newFrame->firstChild()); | 6856 EXPECT_FALSE(newFrame->firstChild()); |
| 6857 EXPECT_FALSE(newFrame->lastChild()); | 6857 EXPECT_FALSE(newFrame->lastChild()); |
| 6858 } | 6858 } |
| 6859 | 6859 |
| 6860 TEST_F(WebFrameSwapTest, SwapParentShouldDetachChildren) | 6860 TEST_F(WebFrameSwapTest, SwapParentShouldDetachChildren) |
| 6861 { | 6861 { |
| 6862 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 6862 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(0); |
| 6863 WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); | 6863 WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); |
| 6864 EXPECT_TRUE(targetFrame); | 6864 EXPECT_TRUE(targetFrame); |
| 6865 swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); | 6865 swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); |
| 6866 | 6866 |
| 6867 targetFrame = mainFrame()->firstChild()->nextSibling(); | 6867 targetFrame = mainFrame()->firstChild()->nextSibling(); |
| 6868 EXPECT_TRUE(targetFrame); | 6868 EXPECT_TRUE(targetFrame); |
| 6869 | 6869 |
| 6870 // Create child frames in the target frame before testing the swap. | 6870 // Create child frames in the target frame before testing the swap. |
| 6871 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; | 6871 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; |
| 6872 remoteFrame->createRemoteChild(WebTreeScopeType::Document, "", WebSandboxFla
gs::None, &remoteFrameClient); | 6872 remoteFrame->createRemoteChild("", WebSandboxFlags::None, &remoteFrameClient
); |
| 6873 | 6873 |
| 6874 FrameTestHelpers::TestWebFrameClient client; | 6874 FrameTestHelpers::TestWebFrameClient client; |
| 6875 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6875 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6876 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6876 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6877 swapAndVerifySubframeConsistency("remote->local", targetFrame, localFrame); | 6877 swapAndVerifySubframeConsistency("remote->local", targetFrame, localFrame); |
| 6878 | 6878 |
| 6879 // FIXME: This almost certainly fires more load events on the iframe element | 6879 // FIXME: This almost certainly fires more load events on the iframe element |
| 6880 // than it should. | 6880 // than it should. |
| 6881 // Finally, make sure an embedder triggered load in the local frame swapped | 6881 // Finally, make sure an embedder triggered load in the local frame swapped |
| 6882 // back in works. | 6882 // back in works. |
| 6883 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 6883 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 6884 std::string content = localFrame->contentAsText(1024).utf8(); | 6884 std::string content = localFrame->contentAsText(1024).utf8(); |
| 6885 EXPECT_EQ("hello", content); | 6885 EXPECT_EQ("hello", content); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6921 v8::Local<v8::Value> remoteWindow = mainFrame()->executeScriptAndReturnValue
(WebScriptSource( | 6921 v8::Local<v8::Value> remoteWindow = mainFrame()->executeScriptAndReturnValue
(WebScriptSource( |
| 6922 "document.querySelector('#frame2').contentWindow;")); | 6922 "document.querySelector('#frame2').contentWindow;")); |
| 6923 EXPECT_TRUE(originalWindow->StrictEquals(remoteWindow)); | 6923 EXPECT_TRUE(originalWindow->StrictEquals(remoteWindow)); |
| 6924 // Check that its view is consistent with the world. | 6924 // Check that its view is consistent with the world. |
| 6925 v8::Local<v8::Value> remoteWindowTop = mainFrame()->executeScriptAndReturnVa
lue(WebScriptSource( | 6925 v8::Local<v8::Value> remoteWindowTop = mainFrame()->executeScriptAndReturnVa
lue(WebScriptSource( |
| 6926 "document.querySelector('#frame2').contentWindow.top;")); | 6926 "document.querySelector('#frame2').contentWindow.top;")); |
| 6927 EXPECT_TRUE(windowTop->StrictEquals(remoteWindowTop)); | 6927 EXPECT_TRUE(windowTop->StrictEquals(remoteWindowTop)); |
| 6928 | 6928 |
| 6929 // Now check that remote -> local works too, since it goes through a differe
nt code path. | 6929 // Now check that remote -> local works too, since it goes through a differe
nt code path. |
| 6930 FrameTestHelpers::TestWebFrameClient client; | 6930 FrameTestHelpers::TestWebFrameClient client; |
| 6931 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6931 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6932 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6932 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6933 remoteFrame->swap(localFrame); | 6933 remoteFrame->swap(localFrame); |
| 6934 v8::Local<v8::Value> localWindow = mainFrame()->executeScriptAndReturnValue(
WebScriptSource( | 6934 v8::Local<v8::Value> localWindow = mainFrame()->executeScriptAndReturnValue(
WebScriptSource( |
| 6935 "document.querySelector('#frame2').contentWindow;")); | 6935 "document.querySelector('#frame2').contentWindow;")); |
| 6936 EXPECT_TRUE(originalWindow->StrictEquals(localWindow)); | 6936 EXPECT_TRUE(originalWindow->StrictEquals(localWindow)); |
| 6937 v8::Local<v8::Value> localWindowTop = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource( | 6937 v8::Local<v8::Value> localWindowTop = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource( |
| 6938 "document.querySelector('#frame2').contentWindow.top;")); | 6938 "document.querySelector('#frame2').contentWindow.top;")); |
| 6939 EXPECT_TRUE(windowTop->StrictEquals(localWindowTop)); | 6939 EXPECT_TRUE(windowTop->StrictEquals(localWindowTop)); |
| 6940 | 6940 |
| 6941 // Manually reset to break WebViewHelper's dependency on the stack allocated | 6941 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6956 | 6956 |
| 6957 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 6957 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 6958 WebRemoteFrame* remoteFrame = remoteClient.frame(); | 6958 WebRemoteFrame* remoteFrame = remoteClient.frame(); |
| 6959 mainFrame()->lastChild()->swap(remoteFrame); | 6959 mainFrame()->lastChild()->swap(remoteFrame); |
| 6960 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | 6960 remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 6961 v8::Local<v8::Value> remoteWindowTop = mainFrame()->executeScriptAndReturnVa
lue(WebScriptSource("saved.top")); | 6961 v8::Local<v8::Value> remoteWindowTop = mainFrame()->executeScriptAndReturnVa
lue(WebScriptSource("saved.top")); |
| 6962 EXPECT_TRUE(remoteWindowTop->IsObject()); | 6962 EXPECT_TRUE(remoteWindowTop->IsObject()); |
| 6963 EXPECT_TRUE(windowTop->StrictEquals(remoteWindowTop)); | 6963 EXPECT_TRUE(windowTop->StrictEquals(remoteWindowTop)); |
| 6964 | 6964 |
| 6965 FrameTestHelpers::TestWebFrameClient client; | 6965 FrameTestHelpers::TestWebFrameClient client; |
| 6966 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 6966 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 6967 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 6967 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 6968 remoteFrame->swap(localFrame); | 6968 remoteFrame->swap(localFrame); |
| 6969 v8::Local<v8::Value> localWindowTop = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource("saved.top")); | 6969 v8::Local<v8::Value> localWindowTop = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource("saved.top")); |
| 6970 EXPECT_TRUE(localWindowTop->IsObject()); | 6970 EXPECT_TRUE(localWindowTop->IsObject()); |
| 6971 EXPECT_TRUE(windowTop->StrictEquals(localWindowTop)); | 6971 EXPECT_TRUE(windowTop->StrictEquals(localWindowTop)); |
| 6972 | 6972 |
| 6973 reset(); | 6973 reset(); |
| 6974 } | 6974 } |
| 6975 | 6975 |
| 6976 TEST_F(WebFrameSwapTest, RemoteFramesAreIndexable) | 6976 TEST_F(WebFrameSwapTest, RemoteFramesAreIndexable) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7028 TEST_F(WebFrameSwapTest, FramesOfRemoteParentAreIndexable) | 7028 TEST_F(WebFrameSwapTest, FramesOfRemoteParentAreIndexable) |
| 7029 { | 7029 { |
| 7030 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 7030 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 7031 | 7031 |
| 7032 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7032 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7033 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); | 7033 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); |
| 7034 mainFrame()->swap(remoteParentFrame); | 7034 mainFrame()->swap(remoteParentFrame); |
| 7035 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | 7035 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 7036 | 7036 |
| 7037 FrameTestHelpers::TestWebFrameClient childFrameClient; | 7037 FrameTestHelpers::TestWebFrameClient childFrameClient; |
| 7038 WebLocalFrame* childFrame = remoteParentFrame->createLocalChild(WebTreeScope
Type::Document, "", WebSandboxFlags::None, &childFrameClient, nullptr); | 7038 WebLocalFrame* childFrame = remoteParentFrame->createLocalChild("", WebSandb
oxFlags::None, &childFrameClient, nullptr); |
| 7039 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "subframe-hello.html"); | 7039 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "subframe-hello.html"); |
| 7040 | 7040 |
| 7041 v8::Local<v8::Value> window = childFrame->executeScriptAndReturnValue(WebScr
iptSource("window")); | 7041 v8::Local<v8::Value> window = childFrame->executeScriptAndReturnValue(WebScr
iptSource("window")); |
| 7042 v8::Local<v8::Value> childOfRemoteParent = childFrame->executeScriptAndRetur
nValue(WebScriptSource("parent.frames[0]")); | 7042 v8::Local<v8::Value> childOfRemoteParent = childFrame->executeScriptAndRetur
nValue(WebScriptSource("parent.frames[0]")); |
| 7043 EXPECT_TRUE(childOfRemoteParent->IsObject()); | 7043 EXPECT_TRUE(childOfRemoteParent->IsObject()); |
| 7044 EXPECT_TRUE(window->StrictEquals(childOfRemoteParent)); | 7044 EXPECT_TRUE(window->StrictEquals(childOfRemoteParent)); |
| 7045 | 7045 |
| 7046 v8::Local<v8::Value> windowLength = childFrame->executeScriptAndReturnValue(
WebScriptSource("parent.frames.length")); | 7046 v8::Local<v8::Value> windowLength = childFrame->executeScriptAndReturnValue(
WebScriptSource("parent.frames.length")); |
| 7047 ASSERT_TRUE(windowLength->IsInt32()); | 7047 ASSERT_TRUE(windowLength->IsInt32()); |
| 7048 EXPECT_EQ(1, windowLength.As<v8::Int32>()->Value()); | 7048 EXPECT_EQ(1, windowLength.As<v8::Int32>()->Value()); |
| 7049 | 7049 |
| 7050 // Manually reset to break WebViewHelper's dependency on the stack allocated
clients. | 7050 // Manually reset to break WebViewHelper's dependency on the stack allocated
clients. |
| 7051 reset(); | 7051 reset(); |
| 7052 } | 7052 } |
| 7053 | 7053 |
| 7054 // Check that frames with a remote parent don't crash while accessing window.fra
meElement. | 7054 // Check that frames with a remote parent don't crash while accessing window.fra
meElement. |
| 7055 TEST_F(WebFrameSwapTest, FrameElementInFramesWithRemoteParent) | 7055 TEST_F(WebFrameSwapTest, FrameElementInFramesWithRemoteParent) |
| 7056 { | 7056 { |
| 7057 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 7057 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 7058 | 7058 |
| 7059 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7059 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7060 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); | 7060 WebRemoteFrame* remoteParentFrame = remoteClient.frame(); |
| 7061 mainFrame()->swap(remoteParentFrame); | 7061 mainFrame()->swap(remoteParentFrame); |
| 7062 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); | 7062 remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique()); |
| 7063 | 7063 |
| 7064 FrameTestHelpers::TestWebFrameClient childFrameClient; | 7064 FrameTestHelpers::TestWebFrameClient childFrameClient; |
| 7065 WebLocalFrame* childFrame = remoteParentFrame->createLocalChild(WebTreeScope
Type::Document, "", WebSandboxFlags::None, &childFrameClient, nullptr); | 7065 WebLocalFrame* childFrame = remoteParentFrame->createLocalChild("", WebSandb
oxFlags::None, &childFrameClient, nullptr); |
| 7066 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "subframe-hello.html"); | 7066 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "subframe-hello.html"); |
| 7067 | 7067 |
| 7068 v8::Local<v8::Value> frameElement = childFrame->executeScriptAndReturnValue(
WebScriptSource("window.frameElement")); | 7068 v8::Local<v8::Value> frameElement = childFrame->executeScriptAndReturnValue(
WebScriptSource("window.frameElement")); |
| 7069 // frameElement shouldn't be accessible cross-origin. | 7069 // frameElement shouldn't be accessible cross-origin. |
| 7070 EXPECT_TRUE(frameElement.IsEmpty()); | 7070 EXPECT_TRUE(frameElement.IsEmpty()); |
| 7071 | 7071 |
| 7072 // Manually reset to break WebViewHelper's dependency on the stack allocated
clients. | 7072 // Manually reset to break WebViewHelper's dependency on the stack allocated
clients. |
| 7073 reset(); | 7073 reset(); |
| 7074 } | 7074 } |
| 7075 | 7075 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7088 } | 7088 } |
| 7089 | 7089 |
| 7090 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} | 7090 WebHistoryCommitType historyCommitType() const { return m_historyCommitType;
} |
| 7091 | 7091 |
| 7092 WebHistoryCommitType m_historyCommitType; | 7092 WebHistoryCommitType m_historyCommitType; |
| 7093 WebRemoteFrame* m_remoteFrame; | 7093 WebRemoteFrame* m_remoteFrame; |
| 7094 }; | 7094 }; |
| 7095 | 7095 |
| 7096 TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterRemoteToLocalSwap) | 7096 TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterRemoteToLocalSwap) |
| 7097 { | 7097 { |
| 7098 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 7098 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(nullptr); |
| 7099 WebFrame* targetFrame = mainFrame()->firstChild(); | 7099 WebFrame* targetFrame = mainFrame()->firstChild(); |
| 7100 ASSERT_TRUE(targetFrame); | 7100 ASSERT_TRUE(targetFrame); |
| 7101 targetFrame->swap(remoteFrame); | 7101 targetFrame->swap(remoteFrame); |
| 7102 ASSERT_TRUE(mainFrame()->firstChild()); | 7102 ASSERT_TRUE(mainFrame()->firstChild()); |
| 7103 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame); | 7103 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame); |
| 7104 | 7104 |
| 7105 RemoteToLocalSwapWebFrameClient client(remoteFrame); | 7105 RemoteToLocalSwapWebFrameClient client(remoteFrame); |
| 7106 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 7106 WebLocalFrame* localFrame = WebLocalFrame::create(&client); |
| 7107 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 7107 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
| 7108 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 7108 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
| 7109 EXPECT_EQ(WebStandardCommit, client.historyCommitType()); | 7109 EXPECT_EQ(WebStandardCommit, client.historyCommitType()); |
| 7110 | 7110 |
| 7111 // Manually reset to break WebViewHelper's dependency on the stack allocated | 7111 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 7112 // TestWebFrameClient. | 7112 // TestWebFrameClient. |
| 7113 reset(); | 7113 reset(); |
| 7114 remoteFrame->close(); | 7114 remoteFrame->close(); |
| 7115 } | 7115 } |
| 7116 | 7116 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7187 TEST_F(WebFrameTest, RemoteFrameInitialCommitType) | 7187 TEST_F(WebFrameTest, RemoteFrameInitialCommitType) |
| 7188 { | 7188 { |
| 7189 FrameTestHelpers::TestWebViewClient viewClient; | 7189 FrameTestHelpers::TestWebViewClient viewClient; |
| 7190 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7190 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7191 WebView* view = WebView::create(&viewClient); | 7191 WebView* view = WebView::create(&viewClient); |
| 7192 view->setMainFrame(remoteClient.frame()); | 7192 view->setMainFrame(remoteClient.frame()); |
| 7193 toRemoteFrame(toCoreFrame(view->mainFrame()))->securityContext()->setReplica
tedOrigin(SecurityOrigin::create(toKURL(m_baseURL))); | 7193 toRemoteFrame(toCoreFrame(view->mainFrame()))->securityContext()->setReplica
tedOrigin(SecurityOrigin::create(toKURL(m_baseURL))); |
| 7194 | 7194 |
| 7195 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7195 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. |
| 7196 CommitTypeWebFrameClient childFrameClient; | 7196 CommitTypeWebFrameClient childFrameClient; |
| 7197 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); | 7197 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild("", WebSandboxFlags::None, &childFrameClient, nullptr); |
| 7198 registerMockedHttpURLLoad("foo.html"); | 7198 registerMockedHttpURLLoad("foo.html"); |
| 7199 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7199 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7200 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7200 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7201 view->close(); | 7201 view->close(); |
| 7202 } | 7202 } |
| 7203 | 7203 |
| 7204 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ | 7204 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ |
| 7205 public: | 7205 public: |
| 7206 MockDocumentThreadableLoaderClient() : m_failed(false) { } | 7206 MockDocumentThreadableLoaderClient() : m_failed(false) { } |
| 7207 virtual void didFail(const ResourceError&) override { m_failed = true;} | 7207 virtual void didFail(const ResourceError&) override { m_failed = true;} |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7246 EXPECT_FALSE(client.failed()); | 7246 EXPECT_FALSE(client.failed()); |
| 7247 } | 7247 } |
| 7248 | 7248 |
| 7249 TEST_F(WebFrameTest, DetachRemoteFrame) | 7249 TEST_F(WebFrameTest, DetachRemoteFrame) |
| 7250 { | 7250 { |
| 7251 FrameTestHelpers::TestWebViewClient viewClient; | 7251 FrameTestHelpers::TestWebViewClient viewClient; |
| 7252 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7252 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7253 WebView* view = WebView::create(&viewClient); | 7253 WebView* view = WebView::create(&viewClient); |
| 7254 view->setMainFrame(remoteClient.frame()); | 7254 view->setMainFrame(remoteClient.frame()); |
| 7255 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; | 7255 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; |
| 7256 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe
moteChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClie
nt); | 7256 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe
moteChild("", WebSandboxFlags::None, &childFrameClient); |
| 7257 childFrame->detach(); | 7257 childFrame->detach(); |
| 7258 view->close(); | 7258 view->close(); |
| 7259 } | 7259 } |
| 7260 | 7260 |
| 7261 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { | 7261 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl
ient { |
| 7262 public: | 7262 public: |
| 7263 virtual void didAddMessageToConsole(const WebConsoleMessage& message, const
WebString& sourceName, unsigned sourceLine, const WebString& stackTrace) | 7263 virtual void didAddMessageToConsole(const WebConsoleMessage& message, const
WebString& sourceName, unsigned sourceLine, const WebString& stackTrace) |
| 7264 { | 7264 { |
| 7265 messages.push_back(message); | 7265 messages.push_back(message); |
| 7266 } | 7266 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7307 } | 7307 } |
| 7308 | 7308 |
| 7309 TEST_F(WebFrameTest, CreateLocalChildWithPreviousSibling) | 7309 TEST_F(WebFrameTest, CreateLocalChildWithPreviousSibling) |
| 7310 { | 7310 { |
| 7311 FrameTestHelpers::TestWebViewClient viewClient; | 7311 FrameTestHelpers::TestWebViewClient viewClient; |
| 7312 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7312 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7313 WebView* view = WebView::create(&viewClient); | 7313 WebView* view = WebView::create(&viewClient); |
| 7314 view->setMainFrame(remoteClient.frame()); | 7314 view->setMainFrame(remoteClient.frame()); |
| 7315 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); | 7315 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame(); |
| 7316 | 7316 |
| 7317 WebLocalFrame* secondFrame = parent->createLocalChild(WebTreeScopeType::Docu
ment, "", WebSandboxFlags::None, nullptr, nullptr); | 7317 WebLocalFrame* secondFrame = parent->createLocalChild("", WebSandboxFlags::N
one, nullptr, nullptr); |
| 7318 WebLocalFrame* fourthFrame = parent->createLocalChild(WebTreeScopeType::Docu
ment, "", WebSandboxFlags::None, nullptr, secondFrame); | 7318 WebLocalFrame* fourthFrame = parent->createLocalChild("", WebSandboxFlags::N
one, nullptr, secondFrame); |
| 7319 WebLocalFrame* thirdFrame = parent->createLocalChild(WebTreeScopeType::Docum
ent, "", WebSandboxFlags::None, nullptr, secondFrame); | 7319 WebLocalFrame* thirdFrame = parent->createLocalChild("", WebSandboxFlags::No
ne, nullptr, secondFrame); |
| 7320 WebLocalFrame* firstFrame = parent->createLocalChild(WebTreeScopeType::Docum
ent, "", WebSandboxFlags::None, nullptr, nullptr); | 7320 WebLocalFrame* firstFrame = parent->createLocalChild("", WebSandboxFlags::No
ne, nullptr, nullptr); |
| 7321 | 7321 |
| 7322 EXPECT_EQ(firstFrame, parent->firstChild()); | 7322 EXPECT_EQ(firstFrame, parent->firstChild()); |
| 7323 EXPECT_EQ(nullptr, firstFrame->previousSibling()); | 7323 EXPECT_EQ(nullptr, firstFrame->previousSibling()); |
| 7324 EXPECT_EQ(secondFrame, firstFrame->nextSibling()); | 7324 EXPECT_EQ(secondFrame, firstFrame->nextSibling()); |
| 7325 | 7325 |
| 7326 EXPECT_EQ(firstFrame, secondFrame->previousSibling()); | 7326 EXPECT_EQ(firstFrame, secondFrame->previousSibling()); |
| 7327 EXPECT_EQ(thirdFrame, secondFrame->nextSibling()); | 7327 EXPECT_EQ(thirdFrame, secondFrame->nextSibling()); |
| 7328 | 7328 |
| 7329 EXPECT_EQ(secondFrame, thirdFrame->previousSibling()); | 7329 EXPECT_EQ(secondFrame, thirdFrame->previousSibling()); |
| 7330 EXPECT_EQ(fourthFrame, thirdFrame->nextSibling()); | 7330 EXPECT_EQ(fourthFrame, thirdFrame->nextSibling()); |
| 7331 | 7331 |
| 7332 EXPECT_EQ(thirdFrame, fourthFrame->previousSibling()); | 7332 EXPECT_EQ(thirdFrame, fourthFrame->previousSibling()); |
| 7333 EXPECT_EQ(nullptr, fourthFrame->nextSibling()); | 7333 EXPECT_EQ(nullptr, fourthFrame->nextSibling()); |
| 7334 EXPECT_EQ(fourthFrame, parent->lastChild()); | 7334 EXPECT_EQ(fourthFrame, parent->lastChild()); |
| 7335 | 7335 |
| 7336 EXPECT_EQ(parent, firstFrame->parent()); | 7336 EXPECT_EQ(parent, firstFrame->parent()); |
| 7337 EXPECT_EQ(parent, secondFrame->parent()); | 7337 EXPECT_EQ(parent, secondFrame->parent()); |
| 7338 EXPECT_EQ(parent, thirdFrame->parent()); | 7338 EXPECT_EQ(parent, thirdFrame->parent()); |
| 7339 EXPECT_EQ(parent, fourthFrame->parent()); | 7339 EXPECT_EQ(parent, fourthFrame->parent()); |
| 7340 | 7340 |
| 7341 view->close(); | 7341 view->close(); |
| 7342 } | 7342 } |
| 7343 | 7343 |
| 7344 } // namespace blink | 7344 } // namespace blink |
| OLD | NEW |