| 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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 EXPECT_EQ(0, bounds[i].width()); | 1598 EXPECT_EQ(0, bounds[i].width()); |
| 1599 } else { | 1599 } else { |
| 1600 EXPECT_LT(0, bounds[i].width()); | 1600 EXPECT_LT(0, bounds[i].width()); |
| 1601 } | 1601 } |
| 1602 } | 1602 } |
| 1603 view()->OnImeConfirmComposition( | 1603 view()->OnImeConfirmComposition( |
| 1604 empty_string, gfx::Range::InvalidRange(), false); | 1604 empty_string, gfx::Range::InvalidRange(), false); |
| 1605 } | 1605 } |
| 1606 #endif | 1606 #endif |
| 1607 | 1607 |
| 1608 TEST_F(RenderViewImplTest, ZoomLimit) { | |
| 1609 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | |
| 1610 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | |
| 1611 | |
| 1612 // Verifies navigation to a URL with preset zoom level indeed sets the level. | |
| 1613 // Regression test for http://crbug.com/139559, where the level was not | |
| 1614 // properly set when it is out of the default zoom limits of WebView. | |
| 1615 CommonNavigationParams common_params; | |
| 1616 common_params.url = GURL("data:text/html,min_zoomlimit_test"); | |
| 1617 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); | |
| 1618 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1619 RequestNavigationParams()); | |
| 1620 ProcessPendingMessages(); | |
| 1621 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1622 | |
| 1623 // It should work even when the zoom limit is temporarily changed in the page. | |
| 1624 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | |
| 1625 ZoomFactorToZoomLevel(1.0)); | |
| 1626 common_params.url = GURL("data:text/html,max_zoomlimit_test"); | |
| 1627 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); | |
| 1628 frame()->Navigate(common_params, StartNavigationParams(), | |
| 1629 RequestNavigationParams()); | |
| 1630 ProcessPendingMessages(); | |
| 1631 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | |
| 1632 } | |
| 1633 | |
| 1634 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 1608 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
| 1635 // Load an HTML page consisting of an input field. | 1609 // Load an HTML page consisting of an input field. |
| 1636 LoadHTML("<html>" | 1610 LoadHTML("<html>" |
| 1637 "<head>" | 1611 "<head>" |
| 1638 "</head>" | 1612 "</head>" |
| 1639 "<body>" | 1613 "<body>" |
| 1640 "<input id=\"test1\" value=\"some test text hello\"></input>" | 1614 "<input id=\"test1\" value=\"some test text hello\"></input>" |
| 1641 "</body>" | 1615 "</body>" |
| 1642 "</html>"); | 1616 "</html>"); |
| 1643 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); | 1617 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 "," | 2430 "," |
| 2457 "\"functionDeclaration\":\"function foo(){ " | 2431 "\"functionDeclaration\":\"function foo(){ " |
| 2458 "Promise.resolve().then(() => " | 2432 "Promise.resolve().then(() => " |
| 2459 "console.log(239))}\"" | 2433 "console.log(239))}\"" |
| 2460 "}" | 2434 "}" |
| 2461 "}"); | 2435 "}"); |
| 2462 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); | 2436 EXPECT_EQ(1, CountNotifications("Console.messageAdded")); |
| 2463 } | 2437 } |
| 2464 | 2438 |
| 2465 } // namespace content | 2439 } // namespace content |
| OLD | NEW |