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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2317203002: Avoid mutating frame unique name after first real commit. (Closed)
Patch Set: Tweaking the comment describing the format of unique name. Created 4 years, 3 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 | « third_party/WebKit/Source/core/page/FrameTree.cpp ('k') | no next file » | 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 7581 matching lines...) Expand 10 before | Expand all | Expand 10 after
7592 EXPECT_EQ(uniqueName.utf8(), WebString(remoteFrame->frame()->tree().uniqueNa me()).utf8()); 7592 EXPECT_EQ(uniqueName.utf8(), WebString(remoteFrame->frame()->tree().uniqueNa me()).utf8());
7593 7593
7594 // Swap back to a LocalFrame. 7594 // Swap back to a LocalFrame.
7595 RemoteToLocalSwapWebFrameClient client(remoteFrame); 7595 RemoteToLocalSwapWebFrameClient client(remoteFrame);
7596 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&client, remote Frame, WebSandboxFlags::None); 7596 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(&client, remote Frame, WebSandboxFlags::None);
7597 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); 7597 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html");
7598 EXPECT_EQ(uniqueName.utf8(), localFrame->uniqueName().utf8()); 7598 EXPECT_EQ(uniqueName.utf8(), localFrame->uniqueName().utf8());
7599 EXPECT_EQ(uniqueName.utf8(), WebString(toWebLocalFrameImpl(localFrame)->fram e()->loader().currentItem()->target()).utf8()); 7599 EXPECT_EQ(uniqueName.utf8(), WebString(toWebLocalFrameImpl(localFrame)->fram e()->loader().currentItem()->target()).utf8());
7600 7600
7601 // Repeat with no name on the frame. 7601 // Repeat with no name on the frame.
7602 // (note that uniqueName is immutable after first real commit).
7602 localFrame->setName(""); 7603 localFrame->setName("");
7603 WebString uniqueName2 = localFrame->uniqueName(); 7604 WebString uniqueName2 = localFrame->uniqueName();
7604 EXPECT_EQ("<!--framePath //<!--frame2-->-->", uniqueName2.utf8()); 7605 EXPECT_EQ("frame1", uniqueName2.utf8());
7605 7606
7606 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2; 7607 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2;
7607 WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create(WebTreeScopeTy pe::Document, &remoteFrameClient2); 7608 WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create(WebTreeScopeTy pe::Document, &remoteFrameClient2);
7608 localFrame->swap(remoteFrame2); 7609 localFrame->swap(remoteFrame2);
7609 ASSERT_TRUE(mainFrame()->firstChild()); 7610 ASSERT_TRUE(mainFrame()->firstChild());
7610 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2); 7611 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2);
7611 EXPECT_EQ(uniqueName2.utf8(), WebString(remoteFrame2->frame()->tree().unique Name()).utf8()); 7612 EXPECT_EQ(uniqueName2.utf8(), WebString(remoteFrame2->frame()->tree().unique Name()).utf8());
7612 7613
7613 RemoteToLocalSwapWebFrameClient client2(remoteFrame2); 7614 RemoteToLocalSwapWebFrameClient client2(remoteFrame2);
7614 WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional(&client2, remo teFrame2, WebSandboxFlags::None); 7615 WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional(&client2, remo teFrame2, WebSandboxFlags::None);
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
8934 FrameTestHelpers::WebViewHelper helper; 8935 FrameTestHelpers::WebViewHelper helper;
8935 helper.initializeAndLoad(url, true); 8936 helper.initializeAndLoad(url, true);
8936 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); 8937 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr);
8937 8938
8938 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do cument(); 8939 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do cument();
8939 EXPECT_TRUE(document->isImageDocument()); 8940 EXPECT_TRUE(document->isImageDocument());
8940 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g etStatus()); 8941 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g etStatus());
8941 } 8942 }
8942 8943
8943 } // namespace blink 8944 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/FrameTree.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698