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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 1119823003: Allow createLocalChild to specify previous sibling frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change appendChild to use insertAfter Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebRemoteFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 6848e91f3170131c08562b4c14be84f78253bbd7..34062be4086a37ca61abd1d83d28b662eb4721ce 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7307,4 +7307,39 @@ TEST_F(WebFrameTest, CrossDomainAccessErrorsUseCallingWindow)
popupWebViewHelper.reset();
}
+TEST_F(WebFrameTest, CreateLocalChildWithPreviousSibling)
+{
+ FrameTestHelpers::TestWebViewClient viewClient;
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebView* view = WebView::create(&viewClient);
+ view->setMainFrame(remoteClient.frame());
+ WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame();
+
+ WebLocalFrame* secondFrame = parent->createLocalChild("", WebSandboxFlags::None, nullptr, nullptr);
+ WebLocalFrame* fourthFrame = parent->createLocalChild("", WebSandboxFlags::None, nullptr, secondFrame);
+ WebLocalFrame* thirdFrame = parent->createLocalChild("", WebSandboxFlags::None, nullptr, secondFrame);
+ WebLocalFrame* firstFrame = parent->createLocalChild("", WebSandboxFlags::None, nullptr, nullptr);
+
+ EXPECT_EQ(firstFrame, parent->firstChild());
+ EXPECT_EQ(nullptr, firstFrame->previousSibling());
+ EXPECT_EQ(secondFrame, firstFrame->nextSibling());
+
+ EXPECT_EQ(firstFrame, secondFrame->previousSibling());
+ EXPECT_EQ(thirdFrame, secondFrame->nextSibling());
+
+ EXPECT_EQ(secondFrame, thirdFrame->previousSibling());
+ EXPECT_EQ(fourthFrame, thirdFrame->nextSibling());
+
+ EXPECT_EQ(thirdFrame, fourthFrame->previousSibling());
+ EXPECT_EQ(nullptr, fourthFrame->nextSibling());
+ EXPECT_EQ(fourthFrame, parent->lastChild());
+
+ EXPECT_EQ(parent, firstFrame->parent());
+ EXPECT_EQ(parent, secondFrame->parent());
+ EXPECT_EQ(parent, thirdFrame->parent());
+ EXPECT_EQ(parent, fourthFrame->parent());
dcheng 2015/05/04 17:30:36 I wonder if some version of nick's frame tree prin
alexmos 2015/05/04 21:38:54 Yeah, that would be very handy. :) Would probably
+
+ view->close();
+}
+
} // namespace blink
« no previous file with comments | « Source/web/WebRemoteFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698