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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 10828143: Zoom level limits must be set before setting a zoom level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase & add comments. Created 8 years, 4 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 | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 6
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/common/intents_messages.h" 10 #include "content/common/intents_messages.h"
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 ASSERT_EQ(utf16_length, bounds.size()); 1691 ASSERT_EQ(utf16_length, bounds.size());
1692 for (size_t i = 0; i < utf16_length; ++i) { 1692 for (size_t i = 0; i < utf16_length; ++i) {
1693 if (is_surrogate_pair_empty_rect[i]) { 1693 if (is_surrogate_pair_empty_rect[i]) {
1694 EXPECT_EQ(0, bounds[i].width()); 1694 EXPECT_EQ(0, bounds[i].width());
1695 } else { 1695 } else {
1696 EXPECT_LT(0, bounds[i].width()); 1696 EXPECT_LT(0, bounds[i].width());
1697 } 1697 }
1698 } 1698 }
1699 view()->OnImeConfirmComposition(empty_string, ui::Range::InvalidRange()); 1699 view()->OnImeConfirmComposition(empty_string, ui::Range::InvalidRange());
1700 } 1700 }
1701
1702 TEST_F(RenderViewImplTest, ZoomLimit) {
1703 const double kMinZoomLevel =
1704 WebKit::WebView::zoomFactorToZoomLevel(content::kMinimumZoomFactor);
1705 const double kMaxZoomLevel =
1706 WebKit::WebView::zoomFactorToZoomLevel(content::kMaximumZoomFactor);
1707
1708 ViewMsg_Navigate_Params params;
1709 params.page_id = -1;
1710 params.navigation_type = ViewMsg_Navigate_Type::NORMAL;
1711
1712 // Verifies navigation to a URL with preset zoom level indeed sets the level.
1713 // Regression test for http://crbug.com/139559, where the level was not
1714 // properly set when it is out of the default zoom limits of WebView.
1715 params.url = GURL("data:text/html,min_zoomlimit_test");
1716 view()->OnSetZoomLevelForLoadingURL(params.url, kMinZoomLevel);
1717 view()->OnNavigate(params);
1718 ProcessPendingMessages();
1719 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel());
1720
1721 // It should work even when the zoom limit is temporarily changed in the page.
1722 view()->GetWebView()->zoomLimitsChanged(
1723 WebKit::WebView::zoomFactorToZoomLevel(1.0),
1724 WebKit::WebView::zoomFactorToZoomLevel(1.0));
1725 params.url = GURL("data:text/html,max_zoomlimit_test");
1726 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel);
1727 view()->OnNavigate(params);
1728 ProcessPendingMessages();
1729 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel());
1730 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698