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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 FixedLayoutTestWebViewClient client; | 699 FixedLayoutTestWebViewClient client; |
700 client.m_screenInfo.deviceScaleFactor = 1; | 700 client.m_screenInfo.deviceScaleFactor = 1; |
701 int viewportWidth = 640; | 701 int viewportWidth = 640; |
702 int viewportHeight = 480; | 702 int viewportHeight = 480; |
703 | 703 |
704 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev
ice-0.5x-initial-scale.html", true, 0, &client); | 704 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev
ice-0.5x-initial-scale.html", true, 0, &client); |
705 m_webView->enableFixedLayoutMode(true); | 705 m_webView->enableFixedLayoutMode(true); |
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()->setViewportMetaLayoutSizeAndZeroValuesQuirk(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::createWebViewAndLoad(m_baseURL + "viewport-zer
o-values.html", true, 0, &client); |
| 726 m_webView->enableFixedLayoutMode(true); |
| 727 m_webView->settings()->setViewportEnabled(true); |
| 728 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 729 m_webView->settings()->setViewportMetaLayoutSizeAndZeroValuesQuirk(true); |
| 730 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 731 |
| 732 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 733 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
| 734 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 735 |
| 736 m_webView->settings()->setUseWideViewport(true); |
| 737 m_webView->layout(); |
| 738 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
| 739 EXPECT_EQ(1.0f, m_webView->pageScaleFactor()); |
| 740 } |
| 741 |
716 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) | 742 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
717 { | 743 { |
718 registerMockedHttpURLLoad("scale_oscillate.html"); | 744 registerMockedHttpURLLoad("scale_oscillate.html"); |
719 | 745 |
720 FixedLayoutTestWebViewClient client; | 746 FixedLayoutTestWebViewClient client; |
721 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); | 747 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); |
722 int viewportWidth = 800; | 748 int viewportWidth = 800; |
723 int viewportHeight = 1057; | 749 int viewportHeight = 1057; |
724 | 750 |
725 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); | 751 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); |
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3671 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3646 runPendingTasks(); | 3672 runPendingTasks(); |
3647 | 3673 |
3648 EXPECT_EQ(client.startLoadingCount(), 2); | 3674 EXPECT_EQ(client.startLoadingCount(), 2); |
3649 EXPECT_EQ(client.stopLoadingCount(), 2); | 3675 EXPECT_EQ(client.stopLoadingCount(), 2); |
3650 m_webView->close(); | 3676 m_webView->close(); |
3651 m_webView = 0; | 3677 m_webView = 0; |
3652 } | 3678 } |
3653 | 3679 |
3654 } // namespace | 3680 } // namespace |
OLD | NEW |