| 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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 if (is_surrogate_pair_empty_rect[i]) { | 1642 if (is_surrogate_pair_empty_rect[i]) { |
| 1643 EXPECT_EQ(0, bounds[i].width()); | 1643 EXPECT_EQ(0, bounds[i].width()); |
| 1644 } else { | 1644 } else { |
| 1645 EXPECT_LT(0, bounds[i].width()); | 1645 EXPECT_LT(0, bounds[i].width()); |
| 1646 } | 1646 } |
| 1647 } | 1647 } |
| 1648 view()->OnImeCommitText(empty_string, gfx::Range::InvalidRange(), 0); | 1648 view()->OnImeCommitText(empty_string, gfx::Range::InvalidRange(), 0); |
| 1649 } | 1649 } |
| 1650 #endif | 1650 #endif |
| 1651 | 1651 |
| 1652 TEST_F(RenderViewImplTest, ZoomLimit) { | |
| 1653 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | |
| 1654 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | |
| 1655 | |
| 1656 // Verifies navigation to a URL with preset zoom level indeed sets the level. | |
| 1657 // Regression test for http://crbug.com/139559, where the level was not | |
| 1658 // properly set when it is out of the default zoom limits of WebView. | |
| 1659 CommonNavigationParams common_params; | |
| 1660 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | |
| 1661 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); | |
| 1662 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1663 RequestNavigationParams()); | |
| 1664 ProcessPendingMessages(); | |
| 1665 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1666 | |
| 1667 // It should work even when the zoom limit is temporarily changed in the page. | |
| 1668 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | |
| 1669 ZoomFactorToZoomLevel(1.0)); | |
| 1670 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | |
| 1671 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); | |
| 1672 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1673 RequestNavigationParams()); | |
| 1674 ProcessPendingMessages(); | |
| 1675 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1676 } | |
| 1677 | |
| 1678 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1652 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
| 1679 // Load an HTML page consisting of an input field. | 1653 // Load an HTML page consisting of an input field. |
| 1680 LoadHTML("<html>" | 1654 LoadHTML("<html>" |
| 1681 "<head>" | 1655 "<head>" |
| 1682 "</head>" | 1656 "</head>" |
| 1683 "<body>" | 1657 "<body>" |
| 1684 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1658 "<input id=\"test1\" value=\"some test text hello\"></input>" |
| 1685 "</body>" | 1659 "</body>" |
| 1686 "</html>"); | 1660 "</html>"); |
| 1687 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1661 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 ExpectPauseAndResume(3); | 2530 ExpectPauseAndResume(3); |
| 2557 blink::WebScriptSource source2( | 2531 blink::WebScriptSource source2( |
| 2558 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2532 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
| 2559 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2533 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
| 2560 | 2534 |
| 2561 EXPECT_FALSE(IsPaused()); | 2535 EXPECT_FALSE(IsPaused()); |
| 2562 Detach(); | 2536 Detach(); |
| 2563 } | 2537 } |
| 2564 | 2538 |
| 2565 } // namespace content | 2539 } // namespace content |
| OLD | NEW |