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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « Source/web/WebRemoteFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7289 matching lines...) Expand 10 before | Expand all | Expand 10 after
7300 EXPECT_TRUE(webFrameClient.messages.empty()); 7300 EXPECT_TRUE(webFrameClient.messages.empty());
7301 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); 7301 ASSERT_EQ(2u, popupWebFrameClient.messages.size());
7302 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8() .find("Blocked a frame")); 7302 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8() .find("Blocked a frame"));
7303 7303
7304 // Manually reset to break WebViewHelpers' dependencies on the stack 7304 // Manually reset to break WebViewHelpers' dependencies on the stack
7305 // allocated WebFrameClients. 7305 // allocated WebFrameClients.
7306 webViewHelper.reset(); 7306 webViewHelper.reset();
7307 popupWebViewHelper.reset(); 7307 popupWebViewHelper.reset();
7308 } 7308 }
7309 7309
7310 TEST_F(WebFrameTest, CreateLocalChildWithPreviousSibling)
7311 {
7312 FrameTestHelpers::TestWebViewClient viewClient;
7313 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7314 WebView* view = WebView::create(&viewClient);
7315 view->setMainFrame(remoteClient.frame());
7316 WebRemoteFrame* parent = view->mainFrame()->toWebRemoteFrame();
7317
7318 WebLocalFrame* secondFrame = parent->createLocalChild("", WebSandboxFlags::N one, nullptr, nullptr);
7319 WebLocalFrame* fourthFrame = parent->createLocalChild("", WebSandboxFlags::N one, nullptr, secondFrame);
7320 WebLocalFrame* thirdFrame = parent->createLocalChild("", WebSandboxFlags::No ne, nullptr, secondFrame);
7321 WebLocalFrame* firstFrame = parent->createLocalChild("", WebSandboxFlags::No ne, nullptr, nullptr);
7322
7323 EXPECT_EQ(firstFrame, parent->firstChild());
7324 EXPECT_EQ(nullptr, firstFrame->previousSibling());
7325 EXPECT_EQ(secondFrame, firstFrame->nextSibling());
7326
7327 EXPECT_EQ(firstFrame, secondFrame->previousSibling());
7328 EXPECT_EQ(thirdFrame, secondFrame->nextSibling());
7329
7330 EXPECT_EQ(secondFrame, thirdFrame->previousSibling());
7331 EXPECT_EQ(fourthFrame, thirdFrame->nextSibling());
7332
7333 EXPECT_EQ(thirdFrame, fourthFrame->previousSibling());
7334 EXPECT_EQ(nullptr, fourthFrame->nextSibling());
7335 EXPECT_EQ(fourthFrame, parent->lastChild());
7336
7337 EXPECT_EQ(parent, firstFrame->parent());
7338 EXPECT_EQ(parent, secondFrame->parent());
7339 EXPECT_EQ(parent, thirdFrame->parent());
7340 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
7341
7342 view->close();
7343 }
7344
7310 } // namespace blink 7345 } // namespace blink
OLDNEW
« 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