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

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

Issue 2714943004: Move unique name generation and tracking into //content. (Closed)
Patch Set: . Created 3 years, 10 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
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index d276af66905c075db75afc84d80e65087912c83b..15bda074e9754b454b12efa3d9f164a1ba708be1 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -7045,13 +7045,13 @@ class TestCachePolicyWebFrameClient
int willSendRequestCallCount() const { return m_willSendRequestCallCount; }
int childFrameCreationCount() const { return m_childFrameCreationCount; }
- virtual WebLocalFrame* createChildFrame(
+ WebLocalFrame* createChildFrame(
WebLocalFrame* parent,
WebTreeScopeType scope,
const WebString&,
const WebString&,
WebSandboxFlags,
- const WebFrameOwnerProperties& frameOwnerProperties) {
+ const WebFrameOwnerProperties& frameOwnerProperties) override {
DCHECK(m_childClient);
m_childFrameCreationCount++;
WebLocalFrame* frame =
@@ -7457,8 +7457,8 @@ class FailCreateChildFrame : public FrameTestHelpers::TestWebFrameClient {
WebLocalFrame* createChildFrame(
WebLocalFrame* parent,
WebTreeScopeType scope,
- const WebString& frameName,
- const WebString& frameUniqueName,
+ const WebString& name,
+ const WebString& fallbackName,
WebSandboxFlags sandboxFlags,
const WebFrameOwnerProperties& frameOwnerProperties) override {
++m_callCount;
@@ -9045,72 +9045,6 @@ TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterExistingRemoteToLocalSwap) {
remoteFrame->close();
}
-// The uniqueName should be preserved when swapping to a RemoteFrame and back,
-// whether the frame has a name or not.
-TEST_F(WebFrameSwapTest, UniqueNameAfterRemoteToLocalSwap) {
dcheng 2017/03/01 23:57:26 Working on a browser test for this, since we can't
Charlie Reis 2017/03/02 23:59:17 Yes, I think a browser test for this is worthwhile
dcheng 2017/03/03 10:22:07 I'm going to put this in a separate CL (that will
- // Start with a named frame.
- WebFrame* targetFrame = mainFrame()->firstChild();
- ASSERT_TRUE(targetFrame);
- WebString uniqueName = targetFrame->uniqueName();
- EXPECT_EQ("frame1", uniqueName.utf8());
-
- // Swap to a RemoteFrame.
- FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient;
- WebRemoteFrameImpl* remoteFrame = WebRemoteFrameImpl::create(
- WebTreeScopeType::Document, &remoteFrameClient);
- targetFrame->swap(remoteFrame);
- ASSERT_TRUE(mainFrame()->firstChild());
- ASSERT_EQ(mainFrame()->firstChild(), remoteFrame);
- EXPECT_EQ(uniqueName.utf8(),
- WebString(remoteFrame->frame()->tree().uniqueName()).utf8());
-
- // Swap back to a LocalFrame.
- RemoteToLocalSwapWebFrameClient client(remoteFrame);
- WebLocalFrame* localFrame = WebLocalFrame::createProvisional(
- &client, nullptr, nullptr, remoteFrame, WebSandboxFlags::None);
- FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html");
- EXPECT_EQ(uniqueName.utf8(), localFrame->uniqueName().utf8());
- EXPECT_EQ(uniqueName.utf8(), WebString(toWebLocalFrameImpl(localFrame)
- ->frame()
- ->loader()
- .currentItem()
- ->target())
- .utf8());
-
- // Repeat with no name on the frame.
- // (note that uniqueName is immutable after first real commit).
- localFrame->setName("");
- WebString uniqueName2 = localFrame->uniqueName();
- EXPECT_EQ("frame1", uniqueName2.utf8());
-
- FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2;
- WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create(
- WebTreeScopeType::Document, &remoteFrameClient2);
- localFrame->swap(remoteFrame2);
- ASSERT_TRUE(mainFrame()->firstChild());
- ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2);
- EXPECT_EQ(uniqueName2.utf8(),
- WebString(remoteFrame2->frame()->tree().uniqueName()).utf8());
-
- RemoteToLocalSwapWebFrameClient client2(remoteFrame2);
- WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional(
- &client2, nullptr, nullptr, remoteFrame2, WebSandboxFlags::None);
- FrameTestHelpers::loadFrame(localFrame2, m_baseURL + "subframe-hello.html");
- EXPECT_EQ(uniqueName2.utf8(), localFrame2->uniqueName().utf8());
- EXPECT_EQ(uniqueName2.utf8(), WebString(toWebLocalFrameImpl(localFrame2)
- ->frame()
- ->loader()
- .currentItem()
- ->target())
- .utf8());
-
- // Manually reset to break WebViewHelper's dependency on the stack allocated
- // TestWebFrameClient.
- reset();
- remoteFrame->close();
- remoteFrame2->close();
-}
-
class RemoteNavigationClient
: public FrameTestHelpers::TestWebRemoteFrameClient {
public:
@@ -11251,20 +11185,6 @@ TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) {
mockOverlayTheme.setOverlayScrollbarFadeOutDelay(0.0);
}
-TEST_F(WebFrameTest, UniqueNames) {
- registerMockedHttpURLLoad("frameset-repeated-name.html");
- registerMockedHttpURLLoad("frameset-dest.html");
- FrameTestHelpers::WebViewHelper webViewHelper;
- webViewHelper.initializeAndLoad(m_baseURL + "frameset-repeated-name.html");
- Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame();
- HashSet<AtomicString> names;
- for (Frame* frame = mainFrame->tree().firstChild(); frame;
- frame = frame->tree().traverseNext()) {
- EXPECT_TRUE(names.insert(frame->tree().uniqueName()).isNewEntry);
- }
- EXPECT_EQ(10u, names.size());
-}
-
TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) {
class LoadingObserverFrameClient
: public FrameTestHelpers::TestWebFrameClient {
@@ -11323,7 +11243,7 @@ TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) {
WebLocalFrame* createChildFrame(WebLocalFrame* parent,
WebTreeScopeType scope,
const WebString& name,
- const WebString& uniqueName,
+ const WebString& fallbackName,
WebSandboxFlags sandboxFlags,
const WebFrameOwnerProperties&) override {
WebLocalFrame* frame =

Powered by Google App Engine
This is Rietveld 408576698