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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 m_webView->settings()->setViewportEnabled(true); | 706 m_webView->settings()->setViewportEnabled(true); |
707 m_webView->settings()->setUseWideViewport(true); | 707 m_webView->settings()->setUseWideViewport(true); |
708 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); | 708 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
709 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); | 709 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true); |
710 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 710 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
711 | 711 |
712 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); | 712 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
713 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); | 713 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
714 } | 714 } |
715 | 715 |
| 716 TEST_F(WebFrameTest, ZeroValuesQuirk) |
| 717 { |
| 718 registerMockedHttpURLLoad("viewport-zero-values.html"); |
| 719 |
| 720 FixedLayoutTestWebViewClient client; |
| 721 client.m_screenInfo.deviceScaleFactor = 1; |
| 722 int viewportWidth = 640; |
| 723 int viewportHeight = 480; |
| 724 |
| 725 m_webView = FrameTestHelpers::createWebView(true, 0, &client); |
| 726 m_webView->enableFixedLayoutMode(true); |
| 727 m_webView->settings()->setViewportEnabled(true); |
| 728 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 729 m_webView->settings()->setViewportMetaZeroValuesQuirk(true); |
| 730 FrameTestHelpers::loadFrame(m_webView->mainFrame(), m_baseURL + "viewport-ze
ro-values.html"); |
| 731 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 732 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 733 |
| 734 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 735 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
| 736 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 737 |
| 738 m_webView->settings()->setUseWideViewport(true); |
| 739 m_webView->layout(); |
| 740 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
| 741 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 742 } |
| 743 |
716 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) | 744 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
717 { | 745 { |
718 registerMockedHttpURLLoad("scale_oscillate.html"); | 746 registerMockedHttpURLLoad("scale_oscillate.html"); |
719 | 747 |
720 FixedLayoutTestWebViewClient client; | 748 FixedLayoutTestWebViewClient client; |
721 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); | 749 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); |
722 int viewportWidth = 800; | 750 int viewportWidth = 800; |
723 int viewportHeight = 1057; | 751 int viewportHeight = 1057; |
724 | 752 |
725 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); | 753 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); |
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3678 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3651 runPendingTasks(); | 3679 runPendingTasks(); |
3652 | 3680 |
3653 EXPECT_EQ(client.startLoadingCount(), 2); | 3681 EXPECT_EQ(client.startLoadingCount(), 2); |
3654 EXPECT_EQ(client.stopLoadingCount(), 2); | 3682 EXPECT_EQ(client.stopLoadingCount(), 2); |
3655 m_webView->close(); | 3683 m_webView->close(); |
3656 m_webView = 0; | 3684 m_webView = 0; |
3657 } | 3685 } |
3658 | 3686 |
3659 } // namespace | 3687 } // namespace |
OLD | NEW |