| 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 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3237 | 3237 |
| 3238 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 3238 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
| 3239 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3239 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 3240 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); | 3240 webViewHelper.initializeAndLoad(m_baseURL + "form.html", false, &webFrameCli
ent); |
| 3241 | 3241 |
| 3242 webViewHelper.webView()->mainFrame()->reload(true); | 3242 webViewHelper.webView()->mainFrame()->reload(true); |
| 3243 // start another reload before request is delivered. | 3243 // start another reload before request is delivered. |
| 3244 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); | 3244 FrameTestHelpers::reloadFrameIgnoringCache(webViewHelper.webView()->mainFram
e()); |
| 3245 } | 3245 } |
| 3246 | 3246 |
| 3247 class ReloadWithOverrideURLTask : public WebThread::Task { | 3247 class ReloadWithOverrideURLTask : public WebTaskRunner::Task { |
| 3248 public: | 3248 public: |
| 3249 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) | 3249 ReloadWithOverrideURLTask(WebFrame* frame, const KURL& url, bool ignoreCache
) |
| 3250 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) | 3250 : m_frame(frame), m_url(url), m_ignoreCache(ignoreCache) |
| 3251 { | 3251 { |
| 3252 } | 3252 } |
| 3253 | 3253 |
| 3254 void run() override | 3254 void run() override |
| 3255 { | 3255 { |
| 3256 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); | 3256 m_frame->reloadWithOverrideURL(m_url, m_ignoreCache); |
| 3257 } | 3257 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3287 ClearScrollStateOnCommitWebFrameClient client; | 3287 ClearScrollStateOnCommitWebFrameClient client; |
| 3288 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); | 3288 webViewHelper.initializeAndLoad(m_baseURL + firstURL, true, &client); |
| 3289 webViewHelper.webViewImpl()->resize(WebSize(pageWidth, pageHeight)); | 3289 webViewHelper.webViewImpl()->resize(WebSize(pageWidth, pageHeight)); |
| 3290 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); | 3290 webViewHelper.webViewImpl()->mainFrame()->setScrollOffset(WebSize(pageWidth
/ 4, pageHeight / 4)); |
| 3291 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); | 3291 webViewHelper.webViewImpl()->setPageScaleFactor(pageScaleFactor); |
| 3292 | 3292 |
| 3293 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); | 3293 WebSize previousOffset = webViewHelper.webViewImpl()->mainFrame()->scrollOff
set(); |
| 3294 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); | 3294 float previousScale = webViewHelper.webViewImpl()->pageScaleFactor(); |
| 3295 | 3295 |
| 3296 // Reload the page and end up at the same url. State should be propagated. | 3296 // Reload the page and end up at the same url. State should be propagated. |
| 3297 Platform::current()->currentThread()->postTask( | 3297 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3298 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + firstURL), false)); | 3298 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + firstURL), false)); |
| 3299 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3299 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3300 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); | 3300 EXPECT_EQ(previousOffset.width, webViewHelper.webViewImpl()->mainFrame()->sc
rollOffset().width); |
| 3301 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); | 3301 EXPECT_EQ(previousOffset.height, webViewHelper.webViewImpl()->mainFrame()->s
crollOffset().height); |
| 3302 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); | 3302 EXPECT_EQ(previousScale, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3303 | 3303 |
| 3304 // Reload the page using the cache. State should not be propagated. | 3304 // Reload the page using the cache. State should not be propagated. |
| 3305 Platform::current()->currentThread()->postTask( | 3305 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3306 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + secondURL), false)); | 3306 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + secondURL), false)); |
| 3307 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3307 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3308 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3308 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3309 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3309 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3310 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3310 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3311 | 3311 |
| 3312 // Reload the page while ignoring the cache. State should not be propagated. | 3312 // Reload the page while ignoring the cache. State should not be propagated. |
| 3313 Platform::current()->currentThread()->postTask( | 3313 Platform::current()->currentThread()->taskRunner()->postTask( |
| 3314 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + thirdURL), true)); | 3314 FROM_HERE, new ReloadWithOverrideURLTask(webViewHelper.webViewImpl()->ma
inFrame(), toKURL(m_baseURL + thirdURL), true)); |
| 3315 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); | 3315 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webViewImpl()->m
ainFrame()); |
| 3316 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; | 3316 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().width)
; |
| 3317 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); | 3317 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrame()->scrollOffset().height
); |
| 3318 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); | 3318 EXPECT_EQ(1.0f, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 3319 } | 3319 } |
| 3320 | 3320 |
| 3321 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) | 3321 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) |
| 3322 { | 3322 { |
| 3323 // Test that reloading while the previous load is still pending does not cau
se the initial | 3323 // Test that reloading while the previous load is still pending does not cau
se the initial |
| (...skipping 4768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8092 | 8092 |
| 8093 TEST_F(WebFrameTest, MaxFramesDetach) | 8093 TEST_F(WebFrameTest, MaxFramesDetach) |
| 8094 { | 8094 { |
| 8095 registerMockedHttpURLLoad("max-frames-detach.html"); | 8095 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 8096 FrameTestHelpers::WebViewHelper webViewHelper; | 8096 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8097 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8097 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 8098 webViewImpl->mainFrameImpl()->collectGarbage(); | 8098 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 8099 } | 8099 } |
| 8100 | 8100 |
| 8101 } // namespace blink | 8101 } // namespace blink |
| OLD | NEW |