| 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 10147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10158 helper.initializeAndLoad(url, true); | 10158 helper.initializeAndLoad(url, true); |
| 10159 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); | 10159 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); |
| 10160 | 10160 |
| 10161 Document* document = | 10161 Document* document = |
| 10162 toLocalFrame(helper.webView()->page()->mainFrame())->document(); | 10162 toLocalFrame(helper.webView()->page()->mainFrame())->document(); |
| 10163 EXPECT_TRUE(document->isImageDocument()); | 10163 EXPECT_TRUE(document->isImageDocument()); |
| 10164 EXPECT_EQ(Resource::DecodeError, | 10164 EXPECT_EQ(Resource::DecodeError, |
| 10165 toImageDocument(document)->cachedImage()->getStatus()); | 10165 toImageDocument(document)->cachedImage()->getStatus()); |
| 10166 } | 10166 } |
| 10167 | 10167 |
| 10168 // Load a page with display:none set and try to scroll it. It shouldn't crash |
| 10169 // due to lack of layoutObject. crbug.com/653327. |
| 10170 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) { |
| 10171 registerMockedHttpURLLoad("display-none.html"); |
| 10172 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10173 webViewHelper.initializeAndLoad(m_baseURL + "display-none.html"); |
| 10174 WebViewImpl* webView = webViewHelper.webView(); |
| 10175 webViewHelper.resize(WebSize(640, 480)); |
| 10176 |
| 10177 Document* document = webView->mainFrameImpl()->frame()->document(); |
| 10178 document->documentElement()->setLayoutObject(nullptr); |
| 10179 |
| 10180 WebGestureEvent beginEvent; |
| 10181 beginEvent.type = WebInputEvent::GestureScrollEnd; |
| 10182 beginEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10183 WebGestureEvent updateEvent; |
| 10184 updateEvent.type = WebInputEvent::GestureScrollEnd; |
| 10185 updateEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10186 WebGestureEvent endEvent; |
| 10187 endEvent.type = WebInputEvent::GestureScrollEnd; |
| 10188 endEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10189 |
| 10190 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not |
| 10191 // seeing a Begin first doesn't break anything. (This currently happens). |
| 10192 webViewHelper.webView()->handleInputEvent(endEvent); |
| 10193 webViewHelper.webView()->handleInputEvent(updateEvent); |
| 10194 |
| 10195 // Try a full Begin/Update/End cycle. |
| 10196 webViewHelper.webView()->handleInputEvent(beginEvent); |
| 10197 webViewHelper.webView()->handleInputEvent(updateEvent); |
| 10198 webViewHelper.webView()->handleInputEvent(endEvent); |
| 10199 } |
| 10200 |
| 10168 } // namespace blink | 10201 } // namespace blink |
| OLD | NEW |