Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 23038013: [Android WebView] Avoid expanding layout width to match the old WebView (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed aelias' comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 685
686 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-wid e-2x-initial-scale.html", true, 0, &client); 686 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-wid e-2x-initial-scale.html", true, 0, &client);
687 m_webView->enableFixedLayoutMode(true); 687 m_webView->enableFixedLayoutMode(true);
688 m_webView->settings()->setViewportEnabled(true); 688 m_webView->settings()->setViewportEnabled(true);
689 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor); 689 m_webView->setInitialPageScaleOverride(enforcedPageScalePactor);
690 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 690 m_webView->resize(WebSize(viewportWidth, viewportHeight));
691 691
692 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor()); 692 EXPECT_EQ(enforcedPageScalePactor, m_webView->pageScaleFactor());
693 } 693 }
694 694
695 TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth)
696 {
697 registerMockedHttpURLLoad("viewport-device-0.5x-initial-scale.html");
698
699 FixedLayoutTestWebViewClient client;
700 client.m_screenInfo.deviceScaleFactor = 1;
701 int viewportWidth = 640;
702 int viewportHeight = 480;
703
704 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "viewport-dev ice-0.5x-initial-scale.html", true, 0, &client);
705 m_webView->enableFixedLayoutMode(true);
706 m_webView->settings()->setViewportEnabled(true);
707 m_webView->settings()->setUseWideViewport(true);
708 m_webView->settings()->setSupportDeprecatedTargetDensityDPI(true);
709 m_webView->settings()->setViewportMetaLayoutSizeQuirk(true);
710 m_webView->resize(WebSize(viewportWidth, viewportHeight));
711
712 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
713 EXPECT_EQ(viewportWidth, webViewImpl->mainFrameImpl()->frameView()->fixedLay outSize().width());
714 }
715
695 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) 716 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate)
696 { 717 {
697 registerMockedHttpURLLoad("scale_oscillate.html"); 718 registerMockedHttpURLLoad("scale_oscillate.html");
698 719
699 FixedLayoutTestWebViewClient client; 720 FixedLayoutTestWebViewClient client;
700 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325); 721 client.m_screenInfo.deviceScaleFactor = static_cast<float>(1.325);
701 int viewportWidth = 800; 722 int viewportWidth = 800;
702 int viewportHeight = 1057; 723 int viewportHeight = 1057;
703 724
704 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill ate.html", true, 0, &client); 725 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscill ate.html", true, 0, &client);
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client); 3614 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "push_state.h tml", true, 0, &client);
3594 runPendingTasks(); 3615 runPendingTasks();
3595 3616
3596 EXPECT_EQ(client.startLoadingCount(), 2); 3617 EXPECT_EQ(client.startLoadingCount(), 2);
3597 EXPECT_EQ(client.stopLoadingCount(), 2); 3618 EXPECT_EQ(client.stopLoadingCount(), 2);
3598 m_webView->close(); 3619 m_webView->close();
3599 m_webView = 0; 3620 m_webView = 0;
3600 } 3621 }
3601 3622
3602 } // namespace 3623 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/viewport-device-0.5x-initial-scale.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698