| 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 5868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5879 EXPECT_TRUE(firstItem); | 5879 EXPECT_TRUE(firstItem); |
| 5880 | 5880 |
| 5881 registerMockedHttpURLLoad("white-1x1.png"); | 5881 registerMockedHttpURLLoad("white-1x1.png"); |
| 5882 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 5882 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 5883 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 5883 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 5884 | 5884 |
| 5885 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We
bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); | 5885 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We
bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); |
| 5886 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 5886 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 5887 | 5887 |
| 5888 FrameTestHelpers::reloadFrame(frame); | 5888 FrameTestHelpers::reloadFrame(frame); |
| 5889 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().getCachePolicy()); | 5889 EXPECT_EQ(WebURLRequest::ValidatingCacheData, frame->dataSource()->request()
.getCachePolicy()); |
| 5890 } | 5890 } |
| 5891 | 5891 |
| 5892 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) | 5892 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) |
| 5893 { | 5893 { |
| 5894 registerMockedHttpURLLoad("page_with_blank_iframe.html"); | 5894 registerMockedHttpURLLoad("page_with_blank_iframe.html"); |
| 5895 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5895 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 5896 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t
rue); | 5896 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t
rue); |
| 5897 WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); | 5897 WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); |
| 5898 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); | 5898 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); |
| 5899 WebFrame* childFrame = mainFrame->firstChild(); | 5899 WebFrame* childFrame = mainFrame->firstChild(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 5922 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); | 5922 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); |
| 5923 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 5923 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 5924 | 5924 |
| 5925 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.forms[0].submit()"); | 5925 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip
t:document.forms[0].submit()"); |
| 5926 // Pump requests one more time after the javascript URL has executed to | 5926 // Pump requests one more time after the javascript URL has executed to |
| 5927 // trigger the actual POST load request. | 5927 // trigger the actual POST load request. |
| 5928 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()-
>mainFrame()); | 5928 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()-
>mainFrame()); |
| 5929 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe
thod()); | 5929 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe
thod()); |
| 5930 | 5930 |
| 5931 FrameTestHelpers::reloadFrame(frame); | 5931 FrameTestHelpers::reloadFrame(frame); |
| 5932 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().getCachePolicy()); | 5932 EXPECT_EQ(WebURLRequest::ValidatingCacheData, frame->dataSource()->request()
.getCachePolicy()); |
| 5933 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT
ype()); | 5933 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT
ype()); |
| 5934 } | 5934 } |
| 5935 | 5935 |
| 5936 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload) | 5936 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload) |
| 5937 { | 5937 { |
| 5938 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5938 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 5939 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5939 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 5940 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); | 5940 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); |
| 5941 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 5941 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 5942 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); | 5942 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); |
| 5943 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem(
); | 5943 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem(
); |
| 5944 EXPECT_TRUE(firstItem); | 5944 EXPECT_TRUE(firstItem); |
| 5945 | 5945 |
| 5946 registerMockedHttpURLLoad("white-1x1.png"); | 5946 registerMockedHttpURLLoad("white-1x1.png"); |
| 5947 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 5947 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 5948 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 5948 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 5949 | 5949 |
| 5950 // Cache policy overrides should take. | 5950 // Cache policy overrides should take. |
| 5951 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto
ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); | 5951 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto
ryDifferentDocumentLoad, WebURLRequest::ValidatingCacheData); |
| 5952 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 5952 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 5953 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().getCachePolicy()); | 5953 EXPECT_EQ(WebURLRequest::ValidatingCacheData, frame->dataSource()->request()
.getCachePolicy()); |
| 5954 } | 5954 } |
| 5955 | 5955 |
| 5956 | 5956 |
| 5957 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien
t { | 5957 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien
t { |
| 5958 public: | 5958 public: |
| 5959 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent
Client) | 5959 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent
Client) |
| 5960 : m_parentClient(parentClient) | 5960 : m_parentClient(parentClient) |
| 5961 , m_policy(WebURLRequest::UseProtocolCachePolicy) | 5961 , m_policy(WebURLRequest::UseProtocolCachePolicy) |
| 5962 , m_childClient(0) | 5962 , m_childClient(0) |
| 5963 , m_willSendRequestCallCount(0) | 5963 , m_willSendRequestCallCount(0) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6031 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::UseProtocolCachePolic
y); | 6031 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::UseProtocolCachePolic
y); |
| 6032 | 6032 |
| 6033 FrameTestHelpers::reloadFrame(mainFrame); | 6033 FrameTestHelpers::reloadFrame(mainFrame); |
| 6034 | 6034 |
| 6035 // A new WebFrame should have been created, but the child WebFrameClient sho
uld be reused. | 6035 // A new WebFrame should have been created, but the child WebFrameClient sho
uld be reused. |
| 6036 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); | 6036 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); |
| 6037 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie
nt); | 6037 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie
nt); |
| 6038 | 6038 |
| 6039 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); | 6039 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); |
| 6040 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); | 6040 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); |
| 6041 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::ReloadIgnoringCacheDa
ta); | 6041 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::ValidatingCacheData); |
| 6042 } | 6042 } |
| 6043 | 6043 |
| 6044 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie
nt { | 6044 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie
nt { |
| 6045 public: | 6045 public: |
| 6046 TestSameDocumentWebFrameClient() | 6046 TestSameDocumentWebFrameClient() |
| 6047 : m_frameLoadTypeSameSeen(false) | 6047 : m_frameLoadTypeSameSeen(false) |
| 6048 { | 6048 { |
| 6049 } | 6049 } |
| 6050 | 6050 |
| 6051 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&,
const WebURLResponse&) | 6051 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&,
const WebURLResponse&) |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6872 | 6872 |
| 6873 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) | 6873 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) |
| 6874 { | 6874 { |
| 6875 // Check that a reload ignoring cache on a frame will result in the cache | 6875 // Check that a reload ignoring cache on a frame will result in the cache |
| 6876 // policy of the request being set to ReloadBypassingCache. | 6876 // policy of the request being set to ReloadBypassingCache. |
| 6877 registerMockedHttpURLLoad("foo.html"); | 6877 registerMockedHttpURLLoad("foo.html"); |
| 6878 FrameTestHelpers::WebViewHelper webViewHelper(this); | 6878 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 6879 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true); | 6879 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true); |
| 6880 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 6880 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 6881 FrameTestHelpers::reloadFrameIgnoringCache(frame); | 6881 FrameTestHelpers::reloadFrameIgnoringCache(frame); |
| 6882 EXPECT_EQ(WebURLRequest::ReloadBypassingCache, frame->dataSource()->request(
).getCachePolicy()); | 6882 EXPECT_EQ(WebURLRequest::BypassingCache, frame->dataSource()->request().getC
achePolicy()); |
| 6883 } | 6883 } |
| 6884 | 6884 |
| 6885 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, DragImag
e* dragImage) | 6885 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, DragImag
e* dragImage) |
| 6886 { | 6886 { |
| 6887 // Prepare the reference bitmap. | 6887 // Prepare the reference bitmap. |
| 6888 SkBitmap bitmap; | 6888 SkBitmap bitmap; |
| 6889 bitmap.allocN32Pixels(referenceBitmapSize.width(), referenceBitmapSize.heigh
t()); | 6889 bitmap.allocN32Pixels(referenceBitmapSize.width(), referenceBitmapSize.heigh
t()); |
| 6890 SkCanvas canvas(bitmap); | 6890 SkCanvas canvas(bitmap); |
| 6891 canvas.drawColor(SK_ColorGREEN); | 6891 canvas.drawColor(SK_ColorGREEN); |
| 6892 | 6892 |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8499 } | 8499 } |
| 8500 | 8500 |
| 8501 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8501 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
| 8502 { | 8502 { |
| 8503 swapLocalFrameToRemoteFrame(); | 8503 swapLocalFrameToRemoteFrame(); |
| 8504 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8504 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
| 8505 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8505 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
| 8506 } | 8506 } |
| 8507 | 8507 |
| 8508 } // namespace blink | 8508 } // namespace blink |
| OLD | NEW |