OLD | NEW |
---|---|
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 4809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4820 EXPECT_TRUE(firstItem); | 4820 EXPECT_TRUE(firstItem); |
4821 | 4821 |
4822 registerMockedHttpURLLoad("white-1x1.png"); | 4822 registerMockedHttpURLLoad("white-1x1.png"); |
4823 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 4823 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
4824 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 4824 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
4825 | 4825 |
4826 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); | 4826 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); |
4827 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 4827 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
4828 | 4828 |
4829 FrameTestHelpers::reloadFrame(frame); | 4829 FrameTestHelpers::reloadFrame(frame); |
4830 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); | 4830 EXPECT_TRUE(frame->dataSource()->request().cachePolicy() == WebURLRequest::R eloadIgnoringCacheData |
ppi
2014/06/01 23:57:04
I think we'd prefer to be precise about the expect
clamy
2014/06/02 05:54:47
I think I'll handle that in patch 4, where we'll k
| |
4831 || frame->dataSource()->request().cachePolicy() == WebURLRequest::Reload BypassingCache); | |
4831 } | 4832 } |
4832 | 4833 |
4833 TEST_F(WebFrameTest, BackDuringChildFrameReload) | 4834 TEST_F(WebFrameTest, BackDuringChildFrameReload) |
4834 { | 4835 { |
4835 registerMockedHttpURLLoad("page_with_blank_iframe.html"); | 4836 registerMockedHttpURLLoad("page_with_blank_iframe.html"); |
4836 FrameTestHelpers::WebViewHelper webViewHelper; | 4837 FrameTestHelpers::WebViewHelper webViewHelper; |
4837 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t rue); | 4838 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t rue); |
4838 WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); | 4839 WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); |
4839 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader(); | 4840 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader(); |
4840 WebFrame* childFrame = mainFrame->firstChild(); | 4841 WebFrame* childFrame = mainFrame->firstChild(); |
(...skipping 22 matching lines...) Expand all Loading... | |
4863 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); | 4864 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); |
4864 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 4865 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
4865 | 4866 |
4866 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip t:document.forms[0].submit()"); | 4867 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip t:document.forms[0].submit()"); |
4867 // Pump requests one more time after the javascript URL has executed to | 4868 // Pump requests one more time after the javascript URL has executed to |
4868 // trigger the actual POST load request. | 4869 // trigger the actual POST load request. |
4869 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame()); | 4870 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame()); |
4870 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod()); | 4871 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod()); |
4871 | 4872 |
4872 FrameTestHelpers::reloadFrame(frame); | 4873 FrameTestHelpers::reloadFrame(frame); |
4873 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); | 4874 EXPECT_TRUE(frame->dataSource()->request().cachePolicy() == WebURLRequest::R eloadIgnoringCacheData |
4875 || frame->dataSource()->request().cachePolicy() == WebURLRequest::Reload BypassingCache); | |
4874 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype()); | 4876 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype()); |
4875 } | 4877 } |
4876 | 4878 |
4877 TEST_F(WebFrameTest, LoadHistoryItemReload) | 4879 TEST_F(WebFrameTest, LoadHistoryItemReload) |
4878 { | 4880 { |
4879 registerMockedHttpURLLoad("fragment_middle_click.html"); | 4881 registerMockedHttpURLLoad("fragment_middle_click.html"); |
4880 FrameTestHelpers::WebViewHelper webViewHelper; | 4882 FrameTestHelpers::WebViewHelper webViewHelper; |
4881 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue); | 4883 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue); |
4882 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 4884 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
4883 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader(); | 4885 const WebCore::FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->m ainFrameImpl()->frame()->loader(); |
4884 RefPtr<WebCore::HistoryItem> firstItem = mainFrameLoader.currentItem(); | 4886 RefPtr<WebCore::HistoryItem> firstItem = mainFrameLoader.currentItem(); |
4885 EXPECT_TRUE(firstItem); | 4887 EXPECT_TRUE(firstItem); |
4886 | 4888 |
4887 registerMockedHttpURLLoad("white-1x1.png"); | 4889 registerMockedHttpURLLoad("white-1x1.png"); |
4888 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 4890 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
4889 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 4891 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
4890 | 4892 |
4891 // Cache policy overrides should take. | 4893 // Cache policy overrides should take. |
4892 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); | 4894 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); |
4893 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 4895 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
4894 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); | 4896 EXPECT_TRUE(frame->dataSource()->request().cachePolicy() == WebURLRequest::R eloadIgnoringCacheData |
4897 || frame->dataSource()->request().cachePolicy() == WebURLRequest::Reload BypassingCache); | |
4895 } | 4898 } |
4896 | 4899 |
4897 | 4900 |
4898 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien t { | 4901 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien t { |
4899 public: | 4902 public: |
4900 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent Client) | 4903 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent Client) |
4901 : m_parentClient(parentClient) | 4904 : m_parentClient(parentClient) |
4902 , m_policy(WebURLRequest::UseProtocolCachePolicy) | 4905 , m_policy(WebURLRequest::UseProtocolCachePolicy) |
4903 , m_childClient(0) | 4906 , m_childClient(0) |
4904 , m_willSendRequestCallCount(0) | 4907 , m_willSendRequestCallCount(0) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4972 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::UseProtocolCachePolicy); | 4975 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::UseProtocolCachePolicy); |
4973 | 4976 |
4974 FrameTestHelpers::reloadFrame(mainFrame); | 4977 FrameTestHelpers::reloadFrame(mainFrame); |
4975 | 4978 |
4976 // A new WebFrame should have been created, but the child WebFrameClient sho uld be reused. | 4979 // A new WebFrame should have been created, but the child WebFrameClient sho uld be reused. |
4977 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); | 4980 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); |
4978 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt); | 4981 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt); |
4979 | 4982 |
4980 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); | 4983 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); |
4981 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); | 4984 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); |
4982 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData) ; | 4985 EXPECT_TRUE(childClient.cachePolicy() == WebURLRequest::ReloadIgnoringCacheD ata |
4986 || childClient.cachePolicy() == WebURLRequest::ReloadBypassingCache); | |
4983 } | 4987 } |
4984 | 4988 |
4985 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt { | 4989 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt { |
4986 public: | 4990 public: |
4987 TestSameDocumentWebFrameClient() | 4991 TestSameDocumentWebFrameClient() |
4988 : m_frameLoadTypeSameSeen(false) | 4992 : m_frameLoadTypeSameSeen(false) |
4989 { | 4993 { |
4990 } | 4994 } |
4991 | 4995 |
4992 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&) | 4996 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&) |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5420 registerMockedHttpURLLoad("link-manifest-change.html"); | 5424 registerMockedHttpURLLoad("link-manifest-change.html"); |
5421 | 5425 |
5422 ManifestChangeWebFrameClient webFrameClient; | 5426 ManifestChangeWebFrameClient webFrameClient; |
5423 FrameTestHelpers::WebViewHelper webViewHelper; | 5427 FrameTestHelpers::WebViewHelper webViewHelper; |
5424 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); | 5428 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); |
5425 | 5429 |
5426 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); | 5430 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); |
5427 } | 5431 } |
5428 | 5432 |
5429 } // namespace | 5433 } // namespace |
OLD | NEW |