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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 int viewportHeight = 480; | 878 int viewportHeight = 480; |
879 | 879 |
880 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev
ice-0.5x-initial-scale.html", true, 0, &client); | 880 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev
ice-0.5x-initial-scale.html", true, 0, &client); |
881 m_webView->enableFixedLayoutMode(true); | 881 m_webView->enableFixedLayoutMode(true); |
882 m_webView->settings()->setViewportEnabled(true); | 882 m_webView->settings()->setViewportEnabled(true); |
883 m_webView->settings()->setWideViewportQuirkEnabled(true); | 883 m_webView->settings()->setWideViewportQuirkEnabled(true); |
884 m_webView->settings()->setUseWideViewport(true); | 884 m_webView->settings()->setUseWideViewport(true); |
885 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); | 885 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); |
886 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 886 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
887 | 887 |
888 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); | 888 WebViewImpl* webViewImpl = toWebViewImpl(m_webView); |
889 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); | 889 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
890 } | 890 } |
891 | 891 |
892 TEST_F(WebFrameTest, ZeroValuesQuirk) | 892 TEST_F(WebFrameTest, ZeroValuesQuirk) |
893 { | 893 { |
894 registerMockedHttpURLLoad("viewport-zero-values.html"); | 894 registerMockedHttpURLLoad("viewport-zero-values.html"); |
895 | 895 |
896 FixedLayoutTestWebViewClient client; | 896 FixedLayoutTestWebViewClient client; |
897 client.m_screenInfo.deviceScaleFactor = 1; | 897 client.m_screenInfo.deviceScaleFactor = 1; |
898 int viewportWidth = 640; | 898 int viewportWidth = 640; |
899 int viewportHeight = 480; | 899 int viewportHeight = 480; |
900 | 900 |
901 m_webView = FrameTestHelpers::createWebView(true, 0, &client); | 901 m_webView = FrameTestHelpers::createWebView(true, 0, &client); |
902 m_webView->enableFixedLayoutMode(true); | 902 m_webView->enableFixedLayoutMode(true); |
903 m_webView->settings()->setViewportEnabled(true); | 903 m_webView->settings()->setViewportEnabled(true); |
904 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); | 904 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); |
905 m_webView->settings()->setWideViewportQuirkEnabled(true); | 905 m_webView->settings()->setWideViewportQuirkEnabled(true); |
906 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-ze
ro-values.html"); | 906 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-ze
ro-values.html"); |
907 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 907 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
908 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 908 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
909 | 909 |
910 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(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, ScaleFactorShouldNotOscillate) | 920 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
(...skipping 3021 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); | 3942 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3943 runPendingTasks(); | 3943 runPendingTasks(); |
3944 | 3944 |
3945 EXPECT_EQ(client.startLoadingCount(), 2); | 3945 EXPECT_EQ(client.startLoadingCount(), 2); |
3946 EXPECT_EQ(client.stopLoadingCount(), 2); | 3946 EXPECT_EQ(client.stopLoadingCount(), 2); |
3947 m_webView->close(); | 3947 m_webView->close(); |
3948 m_webView = 0; | 3948 m_webView = 0; |
3949 } | 3949 } |
3950 | 3950 |
3951 } // namespace | 3951 } // namespace |
OLD | NEW |