| 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 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3220 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) | 3220 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) |
| 3221 { | 3221 { |
| 3222 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 3222 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
| 3223 // would sometimes call decidePolicyForNavigation with isRedirect=true | 3223 // would sometimes call decidePolicyForNavigation with isRedirect=true |
| 3224 registerMockedHttpURLLoad("form.html"); | 3224 registerMockedHttpURLLoad("form.html"); |
| 3225 | 3225 |
| 3226 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 3226 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
| 3227 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3227 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3228 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); | 3228 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); |
| 3229 | 3229 |
| 3230 webViewHelper.webView()->mainFrame()->reload(true); | 3230 webViewHelper.webView()->mainFrame()->reload(WebFrameLoadType::ReloadBypassi
ngCache); |
| 3231 // start another reload before request is delivered. | 3231 // start another reload before request is delivered. |
| 3232 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3232 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
| 3233 } | 3233 } |
| 3234 | 3234 |
| 3235 class ClearScrollStateOnCommitWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { | 3235 class ClearScrollStateOnCommitWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { |
| 3236 public: | 3236 public: |
| 3237 void didCommitProvisionalLoad(WebLocalFrame* frame, const WebHistoryItem&, W
ebHistoryCommitType) override | 3237 void didCommitProvisionalLoad(WebLocalFrame* frame, const WebHistoryItem&, W
ebHistoryCommitType) override |
| 3238 { | 3238 { |
| 3239 frame->view()->resetScrollAndScaleState(); | 3239 frame->view()->resetScrollAndScaleState(); |
| 3240 } | 3240 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3257 ClearScrollStateOnCommitWebFrameClient client; | 3257 ClearScrollStateOnCommitWebFrameClient client; |
| 3258 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); | 3258 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); |
| 3259 webViewHelper.resize(WebSize(pageWidth, pageHeight)); | 3259 webViewHelper.resize(WebSize(pageWidth, pageHeight)); |
| 3260 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); | 3260 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); |
| 3261 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); | 3261 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); |
| 3262 | 3262 |
| 3263 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); | 3263 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); |
| 3264 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); | 3264 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); |
| 3265 | 3265 |
| 3266 // Reload the page and end up at the same url. State should be propagated. | 3266 // Reload the page and end up at the same url. State should be propagated. |
| 3267 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + firstURL), false); | 3267 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + firstURL), WebFrameLoadType::Reload); |
| 3268 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); | 3268 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); |
| 3269 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); | 3269 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); |
| 3270 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); | 3270 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); |
| 3271 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); | 3271 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3272 | 3272 |
| 3273 // Reload the page using the cache. State should not be propagated. | 3273 // Reload the page using the cache. State should not be propagated. |
| 3274 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + secondURL), false); | 3274 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + secondURL), WebFrameLoadType::Reload); |
| 3275 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); | 3275 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); |
| 3276 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3276 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3277 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3277 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3278 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3278 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3279 | 3279 |
| 3280 // Reload the page while ignoring the cache. State should not be propagated. | 3280 // Reload the page while ignoring the cache. State should not be propagated. |
| 3281 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + thirdURL), true); | 3281 webViewHelper.webViewImpl()->mainFrame()->reloadWithOverrideURL(toKURL(m_bas
eURL + thirdURL), WebFrameLoadType::ReloadBypassingCache); |
| 3282 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); | 3282 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webViewImp
l()->mainFrame()); |
| 3283 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3283 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3284 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3284 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3285 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3285 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3286 } | 3286 } |
| 3287 | 3287 |
| 3288 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) | 3288 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) |
| 3289 { | 3289 { |
| 3290 // Test that reloading while the previous load is still pending does not cau
se the initial | 3290 // Test that reloading while the previous load is still pending does not cau
se the initial |
| 3291 // request to get lost. | 3291 // request to get lost. |
| (...skipping 5207 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 |