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

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

Issue 123133006: Expose a cachePolicy parameter to loadHistoryItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 09679c9dbbdc787e16d88f82e68e6677620aa2e1..aeab2f83cee82f0d03ef34c68c46d73ff13f065a 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -4641,6 +4641,28 @@ TEST_F(WebFrameTest, ReloadPost)
EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationType());
}
+TEST_F(WebFrameTest, LoadHistoryItemReload)
+{
+ registerMockedHttpURLLoad("fragment_middle_click.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", true);
+ WebFrame* frame = webViewHelper.webView()->mainFrame();
+ WebHistoryItem firstItem = frame->currentHistoryItem();
+ EXPECT_FALSE(firstItem.isNull());
+
+ registerMockedHttpURLLoad("white-1x1.png");
+ FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png");
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
+ EXPECT_FALSE(frame->previousHistoryItem().isNull());
+ EXPECT_EQ(firstItem.urlString(), frame->previousHistoryItem().urlString());
+
+ // Cache policy overrides should take.
+ frame->loadHistoryItem(frame->previousHistoryItem(), WebURLRequest::ReloadIgnoringCacheData);
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
+ EXPECT_EQ(firstItem.urlString(), frame->currentHistoryItem().urlString());
+ EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->request().cachePolicy());
+}
+
class TestCachePolicyWebFrameClient : public WebFrameClient {
public:
« no previous file with comments | « Source/web/WebFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | public/web/WebFrame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698