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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 690 |
691 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-wid
e-2x-initial-scale.html", true, 0, &client); | 691 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-wid
e-2x-initial-scale.html", true, 0, &client); |
692 m_webView->enableFixedLayoutMode(true); | 692 m_webView->enableFixedLayoutMode(true); |
693 m_webView->settings()->setViewportEnabled(true); | 693 m_webView->settings()->setViewportEnabled(true); |
694 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor); | 694 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor); |
695 m_webView->resize(WebSize(viewportWidth, viewportHeight)); | 695 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
696 | 696 |
697 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor()); | 697 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor()); |
698 } | 698 } |
699 | 699 |
| 700 TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth) |
| 701 { |
| 702 registerMockedHttpURLLoad("viewport-device-0.5x-initial-scale.html"); |
| 703 |
| 704 FixedLayoutTestWebViewClient client; |
| 705 client.m_screenInfo.deviceScaleFactor = 1; |
| 706 int viewportWidth = 640; |
| 707 int viewportHeight = 480; |
| 708 |
| 709 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev
ice-0.5x-initial-scale.html", true, 0, &client); |
| 710 m_webView->enableFixedLayoutMode(true); |
| 711 m_webView->settings()->setViewportEnabled(true); |
| 712 m_webView->settings()->setUseWideViewport(true); |
| 713 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true); |
| 714 m_webView->resize(WebSize(viewportWidth, viewportHeight)); |
| 715 |
| 716 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); |
| 717 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay
outSize().width()); |
| 718 } |
| 719 |
700 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) | 720 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) |
701 { | 721 { |
702 registerMockedHttpURLLoad("scale_oscillate.html"); | 722 registerMockedHttpURLLoad("scale_oscillate.html"); |
703 | 723 |
704 FixedLayoutTestWebViewClient client; | 724 FixedLayoutTestWebViewClient client; |
705 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); | 725 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); |
706 int viewportWidth = 800; | 726 int viewportWidth = 800; |
707 int viewportHeight = 1057; | 727 int viewportHeight = 1057; |
708 | 728 |
709 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); | 729 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill
ate.html", true, 0, &client); |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); | 3634 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h
tml", true, 0, &client); |
3615 runPendingTasks(); | 3635 runPendingTasks(); |
3616 | 3636 |
3617 EXPECT_EQ(client.startLoadingCount(), 2); | 3637 EXPECT_EQ(client.startLoadingCount(), 2); |
3618 EXPECT_EQ(client.stopLoadingCount(), 2); | 3638 EXPECT_EQ(client.stopLoadingCount(), 2); |
3619 m_webView->close(); | 3639 m_webView->close(); |
3620 m_webView = 0; | 3640 m_webView = 0; |
3621 } | 3641 } |
3622 | 3642 |
3623 } // namespace | 3643 } // namespace |
OLD | NEW |