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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 WebViewImpl* webViewImpl = toWebViewImpl(m_webView); | 910 WebViewImpl* webViewImpl = toWebViewImpl(m_webView); |
911 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); | 911 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
912 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); | 912 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
913 | 913 |
914 m_webView->settings()->setUseWideViewport(true); | 914 m_webView->settings()->setUseWideViewport(true); |
915 m_webView->layout(); | 915 m_webView->layout(); |
916 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); | 916 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
917 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); | 917 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
918 } | 918 } |
919 | 919 |
| 920 TEST_F(WebFrameTest, NonZeroValuesNoQuirk) |
| 921 { |
| 922 registerMockedHttpURLLoad("viewport-nonzero-values.html"); |
| 923 |
| 924 FixedLayoutTestWebViewClient client; |
| 925 client.m_screenInfo.deviceScaleFactor = 1; |
| 926 int viewportWidth = 640; |
| 927 int viewportHeight = 480; |
| 928 float expectedPageScaleFactor = 0.5f; |
| 929 |
| 930 m_webView = FrameTestHelpers::createWebView(true, 0, &client); |
| 931 m_webView->enableFixedLayoutMode(true); |
| 932 m_webView->settings()->setViewportEnabled(true); |
| 933 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); |
| 934 m_webView->settings()->setWideViewportQuirkEnabled(true); |
| 935 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-no
nzero-values.html"); |
| 936 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 937 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 938 |
| 939 WebViewImpl* webViewImpl = toWebViewImpl(m_webView); |
| 940 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewImpl->mainFrameImp
l()->frameView()->fixedLayoutSize().width()); |
| 941 EXPECT_EQ(expectedPageScaleFactor, m_webView->pageScaleFactor()); |
| 942 |
| 943 m_webView->settings()->setUseWideViewport(true); |
| 944 m_webView->layout(); |
| 945 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewImpl->mainFrameImp
l()->frameView()->fixedLayoutSize().width()); |
| 946 EXPECT_EQ(expectedPageScaleFactor, m_webView->pageScaleFactor()); |
| 947 } |
| 948 |
920 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) | 949 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
921 { | 950 { |
922 registerMockedHttpURLLoad("scale_oscillate.html"); | 951 registerMockedHttpURLLoad("scale_oscillate.html"); |
923 | 952 |
924 FixedLayoutTestWebViewClient client; | 953 FixedLayoutTestWebViewClient client; |
925 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); | 954 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); |
926 int viewportWidth = 800; | 955 int viewportWidth = 800; |
927 int viewportHeight = 1057; | 956 int viewportHeight = 1057; |
928 | 957 |
929 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); | 958 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); |
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3942 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3971 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3943 runPendingTasks(); | 3972 runPendingTasks(); |
3944 | 3973 |
3945 EXPECT_EQ(client.startLoadingCount(), 2); | 3974 EXPECT_EQ(client.startLoadingCount(), 2); |
3946 EXPECT_EQ(client.stopLoadingCount(), 2); | 3975 EXPECT_EQ(client.stopLoadingCount(), 2); |
3947 m_webView->close(); | 3976 m_webView->close(); |
3948 m_webView = 0; | 3977 m_webView = 0; |
3949 } | 3978 } |
3950 | 3979 |
3951 } // namespace | 3980 } // namespace |
OLD | NEW |