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

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

Issue 405263002: Base new scale on minimum-scale after orientation change. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring back contentsSize != 0 check Created 6 years, 5 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
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/resize_scroll_minimum_scale.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 const char* url = "resize_scroll_mobile.html"; 2035 const char* url = "resize_scroll_mobile.html";
2036 const float initialPageScaleFactor = 1; 2036 const float initialPageScaleFactor = 1;
2037 const WebSize scrollOffset(0, 50); 2037 const WebSize scrollOffset(0, 50);
2038 const WebSize viewportSize(120, 160); 2038 const WebSize viewportSize(120, 160);
2039 const bool shouldScaleRelativeToViewportWidth = true; 2039 const bool shouldScaleRelativeToViewportWidth = true;
2040 2040
2041 testResizeYieldsCorrectScrollAndScale( 2041 testResizeYieldsCorrectScrollAndScale(
2042 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela tiveToViewportWidth); 2042 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela tiveToViewportWidth);
2043 } 2043 }
2044 2044
2045 TEST_F(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForMinimumScale)
2046 {
2047 // This tests a scenario where minimum-scale is set to 1.0, but some element
2048 // on the page is slightly larger than the portrait width, so our "natural"
2049 // minimum-scale would be lower. In that case, we should stick to 1.0 scale
2050 // on rotation and not do anything strange.
2051 const char* url = "resize_scroll_minimum_scale.html";
2052 const float initialPageScaleFactor = 1;
2053 const WebSize scrollOffset(0, 0);
2054 const WebSize viewportSize(240, 320);
2055 const bool shouldScaleRelativeToViewportWidth = false;
2056
2057 testResizeYieldsCorrectScrollAndScale(
2058 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela tiveToViewportWidth);
2059 }
2060
2045 TEST_F(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedWidth) 2061 TEST_F(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedWidth)
2046 { 2062 {
2047 // With a fixed width, pageScaleFactor scales by the relative change in view port width. 2063 // With a fixed width, pageScaleFactor scales by the relative change in view port width.
2048 const char* url = "resize_scroll_fixed_width.html"; 2064 const char* url = "resize_scroll_fixed_width.html";
2049 const float initialPageScaleFactor = 2; 2065 const float initialPageScaleFactor = 2;
2050 const WebSize scrollOffset(0, 200); 2066 const WebSize scrollOffset(0, 200);
2051 const WebSize viewportSize(240, 320); 2067 const WebSize viewportSize(240, 320);
2052 const bool shouldScaleRelativeToViewportWidth = true; 2068 const bool shouldScaleRelativeToViewportWidth = true;
2053 2069
2054 testResizeYieldsCorrectScrollAndScale( 2070 testResizeYieldsCorrectScrollAndScale(
(...skipping 3853 matching lines...) Expand 10 before | Expand all | Expand 10 after
5908 5924
5909 client.reset(); 5925 client.reset();
5910 // Try to load the request with cross origin access. Should succeed. 5926 // Try to load the request with cross origin access. Should succeed.
5911 options.crossOriginRequestPolicy = WebCore::AllowCrossOriginRequests; 5927 options.crossOriginRequestPolicy = WebCore::AllowCrossOriginRequests;
5912 WebCore::DocumentThreadableLoader::loadResourceSynchronously( 5928 WebCore::DocumentThreadableLoader::loadResourceSynchronously(
5913 *frame->document(), WebCore::ResourceRequest(resourceUrl), client, optio ns, resourceLoaderOptions); 5929 *frame->document(), WebCore::ResourceRequest(resourceUrl), client, optio ns, resourceLoaderOptions);
5914 EXPECT_FALSE(client.failed()); 5930 EXPECT_FALSE(client.failed());
5915 } 5931 }
5916 5932
5917 } // namespace 5933 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/resize_scroll_minimum_scale.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698