| 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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1775     webViewHelper.webView()->settings()->setUseWideViewport(false); |  1775     webViewHelper.webView()->settings()->setUseWideViewport(false); | 
|  1776     webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |  1776     webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 
|  1777     webViewHelper.webView()->layout(); |  1777     webViewHelper.webView()->layout(); | 
|  1778  |  1778  | 
|  1779     const float pageZoom = 0.25f; |  1779     const float pageZoom = 0.25f; | 
|  1780     EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
      , webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
      ), 1.0f); |  1780     EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom
      , webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(
      ), 1.0f); | 
|  1781     EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
      m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
      t(), 1.0f); |  1781     EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoo
      m, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().heigh
      t(), 1.0f); | 
|  1782     EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
      iew()->pageScaleFactor(), 0.01f); |  1782     EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
      iew()->pageScaleFactor(), 0.01f); | 
|  1783 } |  1783 } | 
|  1784  |  1784  | 
 |  1785 TEST_F(WebFrameTest, NoUserScalableQuirkIgnoresViewportScale) | 
 |  1786 { | 
 |  1787     UseMockScrollbarSettings mockScrollbarSettings; | 
 |  1788     registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
      ); | 
 |  1789  | 
 |  1790     FixedLayoutTestWebViewClient client; | 
 |  1791     int viewportWidth = 640; | 
 |  1792     int viewportHeight = 480; | 
 |  1793  | 
 |  1794     FrameTestHelpers::WebViewHelper webViewHelper; | 
 |  1795     webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
      -scalable-no.html", true, 0, &client); | 
 |  1796     webViewHelper.webView()->settings()->setViewportEnabled(true); | 
 |  1797     webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
      e); | 
 |  1798     webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 
 |  1799     webViewHelper.webView()->layout(); | 
 |  1800  | 
 |  1801     EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
      meView()->layoutSize().width(), 1.0f); | 
 |  1802     EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
      ameView()->layoutSize().height(), 1.0f); | 
 |  1803     EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 
 |  1804 } | 
 |  1805  | 
 |  1806 TEST_F(WebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForNonWideViewport) | 
 |  1807 { | 
 |  1808     UseMockScrollbarSettings mockScrollbarSettings; | 
 |  1809     registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"
      ); | 
 |  1810  | 
 |  1811     FixedLayoutTestWebViewClient client; | 
 |  1812     client.m_screenInfo.deviceScaleFactor = 1.33f; | 
 |  1813     int viewportWidth = 640; | 
 |  1814     int viewportHeight = 480; | 
 |  1815  | 
 |  1816     FrameTestHelpers::WebViewHelper webViewHelper; | 
 |  1817     webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-and-user
      -scalable-no.html", true, 0, &client); | 
 |  1818     webViewHelper.webView()->settings()->setViewportEnabled(true); | 
 |  1819     webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(tr
      ue); | 
 |  1820     webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
      e); | 
 |  1821     webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 
 |  1822     webViewHelper.webView()->settings()->setUseWideViewport(false); | 
 |  1823     webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 
 |  1824     webViewHelper.webView()->layout(); | 
 |  1825  | 
 |  1826     EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHe
      lper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); | 
 |  1827     EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewH
      elper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); | 
 |  1828     EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webV
      iew()->pageScaleFactor(), 0.01f); | 
 |  1829 } | 
 |  1830  | 
 |  1831 TEST_F(WebFrameTest, NoUserScalableQuirkIgnoresViewportScaleForWideViewport) | 
 |  1832 { | 
 |  1833     UseMockScrollbarSettings mockScrollbarSettings; | 
 |  1834     registerMockedHttpURLLoad("viewport-2x-initial-scale-non-user-scalable.html"
      ); | 
 |  1835  | 
 |  1836     FixedLayoutTestWebViewClient client; | 
 |  1837     int viewportWidth = 640; | 
 |  1838     int viewportHeight = 480; | 
 |  1839  | 
 |  1840     FrameTestHelpers::WebViewHelper webViewHelper; | 
 |  1841     webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale-non-u
      ser-scalable.html", true, 0, &client); | 
 |  1842     webViewHelper.webView()->settings()->setViewportEnabled(true); | 
 |  1843     webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(tru
      e); | 
 |  1844     webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); | 
 |  1845     webViewHelper.webView()->settings()->setUseWideViewport(true); | 
 |  1846     webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 
 |  1847  | 
 |  1848     EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->fra
      meView()->layoutSize().width(), 1.0f); | 
 |  1849     EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fr
      ameView()->layoutSize().height(), 1.0f); | 
 |  1850     EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); | 
 |  1851 } | 
 |  1852  | 
|  1785 class WebFrameResizeTest : public WebFrameTest { |  1853 class WebFrameResizeTest : public WebFrameTest { | 
|  1786 protected: |  1854 protected: | 
|  1787  |  1855  | 
|  1788     static WebCore::FloatSize computeRelativeOffset(const WebCore::IntPoint& abs
      oluteOffset, const WebCore::LayoutRect& rect) |  1856     static WebCore::FloatSize computeRelativeOffset(const WebCore::IntPoint& abs
      oluteOffset, const WebCore::LayoutRect& rect) | 
|  1789     { |  1857     { | 
|  1790         WebCore::FloatSize relativeOffset = WebCore::FloatPoint(absoluteOffset) 
      - rect.location(); |  1858         WebCore::FloatSize relativeOffset = WebCore::FloatPoint(absoluteOffset) 
      - rect.location(); | 
|  1791         relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); |  1859         relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); | 
|  1792         return relativeOffset; |  1860         return relativeOffset; | 
|  1793     } |  1861     } | 
|  1794  |  1862  | 
| (...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4803  |  4871  | 
|  4804     FrameTestHelpers::loadFrame(frame, |  4872     FrameTestHelpers::loadFrame(frame, | 
|  4805         "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html
      ')"); |  4873         "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html
      ')"); | 
|  4806     runPendingTasks(); |  4874     runPendingTasks(); | 
|  4807     Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |  4875     Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 
|  4808     EXPECT_EQ(client.frame(), iframe); |  4876     EXPECT_EQ(client.frame(), iframe); | 
|  4809     EXPECT_FALSE(client.replacesCurrentHistoryItem()); |  4877     EXPECT_FALSE(client.replacesCurrentHistoryItem()); | 
|  4810 } |  4878 } | 
|  4811  |  4879  | 
|  4812 } // namespace |  4880 } // namespace | 
| OLD | NEW |