| 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 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4168 WebURLRequest request(toKURL(m_baseURL + "fixed_layout.html")); | 4168 WebURLRequest request(toKURL(m_baseURL + "fixed_layout.html")); |
| 4169 webViewHelper.webView()->mainFrame()->loadRequest(request); | 4169 webViewHelper.webView()->mainFrame()->loadRequest(request); |
| 4170 // start reload before first request is delivered. | 4170 // start reload before first request is delivered. |
| 4171 FrameTestHelpers::reloadFrameBypassingCache( | 4171 FrameTestHelpers::reloadFrameBypassingCache( |
| 4172 webViewHelper.webView()->mainFrame()); | 4172 webViewHelper.webView()->mainFrame()); |
| 4173 | 4173 |
| 4174 WebDataSource* dataSource = | 4174 WebDataSource* dataSource = |
| 4175 webViewHelper.webView()->mainFrame()->dataSource(); | 4175 webViewHelper.webView()->mainFrame()->dataSource(); |
| 4176 ASSERT_TRUE(dataSource); | 4176 ASSERT_TRUE(dataSource); |
| 4177 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), | 4177 EXPECT_EQ(toKURL(m_baseURL + "fixed_layout.html"), |
| 4178 KURL(dataSource->request().url())); | 4178 KURL(dataSource->getRequest().url())); |
| 4179 } | 4179 } |
| 4180 | 4180 |
| 4181 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { | 4181 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { |
| 4182 const std::string firstURL = "about:blank"; | 4182 const std::string firstURL = "about:blank"; |
| 4183 const std::string secondURL = "http://internal.test"; | 4183 const std::string secondURL = "http://internal.test"; |
| 4184 | 4184 |
| 4185 FrameTestHelpers::WebViewHelper webViewHelper; | 4185 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4186 webViewHelper.initializeAndLoad(firstURL, true); | 4186 webViewHelper.initializeAndLoad(firstURL, true); |
| 4187 | 4187 |
| 4188 WebDataSource* dataSource = | 4188 WebDataSource* dataSource = |
| (...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6993 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 6993 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 6994 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 6994 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 6995 | 6995 |
| 6996 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), | 6996 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), |
| 6997 WebHistoryDifferentDocumentLoad, | 6997 WebHistoryDifferentDocumentLoad, |
| 6998 WebCachePolicy::UseProtocolCachePolicy); | 6998 WebCachePolicy::UseProtocolCachePolicy); |
| 6999 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 6999 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 7000 | 7000 |
| 7001 FrameTestHelpers::reloadFrame(frame); | 7001 FrameTestHelpers::reloadFrame(frame); |
| 7002 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, | 7002 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, |
| 7003 frame->dataSource()->request().getCachePolicy()); | 7003 frame->dataSource()->getRequest().getCachePolicy()); |
| 7004 } | 7004 } |
| 7005 | 7005 |
| 7006 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { | 7006 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { |
| 7007 registerMockedHttpURLLoad("page_with_blank_iframe.html"); | 7007 registerMockedHttpURLLoad("page_with_blank_iframe.html"); |
| 7008 FrameTestHelpers::WebViewHelper webViewHelper; | 7008 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7009 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", | 7009 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", |
| 7010 true); | 7010 true); |
| 7011 WebLocalFrame* mainFrame = webViewHelper.webView()->mainFrameImpl(); | 7011 WebLocalFrame* mainFrame = webViewHelper.webView()->mainFrameImpl(); |
| 7012 const FrameLoader& mainFrameLoader = | 7012 const FrameLoader& mainFrameLoader = |
| 7013 webViewHelper.webView()->mainFrameImpl()->frame()->loader(); | 7013 webViewHelper.webView()->mainFrameImpl()->frame()->loader(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 7040 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); | 7040 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); |
| 7041 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 7041 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 7042 | 7042 |
| 7043 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | 7043 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), |
| 7044 "javascript:document.forms[0].submit()"); | 7044 "javascript:document.forms[0].submit()"); |
| 7045 // Pump requests one more time after the javascript URL has executed to | 7045 // Pump requests one more time after the javascript URL has executed to |
| 7046 // trigger the actual POST load request. | 7046 // trigger the actual POST load request. |
| 7047 FrameTestHelpers::pumpPendingRequestsForFrameToLoad( | 7047 FrameTestHelpers::pumpPendingRequestsForFrameToLoad( |
| 7048 webViewHelper.webView()->mainFrame()); | 7048 webViewHelper.webView()->mainFrame()); |
| 7049 EXPECT_EQ(WebString::fromUTF8("POST"), | 7049 EXPECT_EQ(WebString::fromUTF8("POST"), |
| 7050 frame->dataSource()->request().httpMethod()); | 7050 frame->dataSource()->getRequest().httpMethod()); |
| 7051 | 7051 |
| 7052 FrameTestHelpers::reloadFrame(frame); | 7052 FrameTestHelpers::reloadFrame(frame); |
| 7053 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, | 7053 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, |
| 7054 frame->dataSource()->request().getCachePolicy()); | 7054 frame->dataSource()->getRequest().getCachePolicy()); |
| 7055 EXPECT_EQ(WebNavigationTypeFormResubmitted, | 7055 EXPECT_EQ(WebNavigationTypeFormResubmitted, |
| 7056 frame->dataSource()->navigationType()); | 7056 frame->dataSource()->navigationType()); |
| 7057 } | 7057 } |
| 7058 | 7058 |
| 7059 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload) { | 7059 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload) { |
| 7060 registerMockedHttpURLLoad("fragment_middle_click.html"); | 7060 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 7061 FrameTestHelpers::WebViewHelper webViewHelper; | 7061 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7062 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", | 7062 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", |
| 7063 true); | 7063 true); |
| 7064 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 7064 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 7065 const FrameLoader& mainFrameLoader = | 7065 const FrameLoader& mainFrameLoader = |
| 7066 webViewHelper.webView()->mainFrameImpl()->frame()->loader(); | 7066 webViewHelper.webView()->mainFrameImpl()->frame()->loader(); |
| 7067 Persistent<HistoryItem> firstItem = mainFrameLoader.currentItem(); | 7067 Persistent<HistoryItem> firstItem = mainFrameLoader.currentItem(); |
| 7068 EXPECT_TRUE(firstItem); | 7068 EXPECT_TRUE(firstItem); |
| 7069 | 7069 |
| 7070 registerMockedHttpURLLoad("white-1x1.png"); | 7070 registerMockedHttpURLLoad("white-1x1.png"); |
| 7071 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); | 7071 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); |
| 7072 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); | 7072 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); |
| 7073 | 7073 |
| 7074 // Cache policy overrides should take. | 7074 // Cache policy overrides should take. |
| 7075 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), | 7075 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), |
| 7076 WebHistoryDifferentDocumentLoad, | 7076 WebHistoryDifferentDocumentLoad, |
| 7077 WebCachePolicy::ValidatingCacheData); | 7077 WebCachePolicy::ValidatingCacheData); |
| 7078 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); | 7078 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); |
| 7079 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, | 7079 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, |
| 7080 frame->dataSource()->request().getCachePolicy()); | 7080 frame->dataSource()->getRequest().getCachePolicy()); |
| 7081 } | 7081 } |
| 7082 | 7082 |
| 7083 class TestCachePolicyWebFrameClient | 7083 class TestCachePolicyWebFrameClient |
| 7084 : public FrameTestHelpers::TestWebFrameClient { | 7084 : public FrameTestHelpers::TestWebFrameClient { |
| 7085 public: | 7085 public: |
| 7086 explicit TestCachePolicyWebFrameClient( | 7086 explicit TestCachePolicyWebFrameClient( |
| 7087 TestCachePolicyWebFrameClient* parentClient) | 7087 TestCachePolicyWebFrameClient* parentClient) |
| 7088 : m_parentClient(parentClient), | 7088 : m_parentClient(parentClient), |
| 7089 m_policy(WebCachePolicy::UseProtocolCachePolicy), | 7089 m_policy(WebCachePolicy::UseProtocolCachePolicy), |
| 7090 m_childClient(0), | 7090 m_childClient(0), |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8332 | 8332 |
| 8333 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) { | 8333 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) { |
| 8334 // Check that a reload bypassing cache on a frame will result in the cache | 8334 // Check that a reload bypassing cache on a frame will result in the cache |
| 8335 // policy of the request being set to ReloadBypassingCache. | 8335 // policy of the request being set to ReloadBypassingCache. |
| 8336 registerMockedHttpURLLoad("foo.html"); | 8336 registerMockedHttpURLLoad("foo.html"); |
| 8337 FrameTestHelpers::WebViewHelper webViewHelper; | 8337 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8338 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true); | 8338 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true); |
| 8339 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 8339 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 8340 FrameTestHelpers::reloadFrameBypassingCache(frame); | 8340 FrameTestHelpers::reloadFrameBypassingCache(frame); |
| 8341 EXPECT_EQ(WebCachePolicy::BypassingCache, | 8341 EXPECT_EQ(WebCachePolicy::BypassingCache, |
| 8342 frame->dataSource()->request().getCachePolicy()); | 8342 frame->dataSource()->getRequest().getCachePolicy()); |
| 8343 } | 8343 } |
| 8344 | 8344 |
| 8345 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, | 8345 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, |
| 8346 DragImage* dragImage) { | 8346 DragImage* dragImage) { |
| 8347 // Prepare the reference bitmap. | 8347 // Prepare the reference bitmap. |
| 8348 SkBitmap bitmap; | 8348 SkBitmap bitmap; |
| 8349 bitmap.allocN32Pixels(referenceBitmapSize.width(), | 8349 bitmap.allocN32Pixels(referenceBitmapSize.width(), |
| 8350 referenceBitmapSize.height()); | 8350 referenceBitmapSize.height()); |
| 8351 SkCanvas canvas(bitmap); | 8351 SkCanvas canvas(bitmap); |
| 8352 canvas.drawColor(SK_ColorGREEN); | 8352 canvas.drawColor(SK_ColorGREEN); |
| (...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11095 | 11095 |
| 11096 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11096 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11097 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11097 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11098 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11098 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11099 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11099 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11100 | 11100 |
| 11101 webViewHelper.reset(); | 11101 webViewHelper.reset(); |
| 11102 } | 11102 } |
| 11103 | 11103 |
| 11104 } // namespace blink | 11104 } // namespace blink |
| OLD | NEW |