OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
43 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
44 #include "core/frame/VisualViewport.h" | 44 #include "core/frame/VisualViewport.h" |
45 #include "core/html/HTMLIFrameElement.h" | 45 #include "core/html/HTMLIFrameElement.h" |
46 #include "core/html/HTMLInputElement.h" | 46 #include "core/html/HTMLInputElement.h" |
47 #include "core/html/HTMLTextAreaElement.h" | 47 #include "core/html/HTMLTextAreaElement.h" |
48 #include "core/layout/api/LayoutViewItem.h" | 48 #include "core/layout/api/LayoutViewItem.h" |
49 #include "core/loader/DocumentLoader.h" | 49 #include "core/loader/DocumentLoader.h" |
50 #include "core/loader/FrameLoadRequest.h" | 50 #include "core/loader/FrameLoadRequest.h" |
51 #include "core/page/Page.h" | 51 #include "core/page/Page.h" |
52 #include "core/page/ScopedPageLoadDeferrer.h" | 52 #include "core/page/ScopedPageSuspender.h" |
53 #include "core/paint/PaintLayer.h" | 53 #include "core/paint/PaintLayer.h" |
54 #include "core/paint/PaintLayerPainter.h" | 54 #include "core/paint/PaintLayerPainter.h" |
55 #include "core/timing/DOMWindowPerformance.h" | 55 #include "core/timing/DOMWindowPerformance.h" |
56 #include "core/timing/Performance.h" | 56 #include "core/timing/Performance.h" |
57 #include "platform/KeyboardCodes.h" | 57 #include "platform/KeyboardCodes.h" |
58 #include "platform/UserGestureIndicator.h" | 58 #include "platform/UserGestureIndicator.h" |
59 #include "platform/geometry/IntRect.h" | 59 #include "platform/geometry/IntRect.h" |
60 #include "platform/geometry/IntSize.h" | 60 #include "platform/geometry/IntSize.h" |
61 #include "platform/graphics/Color.h" | 61 #include "platform/graphics/Color.h" |
62 #include "platform/graphics/GraphicsContext.h" | 62 #include "platform/graphics/GraphicsContext.h" |
(...skipping 4072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4135 webView->setInitialFocus(false); | 4135 webView->setInitialFocus(false); |
4136 | 4136 |
4137 EXPECT_TRUE( | 4137 EXPECT_TRUE( |
4138 frame->frameWidget()->getActiveWebInputMethodController()->commitText( | 4138 frame->frameWidget()->getActiveWebInputMethodController()->commitText( |
4139 WebString::fromUTF8(std::string("hello").c_str()), 0)); | 4139 WebString::fromUTF8(std::string("hello").c_str()), 0)); |
4140 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 4140 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
4141 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 4141 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
4142 frame->setAutofillClient(0); | 4142 frame->setAutofillClient(0); |
4143 } | 4143 } |
4144 | 4144 |
4145 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the | 4145 // Verify that a WebView created with a ScopedPageSuspender already on the |
4146 // stack defers its loads. | 4146 // stack defers its loads. |
4147 TEST_P(WebViewTest, CreatedDuringLoadDeferral) { | 4147 TEST_P(WebViewTest, CreatedDuringPageSuspension) { |
4148 { | 4148 { |
4149 WebViewImpl* webView = m_webViewHelper.initialize(); | 4149 WebViewImpl* webView = m_webViewHelper.initialize(); |
4150 EXPECT_FALSE(webView->page()->defersLoading()); | 4150 EXPECT_FALSE(webView->page()->suspended()); |
4151 } | 4151 } |
4152 | 4152 |
4153 { | 4153 { |
4154 ScopedPageLoadDeferrer deferrer; | 4154 ScopedPageSuspender suspender; |
4155 WebViewImpl* webView = m_webViewHelper.initialize(); | 4155 WebViewImpl* webView = m_webViewHelper.initialize(); |
4156 EXPECT_TRUE(webView->page()->defersLoading()); | 4156 EXPECT_TRUE(webView->page()->suspended()); |
4157 } | 4157 } |
4158 } | 4158 } |
4159 | 4159 |
4160 // Make sure the SubframeBeforeUnloadUseCounter is only incremented on subframe | 4160 // Make sure the SubframeBeforeUnloadUseCounter is only incremented on subframe |
4161 // unloads. crbug.com/635029. | 4161 // unloads. crbug.com/635029. |
4162 TEST_P(WebViewTest, SubframeBeforeUnloadUseCounter) { | 4162 TEST_P(WebViewTest, SubframeBeforeUnloadUseCounter) { |
4163 registerMockedHttpURLLoad("visible_iframe.html"); | 4163 registerMockedHttpURLLoad("visible_iframe.html"); |
4164 registerMockedHttpURLLoad("single_iframe.html"); | 4164 registerMockedHttpURLLoad("single_iframe.html"); |
4165 WebViewImpl* webView = | 4165 WebViewImpl* webView = |
4166 m_webViewHelper.initializeAndLoad(m_baseURL + "single_iframe.html", true); | 4166 m_webViewHelper.initializeAndLoad(m_baseURL + "single_iframe.html", true); |
(...skipping 27 matching lines...) Expand all Loading... |
4194 toLocalFrame( | 4194 toLocalFrame( |
4195 m_webViewHelper.webView()->page()->mainFrame()->tree().firstChild()) | 4195 m_webViewHelper.webView()->page()->mainFrame()->tree().firstChild()) |
4196 ->document(); | 4196 ->document(); |
4197 EXPECT_TRUE(UseCounter::isCounted(*childDocument, | 4197 EXPECT_TRUE(UseCounter::isCounted(*childDocument, |
4198 UseCounter::SubFrameBeforeUnloadFired)); | 4198 UseCounter::SubFrameBeforeUnloadFired)); |
4199 } | 4199 } |
4200 } | 4200 } |
4201 | 4201 |
4202 // Verify that page loads are deferred until all ScopedPageLoadDeferrers are | 4202 // Verify that page loads are deferred until all ScopedPageLoadDeferrers are |
4203 // destroyed. | 4203 // destroyed. |
4204 TEST_P(WebViewTest, NestedLoadDeferrals) { | 4204 TEST_P(WebViewTest, NestedPageSuspensions) { |
4205 WebViewImpl* webView = m_webViewHelper.initialize(); | 4205 WebViewImpl* webView = m_webViewHelper.initialize(); |
4206 EXPECT_FALSE(webView->page()->defersLoading()); | 4206 EXPECT_FALSE(webView->page()->suspended()); |
4207 | 4207 |
4208 { | 4208 { |
4209 ScopedPageLoadDeferrer deferrer; | 4209 ScopedPageSuspender suspender; |
4210 EXPECT_TRUE(webView->page()->defersLoading()); | 4210 EXPECT_TRUE(webView->page()->suspended()); |
4211 | 4211 |
4212 { | 4212 { |
4213 ScopedPageLoadDeferrer deferrer2; | 4213 ScopedPageSuspender suspender2; |
4214 EXPECT_TRUE(webView->page()->defersLoading()); | 4214 EXPECT_TRUE(webView->page()->suspended()); |
4215 } | 4215 } |
4216 | 4216 |
4217 EXPECT_TRUE(webView->page()->defersLoading()); | 4217 EXPECT_TRUE(webView->page()->suspended()); |
4218 } | 4218 } |
4219 | 4219 |
4220 EXPECT_FALSE(webView->page()->defersLoading()); | 4220 EXPECT_FALSE(webView->page()->suspended()); |
4221 } | 4221 } |
4222 | 4222 |
4223 TEST_P(WebViewTest, ForceAndResetViewport) { | 4223 TEST_P(WebViewTest, ForceAndResetViewport) { |
4224 URLTestHelpers::registerMockedURLFromBaseURL( | 4224 URLTestHelpers::registerMockedURLFromBaseURL( |
4225 WebString::fromUTF8(m_baseURL.c_str()), | 4225 WebString::fromUTF8(m_baseURL.c_str()), |
4226 WebString::fromUTF8("200-by-300.html")); | 4226 WebString::fromUTF8("200-by-300.html")); |
4227 WebViewImpl* webViewImpl = | 4227 WebViewImpl* webViewImpl = |
4228 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html"); | 4228 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html"); |
4229 webViewImpl->resize(WebSize(100, 150)); | 4229 webViewImpl->resize(WebSize(100, 150)); |
4230 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150)); | 4230 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150)); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 .translate(50, 55) | 4355 .translate(50, 55) |
4356 .scale(1. / 2.f); | 4356 .scale(1. / 2.f); |
4357 EXPECT_EQ(expectedMatrix, | 4357 EXPECT_EQ(expectedMatrix, |
4358 webViewImpl->getDeviceEmulationTransformForTesting()); | 4358 webViewImpl->getDeviceEmulationTransformForTesting()); |
4359 // visibleContentRect doesn't change. | 4359 // visibleContentRect doesn't change. |
4360 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4360 EXPECT_EQ(IntRect(50, 55, 50, 75), |
4361 *devToolsEmulator->visibleContentRectForPainting()); | 4361 *devToolsEmulator->visibleContentRectForPainting()); |
4362 } | 4362 } |
4363 | 4363 |
4364 } // namespace blink | 4364 } // namespace blink |
OLD | NEW |