| 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 5484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5495 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); | 5495 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); |
| 5496 } | 5496 } |
| 5497 | 5497 |
| 5498 TEST_F(WebFrameTest, BackToReload) | 5498 TEST_F(WebFrameTest, BackToReload) |
| 5499 { | 5499 { |
| 5500 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5500 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 5501 FrameTestHelpers::WebViewHelper webViewHelper; | 5501 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5502 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); | 5502 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); |
| 5503 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 5503 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 5504 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); | 5504 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); |
| 5505 RefPtr<HistoryItem> firstItem = mainFrameLoader.currentItem(); | 5505 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem(
); |
| 5506 EXPECT_TRUE(firstItem); | 5506 EXPECT_TRUE(firstItem); |
| 5507 | 5507 |
| 5508 registerMockedHttpURLLoad("white-1x1.png"); | 5508 registerMockedHttpURLLoad("white-1x1.png"); |
| 5509 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 5509 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 5510 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 5510 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 5511 | 5511 |
| 5512 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We
bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); | 5512 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We
bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); |
| 5513 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 5513 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 5514 | 5514 |
| 5515 FrameTestHelpers::reloadFrame(frame); | 5515 FrameTestHelpers::reloadFrame(frame); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT
ype()); | 5560 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT
ype()); |
| 5561 } | 5561 } |
| 5562 | 5562 |
| 5563 TEST_F(WebFrameTest, LoadHistoryItemReload) | 5563 TEST_F(WebFrameTest, LoadHistoryItemReload) |
| 5564 { | 5564 { |
| 5565 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5565 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 5566 FrameTestHelpers::WebViewHelper webViewHelper; | 5566 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5567 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); | 5567 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue); |
| 5568 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 5568 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 5569 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); | 5569 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI
mpl()->frame()->loader(); |
| 5570 RefPtr<HistoryItem> firstItem = mainFrameLoader.currentItem(); | 5570 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem(
); |
| 5571 EXPECT_TRUE(firstItem); | 5571 EXPECT_TRUE(firstItem); |
| 5572 | 5572 |
| 5573 registerMockedHttpURLLoad("white-1x1.png"); | 5573 registerMockedHttpURLLoad("white-1x1.png"); |
| 5574 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 5574 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 5575 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 5575 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 5576 | 5576 |
| 5577 // Cache policy overrides should take. | 5577 // Cache policy overrides should take. |
| 5578 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto
ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); | 5578 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto
ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); |
| 5579 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 5579 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 5580 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); | 5580 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5825 private: | 5825 private: |
| 5826 WebHistoryCommitType m_lastCommitType; | 5826 WebHistoryCommitType m_lastCommitType; |
| 5827 }; | 5827 }; |
| 5828 | 5828 |
| 5829 TEST_F(WebFrameTest, SameDocumentHistoryNavigationCommitType) | 5829 TEST_F(WebFrameTest, SameDocumentHistoryNavigationCommitType) |
| 5830 { | 5830 { |
| 5831 registerMockedHttpURLLoad("push_state.html"); | 5831 registerMockedHttpURLLoad("push_state.html"); |
| 5832 TestDidNavigateCommitTypeWebFrameClient client; | 5832 TestDidNavigateCommitTypeWebFrameClient client; |
| 5833 FrameTestHelpers::WebViewHelper webViewHelper; | 5833 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5834 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "push
_state.html", true, &client); | 5834 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "push
_state.html", true, &client); |
| 5835 RefPtr<HistoryItem> item = toLocalFrame(webViewImpl->page()->mainFrame())->l
oader().currentItem(); | 5835 RefPtrWillBePersistent<HistoryItem> item = toLocalFrame(webViewImpl->page()-
>mainFrame())->loader().currentItem(); |
| 5836 runPendingTasks(); | 5836 runPendingTasks(); |
| 5837 | 5837 |
| 5838 toLocalFrame(webViewImpl->page()->mainFrame())->loader().loadHistoryItem(ite
m.get(), FrameLoadTypeBackForward, HistorySameDocumentLoad); | 5838 toLocalFrame(webViewImpl->page()->mainFrame())->loader().loadHistoryItem(ite
m.get(), FrameLoadTypeBackForward, HistorySameDocumentLoad); |
| 5839 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); | 5839 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); |
| 5840 } | 5840 } |
| 5841 | 5841 |
| 5842 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 5842 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| 5843 public: | 5843 public: |
| 5844 TestHistoryWebFrameClient() | 5844 TestHistoryWebFrameClient() |
| 5845 { | 5845 { |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6823 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6823 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6824 | 6824 |
| 6825 // Neither should a page reload. | 6825 // Neither should a page reload. |
| 6826 localFrame->reload(); | 6826 localFrame->reload(); |
| 6827 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6827 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
| 6828 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6828 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
| 6829 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6829 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6830 } | 6830 } |
| 6831 | 6831 |
| 6832 } // namespace | 6832 } // namespace |
| OLD | NEW |