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

Side by Side 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 unified diff | Download patch
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 4623 matching lines...) Expand 10 before | Expand all | Expand 10 after
4634 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 4634 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4635 EXPECT_FALSE(frame->previousHistoryItem().isNull()); 4635 EXPECT_FALSE(frame->previousHistoryItem().isNull());
4636 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod()); 4636 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod());
4637 4637
4638 frame->reload(); 4638 frame->reload();
4639 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 4639 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4640 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); 4640 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy());
4641 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype()); 4641 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype());
4642 } 4642 }
4643 4643
4644 TEST_F(WebFrameTest, LoadHistoryItemReload)
4645 {
4646 registerMockedHttpURLLoad("fragment_middle_click.html");
4647 FrameTestHelpers::WebViewHelper webViewHelper;
4648 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue);
4649 WebFrame* frame = webViewHelper.webView()->mainFrame();
4650 WebHistoryItem firstItem = frame->currentHistoryItem();
4651 EXPECT_FALSE(firstItem.isNull());
4652
4653 registerMockedHttpURLLoad("white-1x1.png");
4654 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png");
4655 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4656 EXPECT_FALSE(frame->previousHistoryItem().isNull());
4657 EXPECT_EQ(firstItem.urlString(), frame->previousHistoryItem().urlString());
4658
4659 // Cache policy overrides should take.
4660 frame->loadHistoryItem(frame->previousHistoryItem(), WebURLRequest::ReloadIg noringCacheData);
4661 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4662 EXPECT_EQ(firstItem.urlString(), frame->currentHistoryItem().urlString());
4663 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy());
4664 }
4665
4644 4666
4645 class TestCachePolicyWebFrameClient : public WebFrameClient { 4667 class TestCachePolicyWebFrameClient : public WebFrameClient {
4646 public: 4668 public:
4647 TestCachePolicyWebFrameClient() 4669 TestCachePolicyWebFrameClient()
4648 : m_policy(WebURLRequest::UseProtocolCachePolicy) 4670 : m_policy(WebURLRequest::UseProtocolCachePolicy)
4649 , m_client(0) 4671 , m_client(0)
4650 , m_willSendRequestCallCount(0) 4672 , m_willSendRequestCallCount(0)
4651 , m_childFrameCreationCount(0) 4673 , m_childFrameCreationCount(0)
4652 { 4674 {
4653 } 4675 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 4955
4934 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 4956 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
4935 4957
4936 // After commit, there is. 4958 // After commit, there is.
4937 WebHistoryItem item = frame->currentHistoryItem(); 4959 WebHistoryItem item = frame->currentHistoryItem();
4938 ASSERT_FALSE(item.isNull()); 4960 ASSERT_FALSE(item.isNull());
4939 EXPECT_EQ(url, item.urlString().utf8()); 4961 EXPECT_EQ(url, item.urlString().utf8());
4940 } 4962 }
4941 4963
4942 } // namespace 4964 } // namespace
OLDNEW
« 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