| 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 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()->OnImeConfirmComposition( | 1648 view()->OnImeConfirmComposition( |
| 1649 empty_string, gfx::Range::InvalidRange(), false); | 1649 empty_string, gfx::Range::InvalidRange(), false); |
| 1650 } | 1650 } |
| 1651 #endif | 1651 #endif |
| 1652 | 1652 |
| 1653 TEST_F(RenderViewImplTest, ZoomLimit) { |
| 1654 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); |
| 1655 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); |
| 1656 |
| 1657 // Verifies navigation to a URL with preset zoom level indeed sets the level. |
| 1658 // Regression test for http://crbug.com/139559, where the level was not |
| 1659 // properly set when it is out of the default zoom limits of WebView. |
| 1660 CommonNavigationParams common_params; |
| 1661 common_params.url = GURL("data:text/html,min_zoomlimit_test"); |
| 1662 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); |
| 1663 frame()->Navigate(common_params, StartNavigationParams(), |
| 1664 RequestNavigationParams()); |
| 1665 ProcessPendingMessages(); |
| 1666 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); |
| 1667 |
| 1668 // It should work even when the zoom limit is temporarily changed in the page. |
| 1669 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), |
| 1670 ZoomFactorToZoomLevel(1.0)); |
| 1671 common_params.url = GURL("data:text/html,max_zoomlimit_test"); |
| 1672 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); |
| 1673 frame()->Navigate(common_params, StartNavigationParams(), |
| 1674 RequestNavigationParams()); |
| 1675 ProcessPendingMessages(); |
| 1676 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); |
| 1677 } |
| 1678 |
| 1653 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1679 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
| 1654 // Load an HTML page consisting of an input field. | 1680 // Load an HTML page consisting of an input field. |
| 1655 LoadHTML("<html>" | 1681 LoadHTML("<html>" |
| 1656 "<head>" | 1682 "<head>" |
| 1657 "</head>" | 1683 "</head>" |
| 1658 "<body>" | 1684 "<body>" |
| 1659 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1685 "<input id=\"test1\" value=\"some test text hello\"></input>" |
| 1660 "</body>" | 1686 "</body>" |
| 1661 "</html>"); | 1687 "</html>"); |
| 1662 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1688 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 "," | 2501 "," |
| 2476 "\"functionDeclaration\":\"function foo(){ " | 2502 "\"functionDeclaration\":\"function foo(){ " |
| 2477 "Promise.resolve().then(() => " | 2503 "Promise.resolve().then(() => " |
| 2478 "console.log(239))}\"" | 2504 "console.log(239))}\"" |
| 2479 "}" | 2505 "}" |
| 2480 "}"); | 2506 "}"); |
| 2481 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); | 2507 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); |
| 2482 } | 2508 } |
| 2483 | 2509 |
| 2484 } // namespace content | 2510 } // namespace content |
| OLD | NEW |