diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 18:45:33 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 18:45:33 +0000 |
commit | d9ffd55d3a85e3e543bd97f89ff46fd7dc228455 (patch) | |
tree | d70e93b879eef49a5dbbeccb2001ea5564bfebcb /chrome_frame/test | |
parent | dcc7b326b585c5de60590cd808aed91342311d05 (diff) | |
download | chromium_src-d9ffd55d3a85e3e543bd97f89ff46fd7dc228455.zip chromium_src-d9ffd55d3a85e3e543bd97f89ff46fd7dc228455.tar.gz chromium_src-d9ffd55d3a85e3e543bd97f89ff46fd7dc228455.tar.bz2 |
Refreshing pages in ChromeFrame would basically always fetch the pages from the cache. We need
to emulate Chrome and MSHTML where in the cache is resynchronized, i.e. new content is fetched
from the server if it has been modified.
To achieve this we now pass the load flags from Chrome when we initiate a HTTP request and
basically or in the BINDF_RESYNCHRONIZE and BINDF_GETNEWESTVERSION flags based on the value
of the load flags.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=41508
Test=Covered by new ChromeFrame test.
Review URL: http://codereview.chromium.org/4000001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/navigation_test.cc | 41 | ||||
-rw-r--r-- | chrome_frame/test/url_request_test.cc | 12 |
2 files changed, 49 insertions, 4 deletions
diff --git a/chrome_frame/test/navigation_test.cc b/chrome_frame/test/navigation_test.cc index f11f3e6..2cedf3e 100644 --- a/chrome_frame/test/navigation_test.cc +++ b/chrome_frame/test/navigation_test.cc @@ -899,4 +899,45 @@ TEST_F(HttpHeaderTest, ImageSvgXml) { HeaderTestWithData("image/svg+xml", kImageSvg); } +// Tests refreshing causes a page load. +TEST_P(FullTabNavigationTest, RefreshContents) { + bool in_cf = GetParam().invokes_cf(); + if (!in_cf) { + LOG(INFO) << "Disabled for this configuration"; + return; + } + + std::wstring src_url = server_mock_.Resolve(L"/refresh_src.html"); + + EXPECT_CALL(server_mock_, Get(_, StrEq(L"/refresh_src.html"), _)) + .Times(2) + .WillRepeatedly( + SendFast( + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n", + "<html>" + "<head><meta http-equiv=\"x-ua-compatible\" content=\"chrome=1\"" + "/></head>" + "<body>Hi there. Got new content?" + "</body></html>")); + + EXPECT_CALL(ie_mock_, OnFileDownload(_, _)).Times(testing::AnyNumber()); + + EXPECT_CALL(ie_mock_, + OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal, + StrEq(src_url)), + _, _, _, _, _)); + EXPECT_CALL(ie_mock_, + OnNavigateComplete2(_, testing::Field(&VARIANT::bstrVal, + StrEq(src_url)))) + .WillOnce(testing::DoAll( + DelayRefresh(&ie_mock_, &loop_, 2000), + DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))); + + EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(src_url))) + .Times(2); + + LaunchIEAndNavigate(src_url); +} + } // namespace chrome_frame_test diff --git a/chrome_frame/test/url_request_test.cc b/chrome_frame/test/url_request_test.cc index 699ea61..127bec2 100644 --- a/chrome_frame/test/url_request_test.cc +++ b/chrome_frame/test/url_request_test.cc @@ -84,7 +84,8 @@ TEST(UrlmonUrlRequestTest, Simple1) { "", // extra request NULL, // upload data ResourceType::MAIN_FRAME, // resource type - true); // frame busting + true, + 0); // frame busting testing::InSequence s; EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_, @@ -131,7 +132,8 @@ TEST(UrlmonUrlRequestTest, Head) { "", // extra request NULL, // upload data ResourceType::MAIN_FRAME, // resource type - true); // frame busting + true, + 0); // frame busting testing::InSequence s; EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_, @@ -172,7 +174,8 @@ TEST(UrlmonUrlRequestTest, UnreachableUrl) { "", // extra request NULL, // upload data ResourceType::MAIN_FRAME, // resource type - true); // frame busting + true, + 0); // frame busting // Expect headers EXPECT_CALL(mock, OnResponseStarted(1, testing::_, @@ -209,7 +212,8 @@ TEST(UrlmonUrlRequestTest, ZeroLengthResponse) { "", // extra request NULL, // upload data ResourceType::MAIN_FRAME, // resource type - true); // frame busting + true, + 0); // frame busting // Expect headers EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_, |