| 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 5869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5880 | 5880 |
| 5881 // A new WebFrame should have been created, but the child WebFrameClient sho
uld be reused. | 5881 // A new WebFrame should have been created, but the child WebFrameClient sho
uld be reused. |
| 5882 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); | 5882 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); |
| 5883 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie
nt); | 5883 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie
nt); |
| 5884 | 5884 |
| 5885 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); | 5885 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); |
| 5886 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); | 5886 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); |
| 5887 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData)
; | 5887 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData)
; |
| 5888 } | 5888 } |
| 5889 | 5889 |
| 5890 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie
nt { | |
| 5891 public: | |
| 5892 TestSameDocumentWebFrameClient() | |
| 5893 : m_frameLoadTypeSameSeen(false) | |
| 5894 { | |
| 5895 } | |
| 5896 | |
| 5897 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&,
const WebURLResponse&) | |
| 5898 { | |
| 5899 if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoa
dTypeSame) | |
| 5900 m_frameLoadTypeSameSeen = true; | |
| 5901 } | |
| 5902 | |
| 5903 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; } | |
| 5904 | |
| 5905 private: | |
| 5906 bool m_frameLoadTypeSameSeen; | |
| 5907 }; | |
| 5908 | |
| 5909 TEST_P(ParameterizedWebFrameTest, NavigateToSame) | 5890 TEST_P(ParameterizedWebFrameTest, NavigateToSame) |
| 5910 { | 5891 { |
| 5911 registerMockedHttpURLLoad("navigate_to_same.html"); | 5892 URLTestHelpers::registerMockedURLLoad(toKURL(m_baseURL + "navigate_to_same.h
tml#"), WebString::fromUTF8("navigate_to_same.html")); |
| 5912 TestSameDocumentWebFrameClient client; | 5893 TestCachePolicyWebFrameClient client(nullptr); |
| 5913 FrameTestHelpers::WebViewHelper webViewHelper(this); | 5894 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 5914 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, &
client); | 5895 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html#", true,
&client); |
| 5915 EXPECT_FALSE(client.frameLoadTypeSameSeen()); | 5896 EXPECT_EQ(1, client.willSendRequestCallCount()); |
| 5916 | 5897 |
| 5917 FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper.
webViewImpl()->page()->mainFrame())->document()->url())); | 5898 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "navigate_to_same.html#"); |
| 5918 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5899 EXPECT_EQ(2, client.willSendRequestCallCount()); |
| 5919 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF
rame()); | |
| 5920 | |
| 5921 EXPECT_TRUE(client.frameLoadTypeSameSeen()); | |
| 5922 } | 5900 } |
| 5923 | 5901 |
| 5924 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { | 5902 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb
FrameClient { |
| 5925 public: | 5903 public: |
| 5926 TestSameDocumentWithImageWebFrameClient() | 5904 TestSameDocumentWithImageWebFrameClient() |
| 5927 : m_numOfImageRequests(0) | 5905 : m_numOfImageRequests(0) |
| 5928 { | 5906 { |
| 5929 } | 5907 } |
| 5930 | 5908 |
| 5931 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&
request, const WebURLResponse&) | 5909 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&
request, const WebURLResponse&) |
| (...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7855 | 7833 |
| 7856 TEST_F(WebFrameTest, MaxFramesDetach) | 7834 TEST_F(WebFrameTest, MaxFramesDetach) |
| 7857 { | 7835 { |
| 7858 registerMockedHttpURLLoad("max-frames-detach.html"); | 7836 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 7859 FrameTestHelpers::WebViewHelper webViewHelper; | 7837 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7860 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 7838 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 7861 webViewImpl->mainFrameImpl()->collectGarbage(); | 7839 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 7862 } | 7840 } |
| 7863 | 7841 |
| 7864 } // namespace blink | 7842 } // namespace blink |
| OLD | NEW |