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

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

Issue 1213913003: Don't revalidate all resources for FrameLoadTypeSame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 32ecf1a46c2d059dc8b599180a729e3ebee284dd..afb9590b8d0b94040c2161c204529ec4a7062991 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5887,38 +5887,16 @@ TEST_P(ParameterizedWebFrameTest, ReloadIframe)
EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData);
}
-class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
-public:
- TestSameDocumentWebFrameClient()
- : m_frameLoadTypeSameSeen(false)
- {
- }
-
- virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&)
- {
- if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoadTypeSame)
- m_frameLoadTypeSameSeen = true;
- }
-
- bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; }
-
-private:
- bool m_frameLoadTypeSameSeen;
-};
-
TEST_P(ParameterizedWebFrameTest, NavigateToSame)
{
- registerMockedHttpURLLoad("navigate_to_same.html");
- TestSameDocumentWebFrameClient client;
+ URLTestHelpers::registerMockedURLLoad(toKURL(m_baseURL + "navigate_to_same.html#"), WebString::fromUTF8("navigate_to_same.html"));
+ TestCachePolicyWebFrameClient client(nullptr);
FrameTestHelpers::WebViewHelper webViewHelper(this);
- webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, &client);
- EXPECT_FALSE(client.frameLoadTypeSameSeen());
-
- FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document()->url()));
- toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().load(frameRequest);
- FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainFrame());
+ webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html#", true, &client);
+ EXPECT_EQ(1, client.willSendRequestCallCount());
- EXPECT_TRUE(client.frameLoadTypeSameSeen());
+ FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "navigate_to_same.html#");
+ EXPECT_EQ(2, client.willSendRequestCallCount());
}
class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWebFrameClient {

Powered by Google App Engine
This is Rietveld 408576698