| 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 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3227 | 3227 |
| 3228 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 3228 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
| 3229 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3229 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3230 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); | 3230 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); |
| 3231 | 3231 |
| 3232 webViewHelper.webView()->mainFrame()->reload(true); | 3232 webViewHelper.webView()->mainFrame()->reload(true); |
| 3233 // start another reload before request is delivered. | 3233 // start another reload before request is delivered. |
| 3234 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3234 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
| 3235 } | 3235 } |
| 3236 | 3236 |
| 3237 class ReloadWithOverrideURLTask : public WebTaskRunner::Task { | 3237 namespace { |
| 3238 public: | |
| 3239 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) | |
| 3240 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) | |
| 3241 { | |
| 3242 } | |
| 3243 | 3238 |
| 3244 void run() override | 3239 void runReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreC
ache) |
| 3245 { | 3240 { |
| 3246 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); | 3241 frame->reloadWithOverrideURL(url, ignoreCache); |
| 3247 } | 3242 } |
| 3248 | 3243 |
| 3249 private: | 3244 } // namespace |
| 3250 WebFrame* const m_frame; | |
| 3251 const KURL m_url; | |
| 3252 const bool m_ignoreCache; | |
| 3253 }; | |
| 3254 | 3245 |
| 3255 class ClearScrollStateOnCommitWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { | 3246 class ClearScrollStateOnCommitWebFrameClient : public FrameTestHelpers::TestWebF
rameClient { |
| 3256 public: | 3247 public: |
| 3257 void didCommitProvisionalLoad(WebLocalFrame* frame, const WebHistoryItem&, W
ebHistoryCommitType) override | 3248 void didCommitProvisionalLoad(WebLocalFrame* frame, const WebHistoryItem&, W
ebHistoryCommitType) override |
| 3258 { | 3249 { |
| 3259 frame->view()->resetScrollAndScaleState(); | 3250 frame->view()->resetScrollAndScaleState(); |
| 3260 } | 3251 } |
| 3261 }; | 3252 }; |
| 3262 | 3253 |
| 3263 TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) | 3254 TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3278 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); | 3269 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); |
| 3279 webViewHelper.resize(WebSize(pageWidth, pageHeight)); | 3270 webViewHelper.resize(WebSize(pageWidth, pageHeight)); |
| 3280 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); | 3271 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); |
| 3281 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); | 3272 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); |
| 3282 | 3273 |
| 3283 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); | 3274 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); |
| 3284 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); | 3275 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); |
| 3285 | 3276 |
| 3286 // Reload the page and end up at the same url. State should be propagated. | 3277 // Reload the page and end up at the same url. State should be propagated. |
| 3287 Platform::current()->currentThread()->taskRunner()->postTask( | 3278 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3288 BLINK_FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl
()->mainFrame(), toKURL(m_baseURL + firstURL), false)); | 3279 BLINK_FROM_HERE, bind(&runReloadWithOverrideURLTask, webViewHelper.webVi
ewImpl()->mainFrame(), toKURL(m_baseURL + firstURL), false)); |
| 3289 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3280 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3290 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); | 3281 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); |
| 3291 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); | 3282 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); |
| 3292 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); | 3283 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3293 | 3284 |
| 3294 // Reload the page using the cache. State should not be propagated. | 3285 // Reload the page using the cache. State should not be propagated. |
| 3295 Platform::current()->currentThread()->taskRunner()->postTask( | 3286 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3296 BLINK_FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl
()->mainFrame(), toKURL(m_baseURL + secondURL), false)); | 3287 BLINK_FROM_HERE, bind(&runReloadWithOverrideURLTask, webViewHelper.webVi
ewImpl()->mainFrame(), toKURL(m_baseURL + secondURL), false)); |
| 3297 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3288 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3298 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3289 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3299 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3290 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3300 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3291 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3301 | 3292 |
| 3302 // Reload the page while ignoring the cache. State should not be propagated. | 3293 // Reload the page while ignoring the cache. State should not be propagated. |
| 3303 Platform::current()->currentThread()->taskRunner()->postTask( | 3294 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3304 BLINK_FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl
()->mainFrame(), toKURL(m_baseURL + thirdURL), true)); | 3295 BLINK_FROM_HERE, bind(&runReloadWithOverrideURLTask, webViewHelper.webVi
ewImpl()->mainFrame(), toKURL(m_baseURL + thirdURL), true)); |
| 3305 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3296 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3306 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3297 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3307 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3298 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3308 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3299 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3309 } | 3300 } |
| 3310 | 3301 |
| 3311 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) | 3302 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) |
| 3312 { | 3303 { |
| 3313 // Test that reloading while the previous load is still pending does not cau
se the initial | 3304 // Test that reloading while the previous load is still pending does not cau
se the initial |
| 3314 // request to get lost. | 3305 // request to get lost. |
| (...skipping 5148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8463 } | 8454 } |
| 8464 | 8455 |
| 8465 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) | 8456 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) |
| 8466 { | 8457 { |
| 8467 swapLocalFrameToRemoteFrame(); | 8458 swapLocalFrameToRemoteFrame(); |
| 8468 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); | 8459 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p
arentElement.style.display = 'none';")); |
| 8469 EXPECT_FALSE(remoteFrameClient()->isVisible()); | 8460 EXPECT_FALSE(remoteFrameClient()->isVisible()); |
| 8470 } | 8461 } |
| 8471 | 8462 |
| 8472 } // namespace blink | 8463 } // namespace blink |
| OLD | NEW |