OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 EXPECT_EQ(0, bounds[i].width()); | 1621 EXPECT_EQ(0, bounds[i].width()); |
1622 } else { | 1622 } else { |
1623 EXPECT_LT(0, bounds[i].width()); | 1623 EXPECT_LT(0, bounds[i].width()); |
1624 } | 1624 } |
1625 } | 1625 } |
1626 view()->OnImeConfirmComposition( | 1626 view()->OnImeConfirmComposition( |
1627 empty_string, gfx::Range::InvalidRange(), false); | 1627 empty_string, gfx::Range::InvalidRange(), false); |
1628 } | 1628 } |
1629 #endif | 1629 #endif |
1630 | 1630 |
1631 TEST_F(RenderViewImplTest, ZoomLimit) { | |
1632 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | |
1633 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | |
1634 | |
1635 // Verifies navigation to a URL with preset zoom level indeed sets the level. | |
1636 // Regression test for http://crbug.com/139559, where the level was not | |
1637 // properly set when it is out of the default zoom limits of WebView. | |
1638 CommonNavigationParams common_params; | |
1639 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | |
1640 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); | |
1641 frame()->Navigate(common_params, StartNavigationParams(), | |
1642 RequestNavigationParams()); | |
1643 ProcessPendingMessages(); | |
1644 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | |
1645 | |
1646 // It should work even when the zoom limit is temporarily changed in the page. | |
1647 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | |
1648 ZoomFactorToZoomLevel(1.0)); | |
1649 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | |
1650 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); | |
1651 frame()->Navigate(common_params, StartNavigationParams(), | |
1652 RequestNavigationParams()); | |
1653 ProcessPendingMessages(); | |
1654 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | |
1655 } | |
1656 | |
1657 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1631 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
1658 // Load an HTML page consisting of an input field. | 1632 // Load an HTML page consisting of an input field. |
1659 LoadHTML("<html>" | 1633 LoadHTML("<html>" |
1660 "<head>" | 1634 "<head>" |
1661 "</head>" | 1635 "</head>" |
1662 "<body>" | 1636 "<body>" |
1663 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1637 "<input id=\"test1\" value=\"some test text hello\"></input>" |
1664 "</body>" | 1638 "</body>" |
1665 "</html>"); | 1639 "</html>"); |
1666 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1640 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2480 ExpectPauseAndResume(3); | 2454 ExpectPauseAndResume(3); |
2481 blink::WebScriptSource source2( | 2455 blink::WebScriptSource source2( |
2482 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2456 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2483 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2457 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
2484 | 2458 |
2485 EXPECT_FALSE(IsPaused()); | 2459 EXPECT_FALSE(IsPaused()); |
2486 Detach(); | 2460 Detach(); |
2487 } | 2461 } |
2488 | 2462 |
2489 } // namespace content | 2463 } // namespace content |
OLD | NEW |