Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/VisualViewport.h" 5 #include "core/frame/VisualViewport.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void registerMockedHttpURLLoad(const std::string& fileName) 146 void registerMockedHttpURLLoad(const std::string& fileName)
147 { 147 {
148 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU RL.c_str()), WebString::fromUTF8(fileName.c_str())); 148 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU RL.c_str()), WebString::fromUTF8(fileName.c_str()));
149 } 149 }
150 150
151 WebLayer* getRootScrollLayer() 151 WebLayer* getRootScrollLayer()
152 { 152 {
153 PaintLayerCompositor* compositor = frame()->contentLayoutObject()->compo sitor(); 153 PaintLayerCompositor* compositor = frame()->contentLayoutObject()->compo sitor();
154 ASSERT(compositor); 154 DCHECK(compositor);
155 ASSERT(compositor->scrollLayer()); 155 DCHECK(compositor->scrollLayer());
156 156
157 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); 157 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer();
158 return webScrollLayer; 158 return webScrollLayer;
159 } 159 }
160 160
161 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } 161 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); }
162 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()-> frame(); } 162 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()-> frame(); }
163 163
164 static void configureSettings(WebSettings* settings) 164 static void configureSettings(WebSettings* settings)
165 { 165 {
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 // properties will trigger a layout which will cause an update to viewport 1694 // properties will trigger a layout which will cause an update to viewport
1695 // constraints and a refreshed initial scale. crbug.com/466718 1695 // constraints and a refreshed initial scale. crbug.com/466718
1696 TEST_P(ParameterizedVisualViewportTest, WindowDimensionsOnLoad) 1696 TEST_P(ParameterizedVisualViewportTest, WindowDimensionsOnLoad)
1697 { 1697 {
1698 initializeWithAndroidSettings(); 1698 initializeWithAndroidSettings();
1699 registerMockedHttpURLLoad("window_dimensions.html"); 1699 registerMockedHttpURLLoad("window_dimensions.html");
1700 webViewImpl()->resize(IntSize(800, 600)); 1700 webViewImpl()->resize(IntSize(800, 600));
1701 navigateTo(m_baseURL + "window_dimensions.html"); 1701 navigateTo(m_baseURL + "window_dimensions.html");
1702 1702
1703 Element* output = frame()->document()->getElementById("output"); 1703 Element* output = frame()->document()->getElementById("output");
1704 ASSERT(output); 1704 DCHECK(output);
1705 EXPECT_EQ(std::string("1600x1200"), std::string(output->innerHTML().ascii(). data())); 1705 EXPECT_EQ(std::string("1600x1200"), std::string(output->innerHTML().ascii(). data()));
1706 } 1706 }
1707 1707
1708 // Similar to above but make sure the initial scale is updated with the content 1708 // Similar to above but make sure the initial scale is updated with the content
1709 // width for a very wide page. That is, make that innerWidth/Height actually 1709 // width for a very wide page. That is, make that innerWidth/Height actually
1710 // trigger a layout of the content, and not just an update of the viepwort. 1710 // trigger a layout of the content, and not just an update of the viepwort.
1711 // crbug.com/466718 1711 // crbug.com/466718
1712 TEST_P(ParameterizedVisualViewportTest, WindowDimensionsOnLoadWideContent) 1712 TEST_P(ParameterizedVisualViewportTest, WindowDimensionsOnLoadWideContent)
1713 { 1713 {
1714 initializeWithAndroidSettings(); 1714 initializeWithAndroidSettings();
1715 registerMockedHttpURLLoad("window_dimensions_wide_div.html"); 1715 registerMockedHttpURLLoad("window_dimensions_wide_div.html");
1716 webViewImpl()->resize(IntSize(800, 600)); 1716 webViewImpl()->resize(IntSize(800, 600));
1717 navigateTo(m_baseURL + "window_dimensions_wide_div.html"); 1717 navigateTo(m_baseURL + "window_dimensions_wide_div.html");
1718 1718
1719 Element* output = frame()->document()->getElementById("output"); 1719 Element* output = frame()->document()->getElementById("output");
1720 ASSERT(output); 1720 DCHECK(output);
1721 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii(). data())); 1721 EXPECT_EQ(std::string("2000x1500"), std::string(output->innerHTML().ascii(). data()));
1722 } 1722 }
1723 1723
1724 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl y) 1724 TEST_P(ParameterizedVisualViewportTest, PinchZoomGestureScrollsVisualViewportOnl y)
1725 { 1725 {
1726 initializeWithDesktopSettings(); 1726 initializeWithDesktopSettings();
1727 webViewImpl()->resize(IntSize(100, 100)); 1727 webViewImpl()->resize(IntSize(100, 100));
1728 1728
1729 registerMockedHttpURLLoad("200-by-800-viewport.html"); 1729 registerMockedHttpURLLoad("200-by-800-viewport.html");
1730 navigateTo(m_baseURL + "200-by-800-viewport.html"); 1730 navigateTo(m_baseURL + "200-by-800-viewport.html");
1731 1731
1732 WebGestureEvent pinchUpdate; 1732 WebGestureEvent pinchUpdate;
1733 pinchUpdate.type = WebInputEvent::GesturePinchUpdate; 1733 pinchUpdate.type = WebInputEvent::GesturePinchUpdate;
1734 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad; 1734 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad;
1735 pinchUpdate.x = 100; 1735 pinchUpdate.x = 100;
1736 pinchUpdate.y = 100; 1736 pinchUpdate.y = 100;
1737 pinchUpdate.data.pinchUpdate.scale = 2; 1737 pinchUpdate.data.pinchUpdate.scale = 2;
1738 pinchUpdate.data.pinchUpdate.zoomDisabled = false; 1738 pinchUpdate.data.pinchUpdate.zoomDisabled = false;
1739 1739
1740 webViewImpl()->handleInputEvent(pinchUpdate); 1740 webViewImpl()->handleInputEvent(pinchUpdate);
1741 1741
1742 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport(); 1742 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport();
1743 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1743 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1744 1744
1745 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); 1745 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location());
1746 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); 1746 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble());
1747 } 1747 }
1748 1748
1749 } // namespace 1749 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698